This vignette covers `ces()`

and `auto.ces()`

functions, which are part of smooth package. In this vignette we will use data from `Mcomp`

package, so it is adviced to install it.

Letâ€™s load the necessary packages:

```
require(smooth)
require(Mcomp)
```

`ces()`

function allows constructing Complex Exponential Smoothing either with no seasonality, or with simple / partial / full seasonality. 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(M3$N2457$x, h=18, holdout=TRUE)`

```
## Time elapsed: 0.1 seconds
## Model estimated: CES(n)
## a0 + ia1: 1.10852+1.01143i
## Initial values were produced using backcasting.
## 3 parameters were estimated in the process
## Residuals standard deviation: 1419.223
## Cost function type: MSE; Cost function value: 1951899
##
## Information criteria:
## AIC AICc BIC
## 1686.252 1686.511 1693.977
## Forecast errors:
## MPE: 15.7%; Bias: 76.3%; MAPE: 37.3%; SMAPE: 42.7%
## MASE: 2.635; sMAE: 107.5%; RelMAE: 1.126; sMSE: 204.4%
```

This output is very similar to ones printed out by `es()`

function. The only difference is complex smoothing parameter values which are printed out instead of persistence vector in `es()`

.

If we want automatic model selection, then we use `auto.ces()`

function:

`auto.ces(M3$N2457$x, h=18, holdout=TRUE, intervals="p")`

```
## Estimating CES with seasonality: "none" "simple" "full"
## The best model is with seasonality = "none"
```

```
## Time elapsed: 0.53 seconds
## Model estimated: CES(n)
## a0 + ia1: 1.10852+1.01143i
## Initial values were produced using backcasting.
## 3 parameters were estimated in the process
## Residuals standard deviation: 1419.223
## Cost function type: MSE; Cost function value: 1951899
##
## Information criteria:
## AIC AICc BIC
## 1686.252 1686.511 1693.977
## 95% parametric prediction intervals were constructed
## 56% of values are in the prediction interval
## Forecast errors:
## MPE: 15.7%; Bias: 76.3%; MAPE: 37.3%; SMAPE: 42.7%
## MASE: 2.635; sMAE: 107.5%; RelMAE: 1.126; sMSE: 204.4%
```

Note that prediction intervals are too narrow and do not include 95% of values. This is because CES is pure additive model and it cannot take into account possible heteroscedasticity.

If for some reason we want to optimise initial values then we call:

`auto.ces(M3$N2457$x, h=18, holdout=TRUE, initial="o", intervals="sp")`

```
## Estimating CES with seasonality: "none" "simple" "full"
## The best model is with seasonality = "none"
```

```
## Time elapsed: 0.79 seconds
## Model estimated: CES(n)
## a0 + ia1: 1.09841+1.01221i
## Initial values were optimised.
## 5 parameters were estimated in the process
## Residuals standard deviation: 1430.254
## Cost function type: MSE; Cost function value: 1940181
##
## Information criteria:
## AIC AICc BIC
## 1689.668 1690.328 1702.542
## 95% parametric prediction intervals were constructed
## 61% of values are in the prediction interval
## Forecast errors:
## MPE: 15.2%; Bias: 75.7%; MAPE: 37.3%; SMAPE: 42.5%
## MASE: 2.622; sMAE: 107%; RelMAE: 1.12; sMSE: 202.9%
```

Now letâ€™s introduce some artificial exogenous variables:

`x <- cbind(rnorm(length(M3$N2457$x),50,3),rnorm(length(M3$N2457$x),100,7))`

`ces()`

allows using exogenous variables and different types of prediction intervals in exactly the same manner as `es()`

:

`auto.ces(M3$N2457$x, h=18, holdout=TRUE, xreg=x, xregDo="select", intervals="p")`

```
## Estimating CES with seasonality: "none" "simple" "full"
## The best model is with seasonality = "none"
```

```
## Time elapsed: 0.45 seconds
## Model estimated: CES(n)
## a0 + ia1: 1.10852+1.01143i
## Initial values were produced using backcasting.
## 4 parameters were estimated in the process
## Residuals standard deviation: 1426.833
## Cost function type: MSE; Cost function value: 1951899
##
## Information criteria:
## AIC AICc BIC
## 1688.252 1688.687 1698.551
## 95% parametric prediction intervals were constructed
## 61% of values are in the prediction interval
## Forecast errors:
## MPE: 15.7%; Bias: 76.3%; MAPE: 37.3%; SMAPE: 42.7%
## MASE: 2.635; sMAE: 107.5%; RelMAE: 1.126; sMSE: 204.4%
```

The same model but with updated parameters of exogenous variables is called:

`auto.ces(M3$N2457$x, h=18, holdout=TRUE, xreg=x, updateX=TRUE, intervals="p")`

```
## Estimating CES with seasonality: "none" "simple" "full"
## The best model is with seasonality = "none"
```

```
## Time elapsed: 0.92 seconds
## Model estimated: CESX(n)
## a0 + ia1: 0.99823+0.95797i
## Initial values were produced using backcasting.
## 11 parameters were estimated in the process
## Residuals standard deviation: 1413.443
## Xreg coefficients were estimated in a crazy style
## Cost function type: MSE; Cost function value: 1771263
##
## Information criteria:
## AIC AICc BIC
## 1692.833 1695.939 1721.155
## 95% parametric prediction intervals were constructed
## 50% of values are in the prediction interval
## Forecast errors:
## MPE: 26.6%; Bias: 85.1%; MAPE: 42.3%; SMAPE: 52.3%
## MASE: 3.062; sMAE: 124.9%; RelMAE: 1.308; sMSE: 253.3%
```