# load data
data("sp500")
sp500 = sp500[1:1000]
# create model specification
spec = MSGARCH::create.spec()
# fit the model on the data with ML estimation using DEoptim intialization
set.seed(123)
fit = MSGARCH::fit.mle(spec = spec, y = sp500, ctr = list(do.init = FALSE))
# compute the Value-at-Risk and Expected-shortfall
# Risk estimation in-sample
risk.its = MSGARCH::risk(object = fit, level = 0.95, ES = FALSE, do.its = TRUE)
plot(risk.its)
# Risk estimation at T + 1
risk = MSGARCH::risk(object = fit, level = 0.95, ES = FALSE, do.its = FALSE)
Run the code above in your browser using DataLab