I am trying to fit a mixed model (person as random effect) on data which has heteroscedasticity and non-normality. I log-transformed the Y-variable but it did not fix the problem. Normality and heterogeneity test and residuals plot with Y and log(Y) transformations are shown below. I will be grateful for any comments:

Shapiro-Wilk normality test

data:  resid
W = 0.4458, p-value < 2.2e-16

Bartlett test of homogeneity of variances

data:  resid and test$person
Bartlett's K-squared = 442.58, df = 8, p-value < 2.2e-16

Model Y not transformed: mod1

Model Y log transformed:enter image description here


I measure time of reaction (seconds) for 9 people in differents variables (some dummy variables, others are continuous). Below I show the model table, variance (residual and intercept), and plot the residuals for each person.

> person = pdLogChol(1) 
            Variance   StdDev   
(Intercept) 0.03864167 0.1965749
Residual    3.64527198 1.9092595

I think that the variance intercept is low and the residual variance is high. So person doesn't add variance in my results?? This is some results from my mixed model:

                         Value  Std.Error   DF   t-value p-value
    (Intercept)        0.5962784 0.12821014 2334  4.650789  0.0000
    dummy21           -0.8913013 0.24000557 2334 -3.713669  0.0002
    countback2        -0.0322950 0.00923287 2334 -3.497829  0.0005
    countspace2        0.8046936 0.18837571 2334  4.271748  0.0000
    action             0.0001028 0.00001484 2334  6.926781  0.0000
    pauseTime          0.0003853 0.00002582 2334 14.923275  0.0000
    Duration           0.0007586 0.00003112 2334 24.377110  0.0000
    Time2              0.0006724 0.00023442 2334  2.868323  0.0042 

Below I show residual normalised from model for each person:


  • 3
    $\begingroup$ Could you provide more context? Namely, what is your outcome variable, e.g., is it only positive, does it have bounds, is it perhaps discrete, and what is the model you’re fitting. $\endgroup$ Commented Apr 20, 2019 at 4:03
  • $\begingroup$ Why not use a nonlinear multilevel model? $\endgroup$
    – Peter Flom
    Commented Apr 20, 2019 at 10:34
  • $\begingroup$ Dimitris Rizopoulos, Thanks I add more information upper. $\endgroup$
    – Rodrigo
    Commented Apr 20, 2019 at 13:21
  • $\begingroup$ Thanks Peter Flom I will try to use nonlinear multilevel model $\endgroup$
    – Rodrigo
    Commented Apr 22, 2019 at 12:30

1 Answer 1


You could attempt to do a robust linear mixed model using package robustlmm. https://cran.r-project.org/web/packages/robustlmm/index.html

Or you can try it in lme4 with glmer() based on the appropriate family and link. https://www.rdocumentation.org/packages/lme4/versions/1.1-21/topics/glmer

  • $\begingroup$ Thanks Craig for your comment I am trying with glmer family(Gamma, link(log)). Do you know some book or link to fit this kind of models (assumptions, etc)... $\endgroup$
    – Rodrigo
    Commented Apr 25, 2019 at 21:07
  • $\begingroup$ What are the pros and cons of these two approaches though? I am facing a similar problem.. $\endgroup$
    – Effigy
    Commented Mar 25, 2022 at 10:50

Your Answer

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

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