--- title: "ces() - Complex Exponential Smoothing" author: "Ivan Svetunkov" date: "`r Sys.Date()`" output: rmarkdown::html_vignette vignette: > %\VignetteIndexEntry{ces() - Complex Exponential Smoothing} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} --- ```{r global_options, include=FALSE} 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](smooth.html). Let's load the necessary packages: ```{r load_libraries, message=FALSE, warning=FALSE} 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: ```{r ces_N2457} 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: ```{r auto_ces_N2457} 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: ```{r auto_ces_N2457_optimal} 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: ```{r es_N2457_xreg_create} BJData <- cbind(y=BJsales, x=BJsales.lead) cesModel <- ces(BJData, h=12, holdout=TRUE, regressors="use") ``` Finally, all the main methods for the [adam](adam.html) function are supported by `ces()` as well. For example, here how we can produce prediction interval: ```{r} forecast(cesModel, h=12, interval="pred") |> plot() ```