# How can I deal with overdispersion in a logistic (binomial) glm using R?

I'm running a logistic regression (presence/absence response) in R, using glmer (lme4 package). Ben Bolker's overdisp_fun (see link) tells me my model is overdispersed, so I decided to include an individual-level random effect. This is not solving my problem, as I get convergence issues and overdispersion is not reduced. Could anyone recommend an alternative?

Thanks!!

## migrated from stackoverflow.comNov 18 '15 at 21:05

This question came from our site for professional and enthusiast programmers.

• Could you provide a MWE or at least show some of the input and output? – ekstroem Nov 18 '15 at 16:10

Statistical overdispersion has a very specific meaning: it means that the actual variance is only proportional to the assumed variance: implying a simple correction can be applied (quasilikelihood, Nedderburn 1972) to calculate variance estimates for parameters and predicted values.

Your implemented test of overdispersion in R, however, can only tell you so much. Positive findings can be symptomatic of several problems regarding the variance structure including (but not limited to)

• mispecification of the mean model (including, but not limited to, omitted variable bias, incorrect link function, and/or incorrect transformation of predictors)
• hetereoscedasticity not related to overdispersion
• incorrect intracluster correlation structure specification
• actual overdispersion

Basically, as an analyst, I would only look at those sorts of tests to tell me if the most stringent modeling assumptions are being met. The lack of specificity for a positive finding is worrisome.

If you are interested in estimating a marginal effect, then a much more reliable and robust approach would be using generalized estimating equations. In all of the variance problem scenarios that I have listed above, a GEE is capable of producing valid variance estimates whereas other model based approaches can be completely biased. Basically, this is because GEE produces empirical sandwich based variance estimates, which are first order approximations of the bootstrap. Unlike the bootstrap, GEE can handle correlation structures. GEE is also far more efficient. It eases interpretation and modelling assumptions so that the relationship between two variables is the primary focus. This allows the relationship to be easily summarized.

The R packages for calculating GEE are geepack, and for sandwich errors is sandwich.

• Could you give an example of "hetereoscedasticity not related to overdispersion"? – James Jul 29 '16 at 14:35

If your model (except for the individual-level random effect) is a fixed-effect glm, you could try a quasibinomial model in glm(family=quasibinomial). Of course without being able to tinker with your data we can't know whether or not this is an appropriate strategy for you--but it might be worth pursuing.

A separate alternative is to check whether fitting the individual-level random effect using a Bayesian mode of inference via the MCMC (e.g. with software such as BUGS/JAGS/STAN) resolves your convergence issues.

Edited to add: Maybe others can shed some light on this, but if your response is truly presence-absence, rather than a count potentially greater than 1 (i.e. your binomial data always have the number of binomial trials equals 1), then any failure of the model specification must result from a mis-specification of the mean, because there is no freedom to specify the variance independent of the mean.

• Thanks user2868853, glmer does not take "quasi" families, you can only do that using simple glms. Will look into your second suggestion. – r.jaffe Nov 18 '15 at 16:48
• Ah. I though that maybe you were using lme4 only because you wanted to try the individual-level random effect, not knowing that you had random effects elsewhere in the analysis. I've edited the answer to clarify. – Jacob Socolar Nov 18 '15 at 17:00