overdispersion estimation in a binomial GLMM
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On 01/21/2011 11:11 AM, Thomas Merkling wrote:
Thanks to Robert and Ben for their precious answers ! I tried the dispersion function it works and gives me a 1.244403 value. As it is not really bigger than 1, should I treat my model as overdispersed ?
Perhaps not. (How many observations?)
Moreover I tried to fit an observation level random effect as suggested by Ben Bolker, but it gives me an error message ! dispersion_glmer(model)# 1.244403 baba$obs <- 1:nrow(baba) model_OD <- + glmer(propNb~SexA*SexB*AgeA+(1|Nest)+(1|obs),data=baba,family="binomial") Number of levels of a grouping factor for the random effects is *equal* to n, the number of observations
That is a 'message' (not even a 'warning'), rather than an error. Doug Bates was initially quite suspicious of this approach (adding a random effect for every observation), which makes little sense in the LMM case (where it would be confounded with the residual error). Maybe I will prevail upon him to see if we can drop the message since it makes people worry unnecessarily ... If you wanted a crude test, you could compare the log-likelihoods of your model with and without the overdispersion term (via anova()). The p-value of the likelihood ratio test computed in this way is approximately double what it should be (because the null value of the variance parameter (zero) is on the boundary of its feasible space) but it should give you an approximate idea ...
So what is the problem with this ? Thanks a lot !! Thomas Merkling Le 20:59, Ben Bolker a ?crit : On 01/20/2011 11:40 AM, espesser wrote:
Here is a small function to compute the dispersion of
a binomial model, according to a previous answer of D. Bates on the
topic:
dispersion_glmer<- function(modelglmer)
{
## computing estimated scale ( binomial model)
#following D. Bates :
#That quantity is the square root of the penalized residual sum of
#squares divided by n, the number of observations, evaluated as:
n<- length(modelglmer at resid)
return( sqrt( sum(c(modelglmer at resid, modelglmer at u) ^2) / n ) )
}
-- Robert Espesser
CNRS UMR 6057 - Universit? de Provence
5 Avenue Pasteur - BP 80975
13604 AIX-EN-PROVENCE Cedex 1
Tel: +33 (0)442 95 36 26
Le 20/01/2011 16:59, Thomas Merkling a ?crit :
Dear list members, I am trying to fit a binomial GLMM and I wonder if there is overdispersion. I'm not sure to know how to do it. I tried to fit with "quasibinomial" family but apparently it doesn't exist anymore in lme4. I also tried this but I am not sure that it is true for mixed models. model<-lmer(propNb~SexA*SexB*AgeA+(1|Nest),data=baba,family="binomial") k<- attr(logLik(model),"df") # n<- length(fitted(model)) pearsonresid<- (1/(n-k)) * sum(resid(model,"pearson")2) # 1.731892 dev<- deviance(model)/(n-k) #2.378512 One more thing: how to deal with this model if there is overdispersion ? Thanks by advance, Best,
If there is overdispersion, the current advice is to fit an observation-level random effect: baba$obs<- 1:nrow(baba) model_OD<- glmer(propNb~SexA*SexB*AgeA+(1|Nest)+(1|obs),data=baba,family="binomial")
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk05ssgACgkQc5UpGjwzenOCmwCfVrZKwsUUxx7uBnsbrfWIY1iP IYsAnREK+mzr57oNzdT/gW+u0dyrJIRZ =NkyO -----END PGP SIGNATURE-----