ces() - Complex Exponential Smoothing

Ivan Svetunkov

2019-08-19

This vignette covers ces() and auto.ces() functions, which are 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)

ces() function allows constructing Complex Exponential Smoothing either with no seasonality, or with simple / partial / full seasonality. A simple call for ces() results in estimation of non-seasonal model:

For the same series from M3 dataset ces() can be constructed using:

ces(M3$N2457$x, h=18, holdout=TRUE, silent=FALSE)
## Time elapsed: 0.3 seconds
## Model estimated: CES(n)
## a0 + ia1: 1.1085+1.0114i
## Initial values were produced using backcasting.
## 
## Loss function type: MSE; Loss function value: 1951898.9225
## Error standard deviation: 1397.104
## Sample size: 97
## Number of estimated parameters: 3
## Number of degrees of freedom: 94
## Information criteria:
##      AIC     AICc      BIC     BICc 
## 1686.253 1686.511 1693.977 1694.567 
## 
## Forecast errors:
## MPE: 15.7%; sCE: -1522.5%; Bias: 76.3%; MAPE: 37.3%
## MASE: 2.635; sMAE: 107.5%; sMSE: 204.4%; rMAE: 1.126; rRMSE: 1.254

This output is very similar to ones printed out by es() function. The only difference is complex smoothing parameter values which are printed out instead of persistence vector in es().

If we want automatic model selection, then we use auto.ces() function:

auto.ces(M3$N2457$x, h=18, holdout=TRUE, interval="p", silent=FALSE)
## Estimating CES with seasonality: "n" "s" "f"  
## The best model is with seasonality = "f"
## Time elapsed: 0.28 seconds
## Model estimated: CES(f)
## a0 + ia1: 1.1276+1.0135i
## b0 + ib1: 0.9943+1.0005i
## Initial values were produced using backcasting.
## 
## Loss function type: MSE; Loss function value: 1735277.1936
## Error standard deviation: 1317.299
## Sample size: 97
## Number of estimated parameters: 5
## Number of degrees of freedom: 92
## Information criteria:
##      AIC     AICc      BIC     BICc 
## 1678.842 1679.501 1691.715 1693.224 
## 
## 95% parametric prediction interval was constructed
## 61% of values are in the prediction interval
## Forecast errors:
## MPE: 9.9%; sCE: -1235.6%; Bias: 66.5%; MAPE: 33.7%
## MASE: 2.327; sMAE: 94.9%; sMSE: 167.3%; rMAE: 0.994; rRMSE: 1.135

Note that prediction interval are too narrow and do not include 95% of values. This is because CES is pure additive model and it cannot take into account possible heteroscedasticity.

If for some reason we want to optimise initial values then we call:

auto.ces(M3$N2457$x, h=18, holdout=TRUE, initial="o", interval="sp")
## Time elapsed: 0.74 seconds
## Model estimated: CES(n)
## a0 + ia1: 1.0984+1.0122i
## Initial values were optimised.
## 
## Loss function type: MSE; Loss function value: 1940181.3813
## Error standard deviation: 1392.904
## Sample size: 97
## Number of estimated parameters: 5
## Number of degrees of freedom: 92
## Information criteria:
##      AIC     AICc      BIC     BICc 
## 1689.668 1690.328 1702.542 1704.050 
## 
## 95% semiparametric prediction interval was constructed
## 39% of values are in the prediction interval
## Forecast errors:
## MPE: 15.2%; sCE: -1502.3%; Bias: 75.7%; MAPE: 37.3%
## MASE: 2.622; sMAE: 107%; sMSE: 202.9%; rMAE: 1.12; rRMSE: 1.25

Now let’s introduce some artificial exogenous variables:

x <- cbind(rnorm(length(M3$N2457$x),50,3),rnorm(length(M3$N2457$x),100,7))

ces() allows using exogenous variables and different types of prediction interval in exactly the same manner as es():

auto.ces(M3$N2457$x, h=18, holdout=TRUE, xreg=x, xregDo="select", interval="p")
## Time elapsed: 0.53 seconds
## Model estimated: CES(f)
## a0 + ia1: 1.1276+1.0135i
## b0 + ib1: 0.9943+1.0005i
## Initial values were produced using backcasting.
## 
## Loss function type: MSE; Loss function value: 1735277.1936
## Error standard deviation: 1320.498
## Sample size: 97
## Number of estimated parameters: 5
## Number of degrees of freedom: 92
## Information criteria:
##      AIC     AICc      BIC     BICc 
## 1678.842 1679.501 1691.715 1693.224 
## 
## 95% parametric prediction interval was constructed
## 61% of values are in the prediction interval
## Forecast errors:
## MPE: 9.9%; sCE: -1232.7%; Bias: 66.4%; MAPE: 33.7%
## MASE: 2.325; sMAE: 94.8%; sMSE: 166.8%; rMAE: 0.993; rRMSE: 1.133

The same model but with updated parameters of exogenous variables is called:

auto.ces(M3$N2457$x, h=18, holdout=TRUE, xreg=x, updateX=TRUE, interval="p")
## Time elapsed: 3.61 seconds
## Model estimated: CESX(s)
## a0 + ia1: 1.0409+1.0354i
## Initial values were produced using backcasting.
## Xreg coefficients were estimated in a crazy style
## 
## Loss function type: MSE; Loss function value: 1627250.583
## Error standard deviation: 1275.637
## Sample size: 97
## Number of estimated parameters: 11
## Number of degrees of freedom: 86
## Information criteria:
##      AIC     AICc      BIC     BICc 
## 1684.607 1687.713 1712.929 1720.033 
## 
## 95% parametric prediction interval was constructed
## 44% of values are in the prediction interval
## Forecast errors:
## MPE: 21%; sCE: -1666.5%; Bias: 84.5%; MAPE: 36%
## MASE: 2.644; sMAE: 107.9%; sMSE: 208.3%; rMAE: 1.129; rRMSE: 1.266