gum() - Generalised Univariate Model

Ivan Svetunkov

2023-09-16

gum() constructs Generalised Exponential Smoothing - pure additive state-space model. It is a part of smooth package.

Let’s load the necessary packages:

require(smooth)

Generalised Exponential Smoothing is a next step from CES. It is a state-space model in which all the matrices and vectors are estimated. It is very demanding in sample size, but is also insanely flexible.

A simple call by default constructs GUM\((1^1,1^m)\), where \(m\) is frequency of the data. So for our example with AirPassengers data, we will have GUM\((1^1,1^{12})\):

gum(AirPassengers, h=18, holdout=TRUE)
## Time elapsed: 0.6 seconds
## Model estimated: GUM(1[1],1[12])
## Persistence vector g:
##        [,1]   [,2]
## [1,] 0.7405 0.8682
## Transition matrix F: 
##        [,1]   [,2]
## [1,] 0.8408 0.0202
## [2,] 0.9078 1.0000
## Measurement vector w: 1, 1
## Initial values were optimised.
## 
## Loss function type: likelihood; Loss function value: 463.4267
## Error standard deviation: 10.4382
## Sample size: 126
## Number of estimated parameters: 20
## Number of provided parameters: 2
## Number of degrees of freedom: 106
## Information criteria:
##       AIC      AICc       BIC      BICc 
##  966.8534  974.8534 1023.5790 1042.9241 
## 
## Forecast errors:
## MPE: 1.5%; sCE: 58.8%; Asymmetry: 73.2%; MAPE: 2.8%
## MASE: 0.6; sMAE: 5.4%; sMSE: 0.5%; rMAE: 0.216; rRMSE: 0.233

But some different orders and lags can be specified. For example:

gum(AirPassengers, h=18, holdout=TRUE, orders=c(2,1), lags=c(1,12))
## Time elapsed: 0.8 seconds
## Model estimated: GUM(2[1],1[12])
## Persistence vector g:
##        [,1]   [,2]  [,3]
## [1,] 0.4204 0.2932 0.879
## Transition matrix F: 
##        [,1]   [,2]   [,3]
## [1,] 0.7757 0.0278 0.0002
## [2,] 0.9595 0.0007 0.0919
## [3,] 0.7378 0.9798 0.9975
## Measurement vector w: 1, 1, 1
## Initial values were optimised.
## 
## Loss function type: likelihood; Loss function value: 459.7433
## Error standard deviation: 10.4898
## Sample size: 126
## Number of estimated parameters: 27
## Number of provided parameters: 3
## Number of degrees of freedom: 99
## Information criteria:
##       AIC      AICc       BIC      BICc 
##  973.4866  988.9152 1050.0662 1087.3747 
## 
## Forecast errors:
## MPE: 1.6%; sCE: 53.3%; Asymmetry: 64.8%; MAPE: 2.8%
## MASE: 0.57; sMAE: 5.1%; sMSE: 0.4%; rMAE: 0.206; rRMSE: 0.211

Function auto.gum() is now implemented in smooth, but it works slowly as it needs to check a large number of models:

auto.gum(AirPassengers, interval=TRUE, silent=FALSE)
## Starting preliminary loop:            1 out of 122 out of 123 out of 124 out of 125 out of 126 out of 127 out of 128 out of 129 out of 1210 out of 1211 out of 1212 out of 12. Done.
## Searching for appropriate lags:  —\|/—\|/—\|/We found them!
## Searching for appropriate orders:  —\|/—\|/—Orders found.
## Reestimating the model. Done!
## Time elapsed: 13 seconds
## Model estimated: GUM(1[1],3[12])
## Persistence vector g:
##        [,1]   [,2]    [,3]   [,4]
## [1,] 0.6227 0.2699 -0.0083 0.5413
## Transition matrix F: 
##        [,1]   [,2]   [,3]   [,4]
## [1,] 0.9086 0.0001 0.0058 0.0000
## [2,] 0.4310 0.9214 0.1803 0.0000
## [3,] 0.2741 0.0084 0.0004 0.9978
## [4,] 0.0002 0.9940 0.0003 0.0906
## Measurement vector w: 1, 1, 1, 1
## Initial values were produced using backcasting.
## 
## Loss function type: likelihood; Loss function value: 524.9815
## Error standard deviation: 10.03
## Sample size: 144
## Number of estimated parameters: 21
## Number of provided parameters: 4
## Number of degrees of freedom: 123
## Information criteria:
##      AIC     AICc      BIC     BICc 
## 1091.963 1099.537 1154.329 1173.149 
## 
## 95% parametric prediction interval was constructed

In addition to standard values that other functions accept, GUM accepts predefined values for transition matrix, measurement and persistence vectors. For example, something more common can be passed to the function:

    transition <- matrix(c(1,0,0,1,1,0,0,0,1),3,3)
    measurement <- c(1,1,1)
    gum(AirPassengers, h=18, holdout=TRUE, orders=c(2,1), lags=c(1,12), transition=transition, measurement=measurement)
## Time elapsed: 0.14 seconds
## Model estimated: GUM(2[1],1[12])
## Persistence vector g:
##        [,1]   [,2]   [,3]
## [1,] 0.4176 0.0141 0.8337
## Transition matrix F: 
##      [,1] [,2] [,3]
## [1,]    1    1    0
## [2,]    0    1    0
## [3,]    0    0    1
## Measurement vector w: 1, 1, 1
## Initial values were optimised.
## 
## Loss function type: likelihood; Loss function value: 488.6188
## Error standard deviation: 12.6299
## Sample size: 126
## Number of estimated parameters: 18
## Number of provided parameters: 12
## Number of degrees of freedom: 108
## Information criteria:
##      AIC     AICc      BIC     BICc 
## 1013.238 1019.630 1064.291 1079.749 
## 
## Forecast errors:
## MPE: 6.8%; sCE: 227%; Asymmetry: 95.3%; MAPE: 7.1%
## MASE: 1.478; sMAE: 13.2%; sMSE: 2%; rMAE: 0.532; rRMSE: 0.476

The resulting model will be equivalent to ETS(A,A,A). However due to different initialisation of optimisers and different method of number of parameters calculation, gum() above and es(y, "AAA", h=h, holdout=TRUE) will lead to different models.