Learn R Programming

smooth (version 2.4.7)

gsi: Vector exponential smoothing model with Group Seasonal Indices

Description

Function constructs VES model with restrictions on seasonal indices

Usage

gsi(data, model = "MNM", weights = 1/ncol(data), type = c(3, 2, 1),
  cfType = c("likelihood", "diagonal", "trace"), ic = c("AICc", "AIC",
  "BIC", "BICc"), h = 10, holdout = FALSE, intervals = c("none",
  "conditional", "unconditional", "independent"), level = 0.95,
  bounds = c("admissible", "usual", "none"), silent = c("all", "graph",
  "output", "none"), ...)

Arguments

data

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

model

The type of seasonal ETS model. Currently only "MMM" is available.

weights

The vector of weights for seasonal indices of the length equal to the number of time series in the model.

type

Type of the GSI model. Can be "Model 1", "Model 2" or "Model 3".

cfType

Type of Cost Function used in optimization. cfType 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.

intervals

Type of intervals to construct. NOT AVAILABLE YET!

This can be:

  • none, aka n - do not produce prediction intervals.

  • conditional, c - produces multidimensional elliptic intervals for each step ahead forecast.

  • 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 intervals than needed), but these could still be useful.

  • independent, i - produces intervals based on variances of each separate series. This does not take vector structure into account.

The parameter also accepts TRUE and FALSE. The former means that conditional intervals are constructed, while the latter is equivalent to none.

level

Confidence level. Defines width of prediction interval.

bounds

What type of bounds to use in the model estimation. The first letter can be used instead of the whole word. Currently only "admissible" bounds are available.

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;

  • 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;

  • actuals - 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 intervals;

  • intervals - The type of the constructed prediction intervals;

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

  • ICs - The values of the information criteria;

  • logLik - The log-likelihood function;

  • cf - The value of the cost function;

  • cfType - The type of the used cost 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 VES in a form of the Single Source of Error state space model, restricting the seasonal indices. The model is based on ves

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.

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 {
initialSeason <- runif(12,-1,1)
Y <- sim.ves("AAA", obs=120, nSeries=2, frequency=12, initial=c(10,0),
             initialSeason=initialSeason-mean(initialSeason),
             persistence=c(0.06,0.05,0.2), mean=0, sd=0.03)
Y$data <- exp(Y$data)

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

# An example with MASS package and correlated errors
# }
# NOT RUN {
library(MASS)
# }
# NOT RUN {
Y <- sim.ves("AAA", obs=120, nSeries=2, frequency=12,
         initial=c(5,0), initialSeason=initialSeason-mean(initialSeason),
         persistence=c(0.02,0.01,0.1), randomizer="mvrnorm", mu=c(0,0),
         Sigma=matrix(c(0.2,0.1,0.1,0.1),2,2))
# }
# NOT RUN {
Y$data <- exp(Y$data)
# }
# NOT RUN {
gsi(Y, h=10, holdout=TRUE, interval="u", silent=FALSE)
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab