I want to model counts as being dependent on two nominal variables, one continuous variable (all as fixed effects) with 3rd-order interactions and one grouping variable (as random effect). However, I have an overdispersion in outcomes (I used the glmer
function from lme4
library). How should I manage this? I have found some solution for the problem (https://stats.stackexchange.com/a/9670/38080) but I am not able to incorporate that recommendation into my model.
Here is my model:
m1<-glmer(dependent.var ~ cat.var1 * cat.var2 * contin.var + (1|group),
data = dat, family = "poisson")
Any suggestion? (I did it also like a marginal model with 'geeglm' function (library geepack), but I would like to calculate R-squared of the model, which is possible to obtain just from former GLMM (see Nakagawa & Schielzeth 2013; http://onlinelibrary.wiley.com/doi/10.1111/j.2041-210x.2012.00261.x/abstract).)
(1|subject_id)
? $\endgroup$subject_id
orobs_effect
- they are the same thing in your case. Include one of them, and any other fixed and random effects you need. $\endgroup$