I'm trying to model a response variable y with respect to a nested variable x in R. First of all, I fitted a linear mixed model (LMM) as it follows:

m0 <- lmer(y ~ x + (x | group), data=df)

But, after looking at the residuals and the qqplot, I note that the LMM model violates the normality and homoscedastic assumptions. Also I observe that the higher the values of the fitted values, higher is the variance of residuals.

enter image description here enter image description here enter image description here

Alternatively, I try to fit a GLMM model with a Gamma family and log link:

m1 <- glmer(y ~ x + (x | group), data=df, family=Gamma(link='log'))

Now, the residuals show more homogeneity and the AIC value is considerably smaller:

enter image description here

enter image description here

m0  42159,54
m1  39429,50

What are the possible steps for a model validation in this case?

A qqplot for a gamma distribution family seems to be unfeasible.

Are there any statistical tests to check the validity of the model?

  • $\begingroup$ What is the experimental/study design here ? According to your model formula, I dont see how x is nested. The model says that y is nested in group, while x is a covariate with a fixed effect which also varies by group $\endgroup$ May 16 '19 at 16:00
  • $\begingroup$ I am trying to model the effect of the productivity (x) of a given person (group) on the quality (y) of her/his work. The (x | group) part of the model specifies a random intercept and slope for each one of these persons $\endgroup$
    – Seiji
    May 16 '19 at 16:07
  • $\begingroup$ Ok, so x is not nested. How are quality and productivity measured ? $\endgroup$ May 16 '19 at 16:14
  • $\begingroup$ Yes, you are right. Quality is measured as the average impact factor of all journals a person published in a year, and productivity as the count of works in the same year. To account the inflation over the years, we rescaled the measures by a deflation factor, so we can compare measures of different years. So the productivitity measure is not a count data anymore. $\endgroup$
    – Seiji
    May 16 '19 at 16:21
  • $\begingroup$ How, exactly, did you rescale the count variable ? $\endgroup$ May 16 '19 at 18:51

The shape of your residuals suggest that you have a bounded outcome variable $y$. Perhaps you could consider a Beta mixed effects or in case you only have a lower bound but no upper bound a mixed model for semi-continuous data.

Both are available in the GLMMadaptive package, e.g., check here and here.

  • $\begingroup$ Thank you for your response, Dimitris. I have a doubt: assuming that the family is a beta distribution isn't the same thing as assuming the $y_{i}$ to be distributed over the interval 0-1? And a semi-continuous data model supposes that the zero values are modeled one way and the rest of data is modeled another, which isn't the case, am I right? $\endgroup$
    – Seiji
    May 16 '19 at 18:39
  • $\begingroup$ If your outcome is defined in an interval $(a, b)$, you can transform it to get in the $(0, 1)$ interval where the Beta distribution is defined. Regarding the semi-continuous option, you’re right that this is the assumption. If you have a truly continuous outcome this makes sense because the probability that a continuous outcome takes a particular value is zero, but if you have too many zeros, this is violated. $\endgroup$ May 17 '19 at 20:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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