# NOT RUN {
# GMAR model
params12 <- c(1.1, 0.9, 0.3, 4.5, 0.7, 3.2, 0.8)
pred12 <- forecastGMAR(VIX, 1, 2, params12, nsteps=10)
# Restricted GMAR model
params12r <- c(1.4, 1.8, 0.9, 0.3, 3.2, 0.8)
pred12r <- forecastGMAR(VIX, 1, 2, params12r, restricted=TRUE, nsteps=20,
conflevel=c(0.9, 0.8, 0.6), nt=200)
# StMAR model
params12t <- c(1.1, 0.9, 0.3, 4.5, 0.7, 3.2, 0.8, 5, 8)
pred12t <- forecastGMAR(VIX, 1, 2, params12t, StMAR=TRUE, nsteps=1)
# Non-mixture version of StMAR model with data as (fictional) time series object
params11t <- c(0.76, 0.93, 1.4, 2.4)
pred11t <- forecastGMAR(ts(VIX, start=1900, freq=12), 1, 1, params11t,
StMAR=TRUE, nsteps=5, useMean=TRUE)
# GMAR model as a mixture of AR(2) and AR(1) models
R <- list(diag(1, ncol=2, nrow=2), as.matrix(c(1, 0)))
params22c <- c(1.2, 0.8, 0.1, 0.3, 3.3, 0.8, 2.8, 0.8)
pred22c <- forecastGMAR(VIX, 2, 2, params22c, constraints=TRUE, R=R,
nsteps=15, conflevel=c(0.99, 0.9, 0.8))
# Such StMAR(3,2) that the AR coefficients are restricted to be
# the same for both regimes and that the second AR coefficients are
# constrained to zero.
params32trc <- c(2.2, 1.8, 0.88, -0.03, 2.4, 0.27, 0.40, 3.9, 1000)
pred32trc <- forecastGMAR(VIX, 3, 2, params32trc, StMAR=TRUE, restricted=TRUE, constraints=TRUE,
R=matrix(c(1, 0, 0, 0, 0, 1), ncol=2), nsteps=5)
# }
Run the code above in your browser using DataLab