ces() - Complex Exponential Smoothing

Ivan Svetunkov

2020-06-16

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.39 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: 1419.223
## 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.37 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: 1352.622
## 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.52 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: 1430.254
## 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: 1.19 seconds
## Model estimated: CESX(f)
## a0 + ia1: 1.1193+1.0056i
## b0 + ib1: 1.008+0.9997i
## Initial values were produced using backcasting.
## Xreg coefficients were estimated in a normal style
## 
## Loss function type: MSE; Loss function value: 1678608.1396
## Error standard deviation: 1337.642
## Sample size: 97
## Number of estimated parameters: 6
## Number of degrees of freedom: 91
## Information criteria:
##      AIC     AICc      BIC     BICc 
## 1677.621 1678.554 1693.070 1695.204 
## 
## 95% parametric prediction interval was constructed
## 50% of values are in the prediction interval
## Forecast errors:
## MPE: 18.3%; sCE: 1559.4%; Bias: 83.1%; MAPE: 35.4%
## MASE: 2.548; sMAE: 104%; sMSE: 192.2%; rMAE: 1.089; rRMSE: 1.216

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.23 seconds
## Model estimated: CESX(s)
## a0 + ia1: 1.1091+1.0181i
## Initial values were produced using backcasting.
## Xreg coefficients were estimated in a crazy style
## 
## Loss function type: MSE; Loss function value: 1800489.5221
## Error standard deviation: 1425.056
## Sample size: 97
## Number of estimated parameters: 11
## Number of degrees of freedom: 86
## Information criteria:
##      AIC     AICc      BIC     BICc 
## 1694.420 1697.526 1722.742 1729.846 
## 
## 95% parametric prediction interval was constructed
## 50% of values are in the prediction interval
## Forecast errors:
## MPE: 28.5%; sCE: 1940.8%; Bias: 89.3%; MAPE: 39.3%
## MASE: 2.91; sMAE: 118.7%; sMSE: 233.8%; rMAE: 1.243; rRMSE: 1.341