predict.MSGARCH_SPEC {MSGARCH} | R Documentation |
predict method.
Description
Conditional volatility (and predictive distribution) forecasts.
Usage
## 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 |
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 |
Details
If a matrix of MCMC posterior draws is given, the Bayesian predictive conditional volatility (and predictive distribution) forecasts are returned.
Value
A list of class MSGARCH_FORECAST
with the following elements:
-
vol
: Condititional volatility forecast (vector of sizenahead
). -
draw
: Ifdo.return.draw = TRUE
:
Draws sampled from the predictive distributions (matrix of sizenahead
xnsim
).
Ifdo.return.draw = FALSE
:
NULL
The MSGARCH_FORECAST
class contains the plot
method.
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)