[R-sig-ME] overdispersion estimation in a binomial GLMM

espesser robert.espesser at lpl-aix.fr
Thu Jan 20 17:40:40 CET 2011

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