# NOT RUN {
# load data
data("SMI", package = "MSGARCH")
# create model specification
# MS(2)-GARCH(1,1)-Normal (default)
spec <- CreateSpec()
# fit the model on the data with ML estimation
fit <- FitML(spec = spec, data = SMI)
# compute the Value-at-Risk and Expected-shortfall in-sample
risk.its <- Risk(object = fit, alpha = 0.05, do.es = FALSE, do.its = TRUE)
plot(risk.its)
# compute the one-step ahead Value-at-Risk and Expected-shortfall out-of-sample
Risk(object = fit, alpha = 0.05, do.es = FALSE, do.its = FALSE, n.ahead = 1L)
# }
Run the code above in your browser using DataLab