[R] Predicted values when using offset in ZIP GLM
Achim Zeileis
Achim.Zeileis at uibk.ac.at
Thu Jul 12 23:04:44 CEST 2012
On Thu, 12 Jul 2012, Lee, Laura wrote:
> Hi all!
>
> I have built a model to predict interactions with turtles and the model
> includes an offset for effort:
>
> ZIP<-zeroinfl(Sturgeon~fMesh+fSeason+offset(LogEffort),dist="poisson",link="logit",data=data)
Note that this includes the offset both in the count component and in the
zero inflation component. The latter is probably not desired. (As Alain
already previously pointed out in one of hise e-mails.)
For specifying the offset only in the count component you can do either
one of
Sturgeon ~ fMesh + fSeason + offset(LogEffort) | fMesh + fSeason
or
Sturgeon ~ fMesh + fSeason, offset = LogEffort
However, it may be useful to include LogEffort as a regular variable (not
an offset) in the inflation component as well...
> I wasn't clear about one aspect of the response to a similar question I
> recently posted...I apply the predicted model to a new dataset of
> standard conditions and take the sum to get the total predicted numbers
> of bycatch:
>
> Prediction<-predict(ZIP,newdata=effort,type="response")
> sum(Prediction)
>
> Do I first need to exponentiate before taking the sum as in:
>
> Prediction<-exp(predict(ZIP,newdata=effort,type="response"))
> sum(Prediction)
No. predict(..., type = "response") computes the expected mean of the
response (as previously pointed out here and as clearly stated in the
accompanying paper).
Z
> Thanks again in advance!
>
> Cheers,
>
> Laura
>
>
>
>
> [[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.
>
More information about the R-help
mailing list