| predict.MSGARCH_SPEC | R Documentation |
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(), ... )
object |
Model specification of class |
newdata |
Vector (of size T*) of new observations. (Default |
nahead |
Scalar indicating the number of step-ahead evaluation. |
do.return.draw |
Are simulation draws from the predictive distribution
returned? (Default |
par |
Vector (of size d) or matrix (of size |
do.cumulative |
Logical indicating if the conditional volatility
prediction is computed on the cumulative simulations (typically log-returns, as they can be aggregated).
(Default: |
ctr |
A list of control parameters:
|
... |
Not used. Other arguments to |
If a matrix of MCMC posterior draws is given, the Bayesian predictive conditional volatility (and predictive distribution) forecasts are returned.
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.
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.