ces() - Complex Exponential Smoothing

Ivan Svetunkov

2018-03-04

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.56 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 
## 1689.668 1690.328 1702.542 
## 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.71 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 
## 1689.668 1690.328 1702.542 
## 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.67 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 
## 1689.668 1690.328 1702.542 
## 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%

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.82 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: 1438.091
## Cost function type: MSE; Cost function value: 1940181.381
## 
## Information criteria:
##      AIC     AICc      BIC 
## 1691.668 1692.602 1707.117 
## 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%

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: 2.55 seconds
## Model estimated: CESX(n)
## a0 + ia1: 1.17088+0.96823i
## Initial values were optimised.
## 13 parameters were estimated in the process
## Residuals standard deviation: 1447.753
## Xreg coefficients were estimated in a crazy style
## Cost function type: MSE; Cost function value: 1815082.252
## 
## Information criteria:
##      AIC     AICc      BIC 
## 1699.203 1703.589 1732.675 
## 95% parametric prediction intervals were constructed
## 61% of values are in the prediction interval
## Forecast errors:
## MPE: -4.5%; sCE: -775.5%; Bias: 33.5%; MAPE: 42.7%
## MASE: 2.519; sMAE: 102.8%; RelMAE: 1.076; sMSE: 163.9%