predict function

predict method.

predict method.

Conditional volatility (and predictive distribution) forecasts.

## S3 method for class 'MSGARCH_SPEC' predict( object, newdata = NULL, nahead = 1L, do.return.draw = FALSE, par = NULL, do.cumulative = FALSE, ctr = list(), ... ) ## S3 method for class 'MSGARCH_ML_FIT' predict( object, newdata = NULL, nahead = 1L, do.return.draw = FALSE, do.cumulative = FALSE, ctr = list(), ... ) ## S3 method for class 'MSGARCH_MCMC_FIT' predict( object, newdata = NULL, nahead = 1L, do.return.draw = FALSE, do.cumulative = FALSE, ctr = list(), ... )

Arguments

  • object: Model specification of class MSGARCH_SPEC

    created with CreateSpec or fit object of type MSGARCH_ML_FIT

    created with FitML or MSGARCH_MCMC_FIT created with FitMCMC.

  • newdata: Vector (of size T*) of new observations. (Default newdata = NULL)

  • nahead: Scalar indicating the number of step-ahead evaluation.

  • do.return.draw: Are simulation draws from the predictive distribution returned? (Default do.return.draw = FALSE)

  • par: Vector (of size d) or matrix (of size nmcmc x d) of parameter estimates where d must have the same length as the default parameters of the specification.

  • do.cumulative: Logical indicating if the conditional volatility prediction is computed on the cumulative simulations (typically log-returns, as they can be aggregated). (Default: do.cumulative = FALSE)

  • ctr: A list of control parameters:

    • nsim (integer >= 0): Number indicating the number of simulation done for the conditional volatlity forecast at nahead \> 1. (Default: nsim = 10000L)
  • ...: Not used. Other arguments to predict.

Returns

A list of class MSGARCH_FORECAST with the following elements:

  • vol: Condititional volatility forecast (vector of size nahead).

  • draw: If do.return.draw = TRUE:

    Draws sampled from the predictive distributions (matrix of size nahead x nsim).

    If do.return.draw = FALSE:

    NULL

The MSGARCH_FORECAST class contains the plot method.

Details

If a matrix of MCMC posterior draws is given, the Bayesian predictive conditional volatility (and predictive distribution) forecasts are returned.

Examples

# create specification spec <- CreateSpec() # load data data("SMI", package = "MSGARCH") # predict from specification par <- c(0.1, 0.1, 0.8, 0.2, 0.1, 0.8, 0.99, 0.01) set.seed(1234) pred <- predict(object = spec, par = par, newdata = SMI, nahead = 5L) head(pred) plot(pred) # predict from ML fit fit <- FitML(spec = spec, data = SMI) set.seed(1234) pred <- predict(object = fit, nahead = 5L, do.return.draw = TRUE) head(pred) plot(pred) ## Not run: set.seed(1234) fit <- FitMCMC(spec = spec, data = SMI) pred <- predict(object = fit, nahead = 5L, do.return.draw = TRUE) plot(pred) ## End(Not run)
  • Maintainer: Keven Bluteau
  • License: GPL (>= 2)
  • Last published: 2022-12-05