`gum()`

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

In this vignette we will use data from `Mcomp`

package, so it is advised to install it.

Let’s load the necessary packages:

```
require(smooth)
require(Mcomp)
```

You may note that `Mcomp`

depends on `forecast`

package and if you load both `forecast`

and `smooth`

, then you will have a message that `forecast()`

function is masked from the environment. There is nothing to be worried about - `smooth`

uses this function for consistency purposes and has exactly the same original `forecast()`

as in the `forecast`

package. The inclusion of this function in `smooth`

was done only in order not to include `forecast`

in dependencies of the package.

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 monthly data N2457, we will have GUM\((1^1,1^{12})\):

`gum(M3$N2457$x, h=18, holdout=TRUE)`

```
## Time elapsed: 0.19 seconds
## Model estimated: GUM(1[1],1[12])
## Persistence vector g:
## [,1] [,2]
## [1,] 0.1584 -0.0473
## Transition matrix F:
## [,1] [,2]
## [1,] 0.9609 0.4737
## [2,] 0.0328 0.7935
## Measurement vector w: 0.6417, 0.2657
## Initial values were optimised.
##
## Loss function type: likelihood; Loss function value: 836.2696
## Error standard deviation: 1526.922
## Sample size: 97
## Number of estimated parameters: 22
## Number of degrees of freedom: 75
## Information criteria:
## AIC AICc BIC BICc
## 1716.539 1730.215 1773.183 1804.464
##
## Forecast errors:
## MPE: 19%; sCE: 1637.4%; Asymmetry: 81%; MAPE: 37.6%
## MASE: 2.706; sMAE: 110.4%; sMSE: 212.5%; rMAE: 1.156; rRMSE: 1.279
```

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

`gum(M3$N2457$x, h=18, holdout=TRUE, orders=c(2,1), lags=c(1,12))`

```
## Time elapsed: 0.25 seconds
## Model estimated: GUM(2[1],1[12])
## Persistence vector g:
## [,1] [,2] [,3]
## [1,] 0.1509 -0.0496 0.0417
## Transition matrix F:
## [,1] [,2] [,3]
## [1,] 0.5591 0.2934 0.1547
## [2,] 0.3080 0.6797 0.0010
## [3,] 0.1020 0.0005 1.0000
## Measurement vector w: 0.8576, 0.6724, 0.2583
## Initial values were optimised.
##
## Loss function type: likelihood; Loss function value: 831.5294
## Error standard deviation: 1538.463
## Sample size: 97
## Number of estimated parameters: 30
## Number of degrees of freedom: 67
## Information criteria:
## AIC AICc BIC BICc
## 1723.059 1751.241 1800.300 1864.762
##
## Forecast errors:
## MPE: 23.9%; sCE: 1782.2%; Asymmetry: 87.2%; MAPE: 38.2%
## MASE: 2.778; sMAE: 113.3%; sMSE: 216.8%; rMAE: 1.186; rRMSE: 1.292
```

Function `auto.gum()`

is now implemented in `smooth`

, but it works slowly as it needs to check a large number of models:

`auto.gum(M3[[2457]], 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: 11.64 seconds
## Model estimated: GUM(1[1],1[4])
## Persistence vector g:
## [,1] [,2]
## [1,] 0.503 0.2967
## Transition matrix F:
## [,1] [,2]
## [1,] 0.4174 0.467
## [2,] 0.0670 1.000
## Measurement vector w: 0.8893, 0.9905
## Initial values were produced using backcasting.
##
## Loss function type: likelihood; Loss function value: 1026.825
## Error standard deviation: 1902.114
## Sample size: 115
## Number of estimated parameters: 9
## Number of degrees of freedom: 106
## Information criteria:
## AIC AICc BIC BICc
## 2071.650 2073.364 2096.354 2100.422
##
## 95% parametric prediction interval was constructed
## 44% of values are in the prediction interval
## Forecast errors:
## MPE: -175.7%; sCE: -2148.6%; Asymmetry: -89.7%; MAPE: 181.5%
## MASE: 3.224; sMAE: 132.2%; sMSE: 237.6%; rMAE: 2.682; rRMSE: 2.276
```

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:

```
<- matrix(c(1,0,0,1,1,0,0,0,1),3,3)
transition <- c(1,1,1)
measurement gum(M3$N2457$x, h=18, holdout=TRUE, orders=c(2,1), lags=c(1,12), transition=transition, measurement=measurement)
```

```
## Time elapsed: 0.13 seconds
## Model estimated: GUM(2[1],1[12])
## Persistence vector g:
## [,1] [,2] [,3]
## [1,] 0.2028 0.0045 -0.0455
## 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: 837.864
## Error standard deviation: 1512.42
## Sample size: 97
## Number of estimated parameters: 18
## Number of provided parameters: 12
## Number of degrees of freedom: 79
## Information criteria:
## AIC AICc BIC BICc
## 1711.728 1720.497 1758.073 1778.131
##
## Forecast errors:
## MPE: 14.2%; sCE: 1437.8%; Asymmetry: 72.7%; MAPE: 36.1%
## MASE: 2.543; sMAE: 103.8%; sMSE: 194.3%; rMAE: 1.086; rRMSE: 1.223
```

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.