data("measlesWeserEms")
## fit a hhh4 model
measlesModel <- list(
end = list(f = addSeason2formula(~0 + ri(type="iid"))),
ar = list(f = ~1),
ne = list(f = ~1, weights = W_powerlaw(maxlag = 5)),
family = "NegBin1")
measlesFit <- hhh4(measlesWeserEms, control = measlesModel)
## plot fitted mean components
plot(measlesFit, units = NULL)
## overall calibration test
calibrationTest(measlesFit) # default is DSS (not suitable for low counts)
calibrationTest(measlesFit, which = "rps")
calibrationTest(measlesFit, which = "logs")
## test calibration for the second year in a specific district
calibrationTest(measlesFit, subset = 53:104, units = "03452", which = "rps")
Run the code above in your browser using DataLab