ces() - Complex Exponential Smoothing

Ivan Svetunkov

2018-11-30

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.37 seconds
## Model estimated: CES(n)
## a0 + ia1: 1.09841+1.01221i
## Initial values were optimised.
## 5 parameters were estimated in the process
## Residuals standard deviation: 1430.254
## Cost function type: MSE; Cost function value: 1940181.381
## 
## Information criteria:
##      AIC     AICc      BIC     BICc 
## 1689.668 1690.328 1702.542 1704.050 
## Forecast errors:
## MPE: 15.2%; sCE: -1502.3%; Bias: 75.7%; MAPE: 37.3%
## MASE: 2.622; sMAE: 107%; RelMAE: 1.12; sMSE: 202.9%

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, intervals="p", silent=FALSE)
## Estimating CES with seasonality: "n" "s" "f"  
## The best model is with seasonality = "n"
## Time elapsed: 1.2 seconds
## Model estimated: CES(n)
## a0 + ia1: 1.09841+1.01221i
## Initial values were optimised.
## 5 parameters were estimated in the process
## Residuals standard deviation: 1430.254
## Cost function type: MSE; Cost function value: 1940181.381
## 
## Information criteria:
##      AIC     AICc      BIC     BICc 
## 1689.668 1690.328 1702.542 1704.050 
## 95% parametric prediction intervals were constructed
## 61% 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%; RelMAE: 1.12; sMSE: 202.9%

Note that prediction intervals 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", intervals="sp")
## Time elapsed: 0.42 seconds
## Model estimated: CES(n)
## a0 + ia1: 1.09841+1.01221i
## Initial values were optimised.
## 5 parameters were estimated in the process
## Residuals standard deviation: 1430.254
## Cost function type: MSE; Cost function value: 1940181.381
## 
## Information criteria:
##      AIC     AICc      BIC     BICc 
## 1689.668 1690.328 1702.542 1704.050 
## 95% semiparametric prediction intervals were 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%; RelMAE: 1.12; sMSE: 202.9%

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 intervals in exactly the same manner as es():

auto.ces(M3$N2457$x, h=18, holdout=TRUE, xreg=x, xregDo="select", intervals="p")
## Time elapsed: 1.22 seconds
## Model estimated: CESX(n)
## a0 + ia1: 1.1239+1.00378i
## Initial values were optimised.
## 7 parameters were estimated in the process
## Residuals standard deviation: 1385.639
## Xreg coefficients were estimated in a normal style
## Cost function type: MSE; Cost function value: 1781439.747
## 
## Information criteria:
##      AIC     AICc      BIC     BICc 
## 1685.389 1686.647 1703.411 1706.290 
## 95% parametric prediction intervals were constructed
## 56% of values are in the prediction interval
## Forecast errors:
## MPE: 14.9%; sCE: -1447%; Bias: 72.3%; MAPE: 34.8%
## MASE: 2.493; sMAE: 101.7%; RelMAE: 1.065; sMSE: 189.2%

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, intervals="p")
## Time elapsed: 1.62 seconds
## Model estimated: CESX(n)
## a0 + ia1: 0.99999+1.00245i
## Initial values were optimised.
## 13 parameters were estimated in the process
## Residuals standard deviation: 1421.01
## Xreg coefficients were estimated in a crazy style
## Cost function type: MSE; Cost function value: 1748644.747
## 
## Information criteria:
##      AIC     AICc      BIC     BICc 
## 1695.586 1699.972 1729.057 1739.089 
## 95% parametric prediction intervals were constructed
## 50% of values are in the prediction interval
## Forecast errors:
## MPE: 26.1%; sCE: -1881.8%; Bias: 88.1%; MAPE: 38.7%
## MASE: 2.873; sMAE: 117.2%; RelMAE: 1.227; sMSE: 233.7%