Thomas Lapeyre
2008-Aug-11 14:05 UTC
[R] Prediction confidence intervals for a Poisson GLM
Un texte encapsul? et encod? dans un jeu de caract?res inconnu a ?t? nettoy?... Nom : non disponible URL : <https://stat.ethz.ch/pipermail/r-help/attachments/20080811/b8dc0378/attachment.pl>
Prof Brian Ripley
2008-Aug-11 16:32 UTC
[R] Prediction confidence intervals for a Poisson GLM
Confidence intervals for what? For a Poisson glm() you can predict the mean response or the linear predictor, and they are not the same (unlike a linear model). I suggest you predict the linear predictor (the default), use the s.e.s to for a confidence interval and then if desired transform (exp in your case, family(object)$linkinv() in general.). The code would be very similar to predict.lm, and indeed if you study predict.glm you will see how to call predict.lm to do this. The family should not affect how you do it: poisson vs quasipoisson merely affects the estimates of the s.e.s. On Mon, 11 Aug 2008, Thomas Lapeyre wrote:> > Hello, > > I'm fitting a Poisson GLM with the glm( ) function and I would like to know how to obtain the confidence intervals for predictions (fitted values)... > I mean like in function lm( ): > > prediction.matrix=exp(predict(model1.lm,interval="prediction") > > (where model1.lm is assumed to be a log-linear model fitted with the lm() function.)> Is there any function which can do it? If not how can I compute the > prediction intervals from the fitted values? Is it the same for > "quasipoisson" models? > > Thanks you very much! > > Annexe: for example I use: > model2.glm=glm(Y~X1+X2, family="poisson") > > > > > _________________________________________________________________ > [[elided Hotmail spam]] > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >-- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595