[R] Can not get a prediction interval from Predict
sdorairaj at gmail.com
Tue Mar 31 19:17:29 CEST 2009
?predict.glm has no "interval" argument. Perhaps you're thinking of
?predict.lm, which is different.
To get intervals in glm, I've used:
pr <- predict(budworm.lg, se.fit = TRUE)
family <- family(budworm.lg)
lower <- family$linkinv(pr$fit - qnorm(0.95) * pr$se.fit)
upper <- family$linkinv(pr$fit + qnorm(0.95) * pr$se.fit)
Note that these are "confidence" limits and not "prediction" limits.
The latter would require more thought.
You could also try RSiteSearch("glm interval").
On Tue, Mar 31, 2009 at 9:58 AM, Taylor Davis
<taylor.davis at klasresearch.com> wrote:
> I am trying to get a prediction interval from a glm regression.
> With newdat being my set of values to be fitted, and glmreg the name of my
> regression, I am using the following code.
> predict(glmreg, newdat, se.fit = TRUE, interval = "confidence", level =
> The problem is that I am only getting the standard error and the fitted
> value, not a prediction interval.
> Any help would be great! Thanks so much.
> TAYLOR DAVIS |
> taylor.davis at KLASresearch.com | 801.734.6279
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help