predict.larch {gets} | R Documentation |
Variance forecasting with 'larch' models
Description
Generate out-of-sample variance forecasts up to n.ahead
steps ahead. Optionally, quantiles of the forecasts are also returned if the argument probs
is specified. The forecasts, confidence intervals and quantiles are obtained via simulation. By default, 5000 simulations is used, but this can be changed via the n.sim
argument. Also by default, the simulations uses a classical bootstrap to sample from the standardised residuals. To use an alternative set of standardised innovations, for example the standard normal, use the innov
argument
Usage
## S3 method for class 'larch'
predict(object, n.ahead=12, newvxreg=NULL, newindex=NULL,
n.sim=NULL, innov=NULL, probs=NULL, quantile.type=7, verbose = FALSE, ...)
Arguments
object |
an object of class 'larch' |
n.ahead |
|
newvxreg |
a |
newindex |
|
n.sim |
|
innov |
|
probs |
|
quantile.type |
an integer between 1 and 9 that selects which algorithm to be used in computing the quantiles, see the argument |
verbose |
logical with default |
... |
additional arguments |
Details
No details for the moment.
Value
a vector
of class zoo
containing the out-of-sample forecasts, or a matrix
of class zoo
containing the out-of-sample forecasts together with additional information (e.g. the prediction-quantiles)
Author(s)
Genaro Sucarrat, https://www.sucarrat.net/
See Also
Examples
##Simulate some data:
set.seed(123)
e <- rnorm(40)
##estimate log-ARCH(1) model:
mymod <- larch(e, arch=1)
##generate out-of-sample forecasts:
predict(mymod)
##same, but return also selected quantiles:
predict(mymod, probs=c(0.10,0.90))
##same, but using standard normals (instead of bootstrap) in the simulations:
n.sim <- 2000
n.ahead <- 12 #the default on n.ahead
predict(mymod, probs=c(0.10,0.90), n.sim=n.sim, innov=rnorm(n.ahead*n.sim))
##make x-regressors:
x <- matrix(rnorm(40*2), 40, 2)
##estimate log-ARCH(1) model w/covariates:
mymod <- larch(e, arch=1, vxreg=x)
##predict up to 5 steps ahead, setting x's to 0 out-of-sample:
predict(mymod, n.ahead=5, newvxreg=matrix(0,5,NCOL(x)))