Learn R Programming

sjmisc (version 1.7)

overdisp: Check overdispersion of GL(M)M's

Description

This function checks generalized linear (mixed) models for overdispersion.

Usage

overdisp(x, trafo = NULL)

Arguments

x
Fitted GLMM (merMod-class) or glm model.
trafo
A specification of the alternative, can be numeric or a (positive) function or NULL (the default). See 'Details' in dispersiontest in package AER. Does not apply to m

Value

  • Information on the overdispersion test.

Details

For merMod-objects, this function is based on the code in the http://glmm.wikidot.com/faq{DRAFT r-sig-mixed-models FAQ}, section How can I deal with overdispersion in GLMMs?. Note that this function only returns an approximate estimate of an overdispersion parameter. For glm's, this function simply wraps the dispersiontest from the AER-package.

References

http://glmm.wikidot.com/faq{DRAFT r-sig-mixed-models FAQ}

Examples

Run this code
data(efc)

# response has many zero-counts, poisson models
# might be overdispersed
barplot(table(efc$tot_sc_e))

fit <- glm(tot_sc_e ~ neg_c_7 + e42dep + c160age,
           data = efc,
           family = poisson)
overdisp(fit)


library(lme4)
efc$e15relat <- to_factor(efc$e15relat)
fit <- glmer(tot_sc_e ~ neg_c_7 + e42dep + c160age + (1 | e15relat),
             data = efc, family = poisson)
overdisp(fit)

Run the code above in your browser using DataLab