knitr::opts_chunk$set(fig.width=6, fig.height=4, fig.path='Figs/', fig.show='hold', warning=FALSE, message=FALSE)
This vignette covers ces()
and auto.ces()
functions, which are part of smooth package.
Let's load the necessary packages:
require(smooth)
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:
ces(BJsales, h=12, holdout=TRUE, silent=FALSE)
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:
auto.ces(AirPassengers, h=12, holdout=TRUE, silent=FALSE)
By default, the function optimises the initial values, but other options ("backcasting" and "complete") are supported as well:
ces(BJsales, h=12, holdout=TRUE, initial="back")
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:
forecast(cesModel, h=12, interval="pred") |> plot()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.