This vignette covers ces() and
auto.ces() functions, which are part of smooth package.
Let’s load the necessary packages:
ces() function allows constructing Complex Exponential
Smoothing either with no seasonality, or with simple/partial/full one. A
simple call for ces() results in estimation of non-seasonal
model:
For the same series from M3 dataset ces() can be
constructed using:
## Time elapsed: 0.03 seconds
## Model estimated using ces() function: CES(none)
## With backcasting initialisation
## Distribution assumed in the model: Normal
## Loss function type: likelihood; Loss function value: 249.4603
## a0+ia1
## 1.9983+1.0034i
##
## Sample size: 138
## Number of estimated parameters: 5
## Number of degrees of freedom: 133
## Information criteria:
## AIC AICc BIC BICc
## 508.9205 509.3751 523.5568 524.6766
##
## Forecast errors:
## ME: 0.139; MAE: 1.02; RMSE: 1.296
## sCE: 0.735%; Asymmetry: -5%; sMAE: 0.449%; sMSE: 0.003%
## MASE: 0.857; RMSSE: 0.845; rMAE: 0.329; rRMSE: 0.338
This output is very similar to ones printed out by
adam() function. The only difference is complex smoothing
parameter values which are printed out instead of persistence vector in
adam().
If we want automatic model selection, then we use
auto.ces() function:
## Estimating CES with seasonality: "none" "simple" "partial" "full"
## The best model is with seasonality = "full"
## Time elapsed: 0.12 seconds
## Model estimated using ces() function: CES(full)
## With backcasting initialisation
## Distribution assumed in the model: Normal
## Loss function type: likelihood; Loss function value: 491.4821
## a0+ia1
## 1.397+1.0106i
## b0+ib1
## 1.8473+1.1258i
##
## Sample size: 132
## Number of estimated parameters: 31
## Number of degrees of freedom: 101
## Information criteria:
## AIC AICc BIC BICc
## 1044.964 1064.804 1134.331 1182.768
##
## Forecast errors:
## ME: -13.237; MAE: 15.175; RMSE: 19.239
## sCE: -60.514%; Asymmetry: -86%; sMAE: 5.781%; sMSE: 0.537%
## MASE: 0.63; RMSSE: 0.614; rMAE: 0.2; rRMSE: 0.187
By default, the function optimises the initial values, but other options (“backcasting” and “complete”) are supported as well:
## Time elapsed: 0.02 seconds
## Model estimated using ces() function: CES(none)
## With backcasting initialisation
## Distribution assumed in the model: Normal
## Loss function type: likelihood; Loss function value: 249.4603
## a0+ia1
## 1.9983+1.0034i
##
## Sample size: 138
## Number of estimated parameters: 5
## Number of degrees of freedom: 133
## Information criteria:
## AIC AICc BIC BICc
## 508.9205 509.3751 523.5568 524.6766
##
## Forecast errors:
## ME: 0.139; MAE: 1.02; RMSE: 1.296
## sCE: 0.735%; Asymmetry: -5%; sMAE: 0.449%; sMSE: 0.003%
## MASE: 0.857; RMSSE: 0.845; rMAE: 0.329; rRMSE: 0.338
The function also works with explanatory variables if the data frame or a matrix is provided instead of the vector of values:
BJData <- cbind(y=BJsales, x=BJsales.lead)
cesModel <- ces(BJData, h=12, holdout=TRUE, regressors="use")Finally, all the main methods for the adam
function are supported by ces() as well. For example, here
how we can produce prediction interval: