Learn R Programming

MSGARCH (version 1.3)

Forecast: Forecasting method.

Description

Method returning conditional volatility forecasts and density forecasts of the process.

Usage

Forecast(object, ...)

# S3 method for MSGARCH_SPEC Forecast(object, par, data, n.ahead = 1L, do.return.draw = FALSE, ctr = list(), ...)

# S3 method for MSGARCH_ML_FIT Forecast(object, new.data = NULL, n.ahead = 1L, do.return.draw = FALSE, ctr = list(), ...)

# S3 method for MSGARCH_MCMC_FIT Forecast(object, new.data = NULL, n.ahead = 1L, do.return.draw = 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.

...

Not used. Other arguments to Forecast.

par

Vector (of size d) or matrix (of size n.mcmc x d) of parameter estimates where d must have the same length as the default parameters of the specification.

data

Vector (of size T) of observations.

n.ahead

Scalar indicating the number of step-ahead evaluation.

do.return.draw

Are the sampled simulation draws returned? (Default do.return.draw = FALSE)

ctr

A list of control parameters:

  • n.sim (integer >= 0): Number indicating the number of simulation done for the conditional vloatlity forecast at n.ahead > 1. (Default: n.sim = 10000L)

new.data

Vector (of size T*) of new observations. (Default new.data = NULL)

Value

A list of class MSGARCH_CONDVOL with the following elements:

  • vol: Condititional volatility Forecast (vector of size n.ahead).

  • draw: If do.return.draw = TRUE: Draws sample from the predictive distributions (matrix of size n.ahead x n.sim). 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 forecasts are calculated.

Examples

Run this code
# NOT RUN {
# load data
data("SMI", package = "MSGARCH")

# create model specification
# MS(2)-GARCH(1,1)-Normal (default)
spec <- CreateSpec()

# fit the model on the data by ML
fit <- FitML(spec = spec, data = SMI)

# compute the In-sample conditional volatility from the fitted model
forecast <- Forecast(object = fit, n.ahead = 5L)
plot(forecast)
# }

Run the code above in your browser using DataLab