SCM

Forum: help

Monitor Forum | Start New Thread Start New Thread
RE: Get confidence interval for oneStepAhead prediction [ Reply ]
By: Sebastian Meyer on 2014-08-27 15:24
[forum:41400]

meanCI.R (10) downloads
Unfortunately, computing confidence intervals for the (conditional) mean $\mu_{i,t}$ (given Y_{.,t-1}) in hhh4() models is not as straightforward as in lm() or glm(). The mean is a sophisticated function of model parameters and does not belong to an exponential family, which is why standard methods as in predict.lm(..., interval="confidence") or predict.glm(..., se.fit=TRUE) do not apply.

I would opt for simulation-based confidence intervals, but there is no readily implemented function in the surveillance package which does the job (code contributions are always welcome, e.g., as an extension of surveillance:::predict.hhh4 with an additional argument 'interval' as in predict.lm). I'll illustrate by the attached example what I think is a valid approach for _confidence intervals of $\mu_{i,t}$_. You need the most recent release of the surveillance package (i.e., version 1.8-0) to run the code. Note that these confidence intervals for $\mu_{i,t}$ only take into account the uncertainty in parameter estimation, but not the sampling distribution of the counts.

I think a simple "empirical" solution for _prediction intervals_ for new observations $Y_{i,t}$ would be to plug-in the fitted means (and overdispersion) into qnbinom, e.g.:
upperPI <- qnbinom(0.975, mu=fitted(fit), size=1/coef(fit)["overdisp"])
lowerPI <- qnbinom(0.025, mu=fitted(fit), size=1/coef(fit)["overdisp"])
This would of course ignore uncertainy due to parameter estimation.
But this is what you can easily do if you have a set of pred <- oneStepAhead() predictions (and -log(overdisp) if negative binomial), just use mu=pred$pred and size=exp(pred$psi).

RE: Get confidence interval for oneStepAhead prediction [ Reply ]
By: Michael Höhle on 2014-07-25 22:17
[forum:41305]
Thanks for your interest in the surveillance package.

Due to holidays we will unfortunately take a couple of days to get back to you.

Thanks for your patience.

Get confidence interval for oneStepAhead prediction [ Reply ]
By: Kinh Nguyen on 2014-07-24 16:26
[forum:41302]
In fitting the model with hhh4 (weekly data, negative binomial), are there any direct way to also obtain the CI for the predicted value in each time point? If not, is it possible to use the saved parameters to calculated this CI.
Thanks.

Thanks to:
Vienna University of Economics and Business Powered By FusionForge