knitr::opts_chunk$set(fig.width=6, fig.height=4, fig.path='Figs/', fig.show='hold', warning=FALSE, message=FALSE)
gum()
constructs Generalised Exponential Smoothing - pure additive state-space model. It is a part of smooth package.
Let's load the necessary packages:
require(smooth)
Generalised Exponential Smoothing is a next step from CES. It is a state-space model in which all the matrices and vectors are estimated. It is very demanding in sample size, but is also insanely flexible.
A simple call by default constructs GUM$(1^1,1^m)$, where $m$ is frequency of the data. So for our example with AirPassengers
data, we will have GUM$(1^1,1^{12})$:
gum(AirPassengers, h=18, holdout=TRUE)
But some different orders and lags can be specified. For example:
gum(AirPassengers, h=18, holdout=TRUE, orders=c(2,1), lags=c(1,12))
Function auto.gum()
is now implemented in smooth
, but it works slowly as it needs to check a large number of models:
auto.gum(AirPassengers, interval=TRUE, silent=FALSE)
In addition to standard values that other functions accept, GUM accepts predefined values for transition matrix, measurement and persistence vectors. For example, something more common can be passed to the function:
transition <- matrix(c(1,0,0,1,1,0,0,0,1),3,3) measurement <- c(1,1,1) gum(AirPassengers, h=18, holdout=TRUE, orders=c(2,1), lags=c(1,12), transition=transition, measurement=measurement)
The resulting model will be equivalent to ETS(A,A,A). However due to different initialisation of optimisers and different method of number of parameters calculation, gum()
above and es(y, "AAA", h=h, holdout=TRUE)
will lead to different models.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.