overdisp_fun: Test for overdispersion of glmer models (variance larger than...

View source: R/overdisp_fun.R

overdisp_funR Documentation

Test for overdispersion of glmer models (variance larger than the mean)

Description

Overdispersion of a glmer model is given if the deviation is larger than the mean. If this is the case (the ratio is larger than 1), it is recommended to calculate a variable with a unique value for each observation (dat$obs_effect <- 1:nrow(dat)) and to include this variable as additional random term (+ (1|obs_effect)).

It is important to fit the glmer model on the raw data. Otherwise, this function throws an error message.

Usage

overdisp_fun(model)

Arguments

model

glmer model (fitted with the glmer() function of the lme4 package)

Value

Overdispersion measure.

References

http://glmm.wikidot.com/faq

http://stats.stackexchange.com/questions/6989/how-do-i-fit-a-multilevel-model-for-over-dispersed-poisson-outcomes/9670#9670

http://stats.stackexchange.com/questions/83611/how-to-fix-an-overdispersion-in-a-poisson-glmm-with-lmer-function-in-r


markushuff/PsychHelperFunctions documentation built on Sept. 11, 2022, 3:43 a.m.