if (FALSE) {
data(panas)
# Fit DCC(2,2) with constant mean structure.
fit <- bmgarch(panas, parameterization = "DCC", P = 2, Q = 2, meanstructure = "constant")
# Forecast 8 ahead
fit.fc <- forecast(fit, ahead = 8)
# Print forecasts
fit.fc
print(fit.fc)
# Plot variance forecasts
plot(fit.fc, type = "var")
# Plot correlation forecasts
plot(fit.fc, type = "cor")
# Save backcasted and forecasted values as data frame.
fit.fc.df <- as.data.frame(fit.fc)
# Save only forecasted values as data frame.
fit.fc.df <- as.data.frame(fit.fc, backcast = FALSE)
# Add another model, compute model weights and perform a model weighted forecast
# Fit a DCC(1,1) model
fit1 <- bmgarch(panas, parameterization = "DCC", P = 1, Q = 1, meanstructure = "constant")
# Compute model stacking weights based on the last 19 time points (with L = 80)
blist <- bmgarch_list( fit1, fit )
mw <- model_weights(blist, L = 80)
# Weighted forecasts:
w.fc <- forecast(object = blist, ahead = 8, weights = mw)
}
Run the code above in your browser using DataLab