[R] prediction from glm...

Prof Brian Ripley ripley at stats.ox.ac.uk
Sun Aug 7 18:47:46 CEST 2005


On Sun, 7 Aug 2005, hugues santin janin wrote:

> Hello r-help,
>
> I'm trying to fit birds counts over years using glm. In fact I'm trying to reproduce an analysis already perform with genstat (attach document). 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")

That is not valid R. 
Did you actually use  Females~Estate+Year+offset(log(area)) ?

> After I have calculated the prediction using:
>
> Pred1 <- predict(Model1, type = "response", na.action = "na.exclude")
>
> Pred1 given to me the prediction using Model1 e.g. Females~Estate+Year.

That is not what I read Model1 to be.

> But I search to reproduce the original data whitout the sEstate effect.

Did you mean the 'Estate' term?  Otherwise, what is `sEstate'?

> That permit me to interprete only the variation in number of bird due to 
> theYear. The argument new.data seems useful to specify which data we 
> want to predict but not to specify how to predict these data.

Did you mean `newdata'?

> predict.glm is the good functoin to do that? How can I specify to 
> predict.glm() to remove the sEstate effect of the Females prediction?

You fit a model without the term if you want to predict from a different 
model.

> I have not found answer in the archives of R-help.
> I thank you for your time and your help in regards to this problem,

I am sorry, but you will need to be *accurate* in what you write, as you 
have made too many errors for me (at least) to guess what you mean.

This sort of thing is covered in all good texts on R, of which there are 
several in the FAQ.

-- 
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




More information about the R-help mailing list