This vignette coversces() andauto.ces()functions, which are part ofsmoothpackage.
Let’s load the necessary packages:
ces() function allows constructing Complex ExponentialSmoothing either with no seasonality, or with simple/partial/full one. Asimple call forces() results in estimation of non-seasonalmodel:
For the same series from M3 datasetces() can beconstructed 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: 250.0863## a0+ia1 ## 1.9975+1.0033i## ## Sample size: 138## Number of estimated parameters: 3## Number of degrees of freedom: 135## Information criteria:## AIC AICc BIC BICc ## 506.1726 506.3517 514.9544 515.3956 ## ## Forecast errors:## ME: 0.184; MAE: 1.014; RMSE: 1.319## sCE: 0.973%; Asymmetry: 5.6%; sMAE: 0.446%; sMSE: 0.003%## MASE: 0.851; RMSSE: 0.86; rMAE: 0.327; rRMSE: 0.344This output is very similar to ones printed out byadam() function. The only difference is complex smoothingparameter values which are printed out instead of persistence vector inadam().
If we want automatic model selection, then we useauto.ces() function:
## Estimating CES with seasonality: "none" "simple" "partial" "full" ## The best model is with seasonality = "partial"## Time elapsed: 0.13 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.9014## a0+ia1 ## 1.49+1i## b ## 0.9485 ## ## Sample size: 132## Number of estimated parameters: 4## Number of degrees of freedom: 128## Information criteria:## AIC AICc BIC BICc ## 1041.803 1042.118 1053.334 1054.103 ## ## Forecast errors:## ME: 10.817; MAE: 18.844; RMSE: 22.061## sCE: 49.452%; Asymmetry: 66.7%; sMAE: 7.179%; sMSE: 0.706%## MASE: 0.782; RMSSE: 0.704; rMAE: 0.248; rRMSE: 0.214By default, the function optimises the initial values, but otheroptions (“backcasting” and “complete”) are supported as well:
## 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: 250.0863## a0+ia1 ## 1.9975+1.0033i## ## Sample size: 138## Number of estimated parameters: 3## Number of degrees of freedom: 135## Information criteria:## AIC AICc BIC BICc ## 506.1726 506.3517 514.9544 515.3956 ## ## Forecast errors:## ME: 0.184; MAE: 1.014; RMSE: 1.319## sCE: 0.973%; Asymmetry: 5.6%; sMAE: 0.446%; sMSE: 0.003%## MASE: 0.851; RMSSE: 0.86; rMAE: 0.327; rRMSE: 0.344The function also works with explanatory variables if the data frameor a matrix is provided instead of the vector of values:
Finally, all the main methods for theadamfunction are supported byces() as well. For example, herehow we can produce prediction interval: