References

  1. https://stats.stackexchange.com/questions/111010/interpreting-qqplot-is-there-any-rule-of-thumb-to-decide-for-non-normality/111013#111013 determining normality from qqplots
  2. https://stats.stackexchange.com/questions/101274/how-to-interpret-a-qq-plot
  3. https://stats.stackexchange.com/questions/61055/r-how-to-interpret-the-qqplots-outlier-numbers
  4. https://ase.tufts.edu/gsc/gradresources/guidetomixedmodelsinr/mixed%20model%20guide.html
  5. https://stats.stackexchange.com/questions/226946/r-lmer-vs-glmer
  6. https://www.r-bloggers.com/linear-mixed-models-in-r/
  7. https://stats.stackexchange.com/questions/283375/violated-normality-of-residuals-assumption-in-linear-mixed-model
  8. https://stats.stackexchange.com/questions/48671/what-is-restricted-maximum-likelihood-and-when-should-it-be-used
  9. https://stats.stackexchange.com/questions/77313/why-cant-i-match-glmer-family-binomial-output-with-manual-implementation-of-g
  10. https://support.sas.com/documentation/cdl/en/statug/63347/HTML/default/viewer.htm#statug_glimmix_a0000001433.htm For line about why crossed random effects can be handled with the Laplace approximation (nAHQ=1) but not with quadrature (nAHQ > 1); see code for glmer further below
  11. http://andrewgelman.com/2006/04/10/log_transformat/
  12. https://stats.stackexchange.com/questions/47840/linear-model-with-log-transformed-response-vs-generalized-linear-model-with-log to transform or not to transform, and choosing GLMM over LMM
  13. https://www.frontiersin.org/articles/10.3389/fpsyg.2015.01171/full#h8 see also supplementary material
  14. https://stats.stackexchange.com/questions/110004/how-scared-should-we-be-about-convergence-warnings-in-lme4 glmer model convergence error
  15. https://hlplab.wordpress.com/2009/05/14/random-effect-structure/
  16. https://hlplab.wordpress.com/2011/06/25/more-on-random-slopes/
  17. https://stats.stackexchange.com/questions/121504/how-many-random-effects-to-specify-in-lmer
  18. https://stats.stackexchange.com/questions/13166/rs-lmer-cheat-sheet

Dataset

str(BX_rt)
## 'data.frame':    2982 obs. of  6 variables:
##  $ subID  : Factor w/ 151 levels "sub01","sub04",..: 1 1 1 1 1 1 1 1 1 1 ...
##  $ groupID: Factor w/ 2 levels "AE","UAA": 2 2 2 2 2 2 2 2 2 2 ...
##  $ timeID : Factor w/ 2 levels "post","pre": 2 2 2 2 2 2 2 2 2 2 ...
##  $ trialID: int  2 12 31 58 65 72 87 99 104 118 ...
##  $ condnID: Factor w/ 1 level "BX": 1 1 1 1 1 1 1 1 1 1 ...
##  $ probeRT: int  309 360 329 764 338 410 398 344 330 377 ...
fit <- lmer(probeRT ~ groupID * timeID + (1|subID), data = BX_rt, REML = TRUE)
# REML = TRUE following the link and advice here: https://stats.stackexchange.com/questions/48671/what-is-restricted-maximum-likelihood-and-when-should-it-be-used (Reference #8)
qqpoints<- qqnorm(resid(fit))
qqline(resid(fit))

shapiro.test(resid(fit))
## 
##  Shapiro-Wilk normality test
## 
## data:  resid(fit)
## W = 0.93615, p-value < 2.2e-16
#non-normal residuals

Fails Shapiro-Wilkes test. Following advice from reference 13, we have the following GLMM model:

summary(GHQ <- glmer(probeRT ~ groupID + timeID + trialID+groupID*timeID*trialID + (1+groupID*timeID|subID) + (1|trialID), data = BX_rt,family = Gamma(link="identity"), nAGQ = 0)) 
## Generalized linear mixed model fit by maximum likelihood (Adaptive
##   Gauss-Hermite Quadrature, nAGQ = 0) [glmerMod]
##  Family: Gamma  ( identity )
## Formula: 
## probeRT ~ groupID + timeID + trialID + groupID * timeID * trialID +  
##     (1 + groupID * timeID | subID) + (1 | trialID)
##    Data: BX_rt
## 
##      AIC      BIC   logLik deviance df.resid 
##  38611.0  38731.0 -19285.5  38571.0     2962 
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -2.6155 -0.6209 -0.1684  0.4781  5.0706 
## 
## Random effects:
##  Groups   Name                 Variance  Std.Dev. Corr             
##  subID    (Intercept)          9.158e+03  95.6969                  
##           groupIDUAA           5.448e+01   7.3813 -1.00            
##           timeIDpre            9.351e+03  96.6995 -0.55  0.61      
##           groupIDUAA:timeIDpre 1.026e+04 101.3044  0.26 -0.28 -0.70
##  trialID  (Intercept)          7.119e+02  26.6824                  
##  Residual                      7.661e-02   0.2768                  
## Number of obs: 2982, groups:  subID, 151; trialID, 120
## 
## Fixed effects:
##                              Estimate Std. Error t value Pr(>|z|)    
## (Intercept)                  625.2191    17.1686  36.417   <2e-16 ***
## groupIDUAA                   -25.8609    22.5629  -1.146    0.252    
## timeIDpre                     -4.3390    20.7034  -0.210    0.834    
## trialID                        0.1308     0.1886   0.694    0.488    
## groupIDUAA:timeIDpre           5.2251    28.1233   0.186    0.853    
## groupIDUAA:trialID            -0.1569     0.2414  -0.650    0.516    
## timeIDpre:trialID             -0.3892     0.2479  -1.570    0.116    
## groupIDUAA:timeIDpre:trialID   0.3912     0.3451   1.133    0.257    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##               (Intr) grIDUAA tmIDpr trilID grpIDUAA:tmID grpIDUAA:trID
## groupIDUAA    -0.699                                                  
## timeIDpre     -0.609  0.464                                           
## trialID       -0.650  0.424   0.461                                   
## grpIDUAA:tmID  0.448 -0.601  -0.737 -0.339                            
## grpIDUAA:trID  0.435 -0.629  -0.360 -0.672  0.504                     
## tmIDpr:trID    0.424 -0.323  -0.708 -0.654  0.522         0.511       
## gIDUAA:ID:I   -0.304  0.440   0.509  0.469 -0.726        -0.699       
##               tID:ID
## groupIDUAA          
## timeIDpre           
## trialID             
## grpIDUAA:tmID       
## grpIDUAA:trID       
## tmIDpr:trID         
## gIDUAA:ID:I   -0.719

Interactions are not significant.