Chapter 5 Mixed Models

5.1 Linear Mixed Models

The example is based on data from an Experiment performed by Freeman, Heathcote, Chalmers, and Hockley (2010). In the example a simplified analysis of the data is performed, using only Task and Stimulus as fixed factors and stimulus by subject as random effect.

5.1.1 Results Overview

Table 5.1: Result Overview Linear Mixed Model
JASP SPSS SAS Minitab R
F(Task) 15.0731 15.075 15.07 15.08 15.07
F(Stimulus) 88.7032 88.716 88.70 88.72 88.70
F(Task X Stimulus) 37.8429 37.846 37.84 37.85 37.84

5.1.2 JASP

\label{fig:lmmJASP}JASP Output for Linear Mixed Model

Figure 5.1: JASP Output for Linear Mixed Model

5.1.3 SPSS

DATASET ACTIVATE DataSet1.
MIXED rt BY task stimulus WITH NumID
  /CRITERIA=DFMETHOD(SATTERTHWAITE) CIN(95) MXITER(100) MXSTEP(10) SCORING(1) 
    SINGULAR(0.000000000001) HCONVERGE(0, ABSOLUTE) LCONVERGE(0, ABSOLUTE) PCONVERGE(0.000001, ABSOLUTE)    
  /FIXED=task stimulus task*stimulus | NOINT SSTYPE(3)
  /METHOD=REML
  /RANDOM=INTERCEPT stimulus | SUBJECT(NumID) COVTYPE(VC).
\label{fig:lmmSPSS}SPSS Output for Linear Mixed Model

Figure 5.2: SPSS Output for Linear Mixed Model

5.1.4 SAS

proc mixed;
class Task Stimulus;
model rt = Task Stimulus Task*Stimulus / ddfm=satterth;
random intercept Stimulus / type=un subject=NumID g;
run;
\label{fig:lmmSAS}SAS Output for Linear Mixed Model

Figure 5.3: SAS Output for Linear Mixed Model

5.1.5 Minitab

\label{fig:lmmMinitab}Minitab Output for Linear Mixed Model

Figure 5.4: Minitab Output for Linear Mixed Model

5.1.6 R

#install.packages("afex")
library("afex")
## Loading required package: lme4
## Loading required package: Matrix
## ************
## Welcome to afex. For support visit: http://afex.singmann.science/
## - Functions for ANOVAs: aov_car(), aov_ez(), and aov_4()
## - Methods for calculating p-values with mixed(): 'S', 'KR', 'LRT', and 'PB'
## - 'afex_aov' and 'mixed' objects can be passed to emmeans() for follow-up tests
## - NEWS: emmeans() for ANOVA models now uses model = 'multivariate' as default.
## - Get and set global package options with: afex_options()
## - Set orthogonal sum-to-zero contrasts globally: set_sum_contrasts()
## - For example analyses see: browseVignettes("afex")
## ************
## 
## Attaching package: 'afex'
## The following object is masked from 'package:lme4':
## 
##     lmer
set_sum_contrasts() ## not strictly necessary
## setting contr.sum globally: options(contrasts=c('contr.sum', 'contr.poly'))
### but always a good idea
m1 <- mixed(rt ~ task*stimulus +
              (stimulus|id), data = LMM.data, method="S")
m1
## Mixed Model Anova Table (Type 3 tests, S-method)
## 
## Model: rt ~ task * stimulus + (stimulus | id)
## Data: LMM.data
##          Effect       df         F p.value
## 1          task 1, 42.98 15.07 ***   <.001
## 2      stimulus 1, 42.89 88.70 ***   <.001
## 3 task:stimulus 1, 42.89 37.84 ***   <.001
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1

5.1.7 Remarks

All differences in results between the software are due to rounding.

5.1.8 References

Freeman, E., Heathcote, A., Chalmers, K., & Hockley, W. (2010). Item effects in recognition memory for words. Journal of Memory and Language, 62(1), 1-18.