Learn R Programming

smooth (version 2.5.5)

ves: Vector Exponential Smoothing in SSOE state space model

Description

Function constructs vector ETS model and returns forecast, fitted values, errors and matrix of states along with other useful variables.

Usage

ves(y, model = "ANN", persistence = c("common", "individual", "dependent",
  "seasonal-common"), transition = c("common", "individual", "dependent"),
  phi = c("common", "individual"), initial = c("individual", "common"),
  initialSeason = c("common", "individual"), seasonal = c("individual",
  "common"), weights = rep(1/ncol(y), ncol(y)), loss = c("likelihood",
  "diagonal", "trace"), ic = c("AICc", "AIC", "BIC", "BICc"), h = 10,
  holdout = FALSE, interval = c("none", "conditional", "unconditional",
  "individual", "likelihood"), level = 0.95, cumulative = FALSE,
  intermittent = c("none", "fixed", "logistic"), imodel = "ANN",
  iprobability = c("dependent", "independent"), bounds = c("admissible",
  "usual", "none"), silent = c("all", "graph", "output", "none"), ...)

Arguments

y

The matrix with the data, where series are in columns and observations are in rows.

model

The type of ETS model. Can consist of 3 or 4 chars: ANN, AAN, AAdN, AAA, AAdA, MMdM etc. ZZZ means that the model will be selected based on the chosen information criteria type. ATTENTION! ONLY PURE ADDITIVE AND PURE MULTIPLICATIVE MODELS ARE CURRENTLY AVAILABLE + NO MODEL SELECTION IS AVAILABLE AT THIS STAGE! Pure multiplicative models are done as additive model applied to log(data).

Also model can accept a previously estimated VES model and use all its parameters.

Keep in mind that model selection with "Z" components uses Branch and Bound algorithm and may skip some models that could have slightly smaller information criteria.

persistence

Persistence matrix \(G\), containing smoothing parameters. Can be:

  • "independent" - each series has its own smoothing parameters and no interactions are modelled (all the other values in the matrix are set to zero);

  • "dependent" - each series has its own smoothing parameters, but interactions between the series are modelled (the whole matrix is estimated);

  • "group" each series has the same smoothing parameters for respective components (the values of smoothing parameters are repeated, all the other values in the matrix are set to zero).

  • "seasonal" - each component has its own smoothing parameter, except for the seasonal one, which is common across the time series.

  • provided by user as a vector or as a matrix. The value is used by the model.

You can also use the first letter instead of writing the full word.

transition

Transition matrix \(F\). Can be:

  • "independent" - each series has its own preset transition matrix and no interactions are modelled (all the other values in the matrix are set to zero);

  • "dependent" - each series has its own transition matrix, but interactions between the series are modelled (the whole matrix is estimated). The estimated model behaves similar to VAR in this case;

  • "group" each series has the same transition matrix for respective components (the values are repeated, all the other values in the matrix are set to zero).

  • provided by user as a vector or as a matrix. The value is used by the model.

You can also use the first letter instead of writing the full word.

phi

In cases of damped trend this parameter defines whether the \(phi\) should be estimated separately for each series ("individual") or for the whole set ("common"). If vector or a value is provided here, then it is used by the model.

initial

Can be either character or a vector / matrix of initial states. If it is character, then it can be "individual", individual values of the initial non-seasonal components are used, or "common", meaning that the initials for all the time series are set to be equal to the same value. If vector of states is provided, then it is automatically transformed into a matrix, assuming that these values are provided for the whole group.

initialSeason

Can be either character or a vector / matrix of initial states. Treated the same way as initial. This means that different time series may share the same initial seasonal component.

seasonal

The type of seasonal component across the series. Can be "individual", so that each series has its own component or "common", so that the component is shared across the series.

weights

The weights for the errors between the series with the common seasonal component. Ignored if seasonal="individual".

loss

Type of Loss Function used in optimization. loss can be:

  • likelihood - which assumes the minimisation of the determinant of the covariance matrix of errors between the series. This implies that the series could be correlated;

  • diagonal - the covariance matrix is assumed to be diagonal with zeros off the diagonal. The determinant of this matrix is just a product of variances. This thing is minimised in this situation in logs.

  • trace - the trace of the covariance matrix. The sum of variances is minimised in this case.

ic

The information criterion used in the model selection procedure.

h

Length of forecasting horizon.

holdout

If TRUE, holdout sample of size h is taken from the end of the data.

interval

Type of interval to construct.

This can be:

  • "none", aka "n" - do not produce prediction interval.

  • "conditional", "c" - produces multidimensional elliptic interval for each step ahead forecast. NOT AVAILABLE YET!

  • "unconditional", "u" - produces separate bounds for each series based on ellipses for each step ahead. These bounds correspond to min and max values of the ellipse assuming that all the other series but one take values in the centre of the ellipse. This leads to less accurate estimates of bounds (wider interval than needed), but these could still be useful. NOT AVAILABLE YET!

  • "independent", "i" - produces interval based on variances of each separate series. This does not take vector structure into account. In the calculation of covariance matrix, the division is done by T-k rather than T.

  • "likelihood", "l" - produces "individual" interval with the variance matrix estimated from the likelihood, which is a biased estimate of the true matrix. This means that the division of sum of squares is done by T rather than T-k.

The parameter also accepts TRUE and FALSE. The former means that the independent interval are constructed, while the latter is equivalent to none. You can also use the first letter instead of writing the full word.

level

Confidence level. Defines width of prediction interval.

cumulative

If TRUE, then the cumulative forecast and prediction interval are produced instead of the normal ones. This is useful for inventory control systems.

intermittent

Defines type of intermittent model used. Can be:

  • none, meaning that the data should be considered as non-intermittent;

  • fixed, taking into account constant Bernoulli distribution of demand occurrences;

  • tsb, based on Teunter et al., 2011 method.

  • auto - automatic selection of intermittency type based on information criteria. The first letter can be used instead.

imodel

Either character specifying what type of VES / ETS model should be used for probability modelling, or a model estimated using viss function.

iprobability

Type of multivariate probability used in the model. Can be either "independent" or "dependent". In the former case it is assumed that non-zeroes occur in each series independently. In the latter case each possible outcome is treated separately.

bounds

What type of bounds to use in the model estimation. The first letter can be used instead of the whole word. "admissible" means that the model stability is ensured, while "usual" means that the all the parameters are restricted by the (0, 1) region.

silent

If silent="none", then nothing is silent, everything is printed out and drawn. silent="all" means that nothing is produced or drawn (except for warnings). In case of silent="graph", no graph is produced. If silent="legend", then legend of the graph is skipped. And finally silent="output" means that nothing is printed out in the console, but the graph is produced. silent also accepts TRUE and FALSE. In this case silent=TRUE is equivalent to silent="all", while silent=FALSE is equivalent to silent="none". The parameter also accepts first letter of words ("n", "a", "g", "l", "o").

...

Other non-documented parameters. For example FI=TRUE will make the function also produce Fisher Information matrix, which then can be used to calculated variances of smoothing parameters and initial states of the model.

Value

Object of class "vsmooth" is returned. It contains the following list of values:

  • model - The name of the fitted model;

  • timeElapsed - The time elapsed for the construction of the model;

  • states - The matrix of states with components in columns and time in rows;

  • persistence - The persistence matrix;

  • transition - The transition matrix;

  • measurement - The measurement matrix;

  • phi - The damping parameter value;

  • coefficients - The vector of all the estimated coefficients;

  • initial - The initial values of the non-seasonal components;

  • initialSeason - The initial values of the seasonal components;

  • nParam - The number of estimated parameters;

  • imodel - The intermittent model estimated with VES;

  • y - The matrix with the original data;

  • fitted - The matrix of the fitted values;

  • holdout - The matrix with the holdout values (if holdout=TRUE in the estimation);

  • residuals - The matrix of the residuals of the model;

  • Sigma - The covariance matrix of the errors (estimated with the correction for the number of degrees of freedom);

  • forecast - The matrix of point forecasts;

  • PI - The bounds of the prediction interval;

  • interval - The type of the constructed prediction interval;

  • level - The level of the confidence for the prediction interval;

  • ICs - The values of the information criteria;

  • logLik - The log-likelihood function;

  • lossValue - The value of the loss function;

  • loss - The type of the used loss function;

  • accuracy - the values of the error measures. Currently not available.

  • FI - Fisher information if user asked for it using FI=TRUE.

Details

Function estimates vector ETS in a form of the Single Source of Error state space model of the following type:

$$ \mathbf{y}_{t} = \mathbf{o}_{t} (\mathbf{W} \mathbf{v}_{t-l} + \mathbf{x}_t \mathbf{a}_{t-1} + \mathbf{\epsilon}_{t}) $$

$$ \mathbf{v}_{t} = \mathbf{F} \mathbf{v}_{t-l} + \mathbf{G} \mathbf{\epsilon}_{t} $$

$$\mathbf{a}_{t} = \mathbf{F_{X}} \mathbf{a}_{t-1} + \mathbf{G_{X}} \mathbf{\epsilon}_{t} / \mathbf{x}_{t}$$

Where \(y_{t}\) is the vector of time series on observation \(t\), \(o_{t}\) is the vector of Bernoulli distributed random variable (in case of normal data it becomes unit vector for all observations), \(\mathbf{v}_{t}\) is the matrix of states and \(l\) is the matrix of lags, \(\mathbf{x}_t\) is the vector of exogenous variables. \(\mathbf{W}\) is the measurement matrix, \(\mathbf{F}\) is the transition matrix and \(\mathbf{G}\) is the persistence matrix. Finally, \(\epsilon_{t}\) is the vector of error terms.

Conventionally we formulate values as:

$$\mathbf{y}'_t = (y_{1,t}, y_{2,t}, \dots, y_{m,t})$$ where \(m\) is the number of series in the group. $$\mathbf{v}'_t = (v_{1,t}, v_{2,t}, \dots, v_{m,t})$$ where \(v_{i,t}\) is vector of components for i-th time series. $$\mathbf{W}' = (w_{1}, \dots , 0; \vdots , \ddots , \vdots; 0 , \vdots , w_{m})$$ is matrix of measurement vectors.

For the details on the additive model see Hyndman et al. (2008), chapter 17.

In case of multiplicative model, instead of the vector y_t we use its logarithms. As a result the multiplicative model is much easier to work with.

For some more information about the model and its implementation, see the vignette: vignette("ves","smooth")

References

  • de Silva A,, Hyndman R.J. and Snyder, R.D. (2010). The vector innovations structural time series framework: a simple approach to multivariate forecasting. Statistical Modelling, 10 (4), pp.353-374

  • Hyndman, R.J., Koehler, A.B., Ord, J.K., and Snyder, R.D. (2008) Forecasting with exponential smoothing: the state space approach, Springer-Verlag. http://www.exponentialsmoothing.net.

  • L<U+00FC>tkepohl, H. (2005). New Introduction to Multiple Time Series Analysis. New introduction to Multiple Time Series Analysis. Berlin, Heidelberg: Springer Berlin Heidelberg. https://doi.org/10.1007/978-3-540-27752-1

See Also

es, ets

Examples

Run this code
# NOT RUN {
Y <- ts(cbind(rnorm(100,100,10),rnorm(100,75,8)),frequency=12)

# The simplest model applied to the data with the default values
ves(Y,model="ANN",h=10,holdout=TRUE)

# Damped trend model with the dependent persistence
ves(Y,model="AAdN",persistence="d",h=10,holdout=TRUE)

# Multiplicative damped trend model with individual phi
ves(Y,model="MMdM",persistence="i",h=10,holdout=TRUE,initialSeason="c")

Y <- cbind(c(rpois(25,0.1),rpois(25,0.5),rpois(25,1),rpois(25,5)),
           c(rpois(25,0.1),rpois(25,0.5),rpois(25,1),rpois(25,5)))

# Intermittent VES with logistic probability
ves(Y,model="MNN",h=10,holdout=TRUE,intermittent="l")

# }

Run the code above in your browser using DataLab