Solved – Dealing with heteroscedasticity and non-normality in a mixed model

heteroscedasticitylme4-nlmemixed modelnormality-assumption

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

EDIT

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:

resid

Best Answer

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