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.04 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.4688
## a0 + ia1: 2.0004+1.0035i
##
## Sample size: 138
## Number of estimated parameters: 3
## Number of degrees of freedom: 135
## Information criteria:
## AIC AICc BIC BICc
## 504.9376 505.1167 513.7194 514.1606
##
## Forecast errors:
## ME: 0.072; MAE: 1.037; RMSE: 1.276
## sCE: 0.378%; Asymmetry: -12.5%; sMAE: 0.456%; sMSE: 0.003%
## MASE: 0.87; RMSSE: 0.832; rMAE: 0.334; rRMSE: 0.333
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 = "partial"
## Time elapsed: 0.15 seconds
## Model estimated using ces() function: CES(partial)
## With backcasting initialisation
## Distribution assumed in the model: Normal
## Loss function type: likelihood; Loss function value: 516.9044
## a0 + ia1: 1.4921+1i
## b: 0.942
##
## Sample size: 132
## Number of estimated parameters: 4
## Number of degrees of freedom: 128
## Information criteria:
## AIC AICc BIC BICc
## 1041.809 1042.124 1053.340 1054.109
##
## Forecast errors:
## ME: 10.722; MAE: 18.804; RMSE: 22.028
## sCE: 49.015%; Asymmetry: 66.5%; sMAE: 7.163%; sMSE: 0.704%
## MASE: 0.781; RMSSE: 0.703; rMAE: 0.247; rRMSE: 0.214
By default, the function optimises the initial values, but other options (“backcasting” and “complete”) are supported as well:
## Time elapsed: 0.04 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.4688
## a0 + ia1: 2.0004+1.0035i
##
## Sample size: 138
## Number of estimated parameters: 3
## Number of degrees of freedom: 135
## Information criteria:
## AIC AICc BIC BICc
## 504.9376 505.1167 513.7194 514.1606
##
## Forecast errors:
## ME: 0.072; MAE: 1.037; RMSE: 1.276
## sCE: 0.378%; Asymmetry: -12.5%; sMAE: 0.456%; sMSE: 0.003%
## MASE: 0.87; RMSSE: 0.832; rMAE: 0.334; rRMSE: 0.333
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: