R and SAS code to fit a mixed-effects model instead of two-way ANOVA with repeated measures in both factors
Prism 8 introduces fitting a mixed-effects model to allow, essentially, repeated measures ANOVA with missing values. We provide R and SAS code to show your statistical consultants, so they can understand what Prism is doing. This example is for two-way ANOVA with repeated measures in both factors. Another FAQs covers one-way repeated measures ANOVA.
Download the data file used by R and SAS. anova2.rm.maxwell_12.1.csv
SAS Code
PROC IMPORT DATAFILE=REFFILE
DBMS=CSV
OUT=gsData;
GETNAMES=YES;
RUN;
CLASS A B S;
MODEL Y = A B A*B;
RANDOM Int A B / SUBJECT=S;
RUN;
R code
options(contrasts = c("contr.sum","contr.poly"))
noiseData<-read.csv("anova2.rm.maxwell_12.1.csv")
model<-lmer(Y ~ T*G + (1|Subject) + (1|T:Subject) + (1|G:Subject),
data = noiseData, REML = TRUE)
summary(model)
anova(model)