Re: [R] prediction from glm

From: Dieter Menne <dieter.menne_at_menne-biomed.de>
Date: Sat 06 Aug 2005 - 01:56:43 EST

Hugues Santin-Janin <hsantin-janin <at> gct.org.uk> writes:

> I try to fit birds counts over years using glm. I have done (with Estate
> and year as factors):
>
> Model1 <- glm(Females~Estate+Year+offset = log(area)), family =
> quasipoisson(link = log), na.action = "na.exclude")
..
> Pred1 <- predict(Model1, type = "response", na.action = "na.exclude")
>
> My question is: How can I obtain predictions for Females in each year
> that are standardized by averaging over the levels of Estate?

You should use the newdata argument in predict.glm to construct the "should-be" data set. The example on the page ?predict.glm creates budworm-data on the fly, but it's probably easier to understand if you create a separate data frame myfemales first, the do predict(Model1, newdata=myfemales,..) in a separate step.

Dieter Menne



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Sat Aug 06 02:03:06 2005

This archive was generated by hypermail 2.1.8 : Sun 23 Oct 2005 - 15:06:09 EST