# MAR model with constant variances
phi <- cbind(c(0, 0.8, 0), c(0, 0.6, 0.3))
weights <- c(0.8, 0.2)
model1 <- mar_model(phi = phi, sigmas = c(1, 2), weights = weights)
y <- simulate(model1, 100)
plot(y)
# MAR model with heteroskedastic errors
sigmas.spec <- list(
fGarch::garchSpec(model = list(alpha = c(0.05, 0.06))),
fGarch::garchSpec(model = list(alpha = c(0.05, 0.05)))
)
model2 <- mar_model(phi = phi, sigmas = sigmas.spec, weights = weights)
y <- simulate(model2, 100)
plot(y)
Run the code above in your browser using DataLab