Learn R Programming

blmeco (version 1.1)

dispersion_glmer: Measures dispersion in a glmer-model

Description

Computes the estimated scale in a binomial (and Poisson) mixed model

Usage

dispersion_glmer(modelglmer)

Arguments

modelglmer

a model that has been fitted by glmer

Value

the scale parameter, according to recommendations by D. Bates, if the scale paramter is between 0.75 and 1.4, there may not be an overdispersion problem.

Such one number diagnostics should not be used as the only decision criterion. It can indicate overdispersion, but if it does not, it does not mean that the model fits the data well. Thorough residual analyses or posterior predictive model checking is still needed!

References

This function has been posted on the R-helplist. It seems to have been written or motivated by D. Bates. Here is the URL, where we downloaded the function: https://stat.ethz.ch/pipermail/r-sig-mixed-models/2011q1/015392.html

Examples

Run this code
# NOT RUN {
data(swallowfarms)
dat <- swallowfarms
dat$colsize.z <- scale(dat$colsize)   # scaled values for better model convergence
dat$dung.z    <- scale(dat$dung)
dat$die <- dat$clutch - dat$fledge
mod <- glmer(cbind(fledge,die) ~ colsize.z + cow + dung.z + (1|farm) , data=dat, family="binomial")
dispersion_glmer(mod)
# }

Run the code above in your browser using DataLab