multicov function

Function returns the multiple steps ahead covariance matrix of forecast errors

Function returns the multiple steps ahead covariance matrix of forecast errors

This function extracts covariance matrix of 1 to h steps ahead forecast errors for adam(), ssarima(), gum(), sma(), es() and ces() models.

multicov(object, type = c("analytical", "empirical", "simulated"), h = 10, nsim = 1000, ...) ## S3 method for class 'smooth' multicov(object, type = c("analytical", "empirical", "simulated"), h = 10, nsim = 1000, ...)

Arguments

  • object: Model estimated using one of the functions of smooth package.

  • type: What method to use in order to produce covariance matrix:

    1. analytical - based on the state space structure of the model and the one-step-ahead forecast error. This works for pure additive and pure multiplicative models. The values for the mixed models might be off.
    2. empirical - based on the in-sample 1 to h steps ahead forecast errors (works fine on larger samples);
    3. simulated - the data is simulated from the estimated model, then the same model is applied to it and then the empirical 1 to h steps ahead forecast errors are produced;
  • h: Forecast horizon to use in the calculations.

  • nsim: Number of iterations to produce in the simulation. Only needed if type="simulated"

  • ...: Other parameters passed to simulate function (if type="simulated"

    is used). These are obs and seed. By default obs=1000. This approach increases the accuracy of covariance matrix on small samples and intermittent data;

Returns

Scalar in cases of non-smooth functions. (h x h) matrix otherwise.

Details

The function returns either scalar (if it is a non-smooth model) or the matrix of (h x h) size with variances and covariances of 1 to h steps ahead forecast errors.

Examples

x <- rnorm(100,0,1) # A simple example with a 5x5 covariance matrix ourModel <- ces(x, h=5) multicov(ourModel)

See Also

orders

Author(s)

Ivan Svetunkov, ivan@svetunkov.com

  • Maintainer: Ivan Svetunkov
  • License: LGPL-2.1
  • Last published: 2025-04-02