This vignette covers vets()
function, which is a part of
legion package. In this vignette we will use
data from Mcomp
package, so it is advised to install
it.
Let’s load the necessary packages:
require(legion)
We will use to time series from the M3 united in a vector:
<- ts(cbind(1000+0.5*c(1:100)+rnorm(100,0,10),
Y cbind(1000+1.5*c(1:100)+rnorm(100,0,10))),
frequency=12);
vets()
function implements Vector ETS from Svetunkov, Chen, and Boylan (2021). This is a
model that introduces two dimensional taxonomy: the original ETS one
from Hyndman et al. (2008) and the
extended for the restrictions on Parameters, Initials and Components
(PIC) of the model. By default the function makes smoothing and
dampening parameters common between different products and forces a
common seasonal initials, resulting in ETS-PIC(LTSD,S,N):
<- vets(Y, "MMdM", h=18, holdout=TRUE, silent=FALSE) vetsModel
The output tells us how much time the estimation took, what model was
estimated, the loss function type used and its value, general
information about sample size, number of parameters, number of variates
and degrees of freedom and finally the information criteria for the
model. Using the latter, it is possible to select the most appropriate
ETS model and PIC restrictions. However, this process might take a lot
of time, so there is also auto.vets()
function that does a
stepwise selection of components and restrictions:
<- auto.vets(Y, "PPP", h=18, holdout=TRUE, silent=FALSE) vetsModel
## Selecting the best unrestricted model...
## Initial model is VETS(MMN), AICc is: 1241.942
## Testing initials restrictions... 100 %
## Initials restrictions model is (none), AICc is: 1241.942
## Testing parameters restrictions... 14 %29 %43 %57 %71 %86 %100 %
## Parameters restrictions model is (t), AICc is: 1230.377
## Testing components restrictions... 100 %
## Components restrictions model is (none), AICc is: 1230.377
model="PPP"
tells function to select the best between
pure additive and pure multiplicative models. This parameter also
accepts model="XXX"
, selecting between pure additive and
model="YYY"
, selecting between pure multiplicative models.
Note that if you want to impose restrictions on the initials and
components, then pure multiplicative models typically make more sense,
aligning with the idea of percentage change of value, rather than the
change in the units of data (as in additive models).
Some methods to consider when working with vets()
:
<- par(mfcol=c(2,1))
oldpar plot(vetsModel,1)
plot(vetsModel,7)
par(oldpar)
modelType(vetsModel)
## [1] "MMN"
modelType(vetsModel,pic=TRUE)
## [1] "T,N,N"
actuals(vetsModel)
fitted(vetsModel)
residuals(vetsModel)
The forecasts can be produced using forecast()
method:
<- forecast(vetsModel, h=18, interval="prediction")
vetsForecast <- par(mfcol=c(2,1))
oldpar plot(vetsForecast)
par(oldpar)
The detailed explanation of the underlying model and possible restrictions are provided in Svetunkov, Chen, and Boylan (2021).