gum()
constructs Generalised Exponential
Smoothing - pure additive state-space model. It is a part of smooth package.
Let’s load the necessary packages:
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(11, 1m),
where m is frequency of the
data. So for our example with AirPassengers
data, we will
have GUM(11, 112):
## Time elapsed: 0.67 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:
## Time elapsed: 0.91 seconds
## Model estimated: GUM(2[1],1[12])
## Persistence vector g:
## [,1] [,2] [,3]
## [1,] 0.1389 0.5781 0.8607
## Transition matrix F:
## [,1] [,2] [,3]
## [1,] 0.9190 0.1682 0.0001
## [2,] 0.0015 0.6354 0.0212
## [3,] 0.5481 0.9939 0.9999
## Measurement vector w: 1, 1, 1
## Initial values were optimised.
##
## Loss function type: likelihood; Loss function value: 462.7833
## Error standard deviation: 10.7459
## 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
## 979.5666 994.9952 1056.1463 1093.4547
##
## Forecast errors:
## MPE: 0.6%; sCE: 27%; Asymmetry: 40.8%; MAPE: 2.5%
## MASE: 0.521; sMAE: 4.7%; sMSE: 0.4%; rMAE: 0.188; rRMSE: 0.216
Function auto.gum()
is now implemented in
smooth
, but it works slowly as it needs to check a large
number of models:
## 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: 12.54 seconds
## Model estimated: GUM(2[1],2[12])
## Persistence vector g:
## [,1] [,2] [,3] [,4]
## [1,] -0.1415 0.6703 -0.0281 0.8222
## Transition matrix F:
## [,1] [,2] [,3] [,4]
## [1,] 0.0905 0.9642 0.0001 0.0021
## [2,] 0.4753 0.3107 0.0004 0.0001
## [3,] 0.1894 0.4591 0.0008 0.9844
## [4,] 0.9971 0.2650 0.7327 0.4419
## Measurement vector w: 1, 1, 1, 1
## Initial values were produced using backcasting.
##
## Loss function type: likelihood; Loss function value: 532.0226
## Error standard deviation: 10.5326
## 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
## 1106.045 1113.619 1168.411 1187.231
##
## 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.17 seconds
## Model estimated: GUM(2[1],1[12])
## Persistence vector g:
## [,1] [,2] [,3]
## [1,] 0.3398 0.015 0.8662
## 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: 486.0269
## Error standard deviation: 12.3727
## 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
## 1008.054 1014.446 1059.107 1074.565
##
## Forecast errors:
## MPE: 5.4%; sCE: 184.2%; Asymmetry: 93.8%; MAPE: 5.9%
## MASE: 1.237; sMAE: 11.1%; sMSE: 1.4%; rMAE: 0.446; rRMSE: 0.403
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.