4
$\begingroup$

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).)

$\endgroup$
9
  • 3
    $\begingroup$ Can you expand on the statement that you were not able to incorporate the recommendation of including (1|subject_id) ? $\endgroup$
    – Aniko
    Jan 28, 2014 at 14:33
  • $\begingroup$ Number of measured subjects in my dataset is equal to number of observations or records in the dataset. Thus I do not know if I should incorporate both (1|subject_id) and 'data$obs_effect<-1:nrow(data)'... $\endgroup$ Jan 28, 2014 at 14:39
  • $\begingroup$ You can call it subject_id or obs_effect - they are the same thing in your case. Include one of them, and any other fixed and random effects you need. $\endgroup$
    – Aniko
    Jan 28, 2014 at 14:49
  • $\begingroup$ I did it like this: m1<-lmer(dependent.var ~ 1 + cat.var1 * cat.var2 * contin.var + (1|obs_effect) + (1|group), data = dat, family = "poisson"), and also like this: m1<-lmer(dependent.var ~ 1 + obs_effect + cat.var1 * cat.var2 * contin.var + (1|obs_effect) + (1|group), data = dat, family = "poisson") but in both cases the model residuals ('plot(fitted, residuals)') were not OK at all (they formed a triangle)... $\endgroup$ Jan 28, 2014 at 14:59
  • 1
    $\begingroup$ @BenBolker Here are posted my data: docs.google.com/file/d/0Bz8ojhHeiNclVi1oT0ZwTEtEN2s/edit $\endgroup$ Jan 29, 2014 at 6:37

1 Answer 1

8
$\begingroup$

Pulling out the answer from the discussion in the comments: If you create an obs_effect variable (observation-level random effect) with a unique value for each observation (say, 1:nrow(dat)), then you can incorporate overdispersion in the model by fitting

m2 <- glmer(dependent.var ~  cat.var1 * cat.var2 * contin.var + (1|obs_effect) + (1|group),
           data = dat, family = "poisson")

You also state in the comments that your problem is that the residual plot is triangle-shaped, which I interpret as the variability of the residuals increases with the predicted value. Depending on what kind of residuals you are plotting, this might mean nothing (the variability of observed - fitted should increase with fitted), or might mean that you have a problem other than overdispersion, which does not show up in a residual plot.

Reference: Harrison, X.A., 2014. Using observation-level random effects to model overdispersion in count data in ecology and evolution. PeerJ 2, e616. doi:10.7717/peerj.616

$\endgroup$
1
  • 1
    $\begingroup$ thank you for your answer. The variability of residuals of m2-model decreases with fitted values. Interestingly, in overdispersed Poisson GLMM, scatter of those residuals against fitted values is OK. Please, see my last two comments above for more info. $\endgroup$ Jan 28, 2014 at 20:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.