# 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 by ML
fit <- FitML(spec = spec, data = SMI)
# run PIT method in-sample
pit.its <- PIT(object = fit, do.norm = TRUE, do.its = TRUE)
# diagnostic of PIT with qqnorm
qqnorm(pit.its)
qqline(pit.its)
# simulate a serie from the model
set.seed(123)
sim.series <- Sim(object = spec, par = fit$par, n.ahead= 1000L, n.sim = 1L)
sim.series <- as.vector(sim.series$draw)
# run PIT method on the simualed serie with the true par
pit.x <- PIT(object = spec, par = fit$par, data = sim.series, do.norm = TRUE, do.its = TRUE)
qqnorm(pit.x)
qqline(pit.x)
# }
Run the code above in your browser using DataLab