Description Usage Arguments Details Value Author(s) See Also Examples
Method for creating rolling density forecast from ARMA-GARCH models with option for refitting every n periods and some multicore parallel functionality.
1 2 3 4 5 | ugarchroll(spec, data, n.ahead = 1, forecast.length = 500, refit.every = 25,
refit.window = c("recursive", "moving"), parallel = FALSE,
parallel.control = list(pkg = c("multicore", "snowfall"), cores = 2), solver = "solnp",
fit.control = list(), solver.control = list(), calculate.VaR = TRUE,
VaR.alpha = c(0.01, 0.05), ...)
|
spec |
A univariate GARCH spec object specifiying the desired model for testing. |
data |
A univariate dataset. |
n.ahead |
The number of periods to forecast. |
forecast.length |
The length of the total forecast for which out of sample data from the dataset will be excluded for testing. |
refit.every |
Determines every how many periods the model is re-estimated. |
refit.window |
Whether the refit is done on an expanding window including all the previous data or a moving window, the length of the window determined by the argument above (“refit.every”). |
parallel |
Whether to make use of parallel processing on multicore systems. |
parallel.control |
The parallel control options including the type of package for performing the parallel calculations (‘multicore’ for non-windows O/S and ‘snowfall’ for all O/S), and the number of cores to make use of. |
solver |
The solver to use. |
fit.control |
Control parameters parameters passed to the fitting function. |
solver.control |
Control parameters passed to the solver. |
calculate.VaR |
Whether to calculate forecast Value at Risk during the estimation. |
VaR.alpha |
The Value at Risk tail level to calculate. |
... |
. |
GARCH models generate a partially time varying density based on the variation in the
conditional sigma and mean values (skewness and shape are usually not time varying in
GARCH models unless the underlying distribution has an interaction with the conditional
sigma). The function first generates rolling forecasts of the ARMA-GARCH model and then
rescales the density from a standardized (0, 1, skew, shape) to the one representing
the underlying return process (mu, sigma, skew, shape). Given this information it is
then a simple matter to generate any measure of risk through the analytical evaluation
of some type of function of the time varying density. The function calculates one such
measure (VaR), but since the full time varying density parameters are returned, the user
can calculate many others (see for example partial moments based measures or the
Pedersen-Satchell family of measures).
The argument refit.every
determines every how many periods the fit is
recalculated and the total forecast length actually calculated. For example, for
a forecast length of 500 and refit.every
of 25, this is 20 windows of 25 periods each
for a total actual forecast length of 500. However, for a refit.every
of 30, we take
the floor of the division of 500 by 30 which is 16 windows of 30 periods each for a
total actual forecast length of 480 (16 x 30). The important thing to remember about
the refit.every is that it acts like the n.roll argument in the
ugarchforecast
function as it determines the number of rolls to perform.
For example for n.ahead of 1 and refit.every of 25, the forecast is rolled every day
using the filtered (actual) data of the previous period while for n.ahead of 1 and
refit.every of 1 we will get 1 n.ahead forecasts for every day after which the model
is refitted and reforecast for a total of 500 refits (when length.forecast is 500)!
The function has 2 main methods for viewing the data, a standard plot method and
a new report methods (see class uGARCHroll
for details on how
to use these methods).
An object of class uGARCHroll
.
Alexios Ghalanos
For specification ugarchspec
, fitting ugarchfit
, filtering ugarchfilter
,
forecasting ugarchforecast
, simulation ugarchsim
, parameter distribution and
uncertainty ugarchdistribution
, bootstrap forecast ugarchboot
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | ## Not run:
data(sp500ret)
ctrl = list(rho = 1, delta = 1e-9, outer.iter = 100, inner.iter = 650, tol = 1e-7)
spec = ugarchspec(variance.model = list(model = "sGARCH", garchOrder = c(1,1)),
mean.model = list(armaOrder = c(0,0), include.mean = TRUE),
distribution.model = "std")
sp500.bktest = ugarchroll(spec, data = sp500ret, n.ahead = 1, forecast.length = 100,
refit.every = 25, refit.window = "recursive",
solver = "solnp", fit.control = list(), solver.control = ctrl,
calculate.VaR = TRUE, VaR.alpha = c(0.01, 0.025, 0.05))
report(sp500.bktest, type="VaR", n.ahead = 1, VaR.alpha = 0.01, conf.level = 0.95)
report(sp500.bktest, type="fpm")
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.