R and SAS code to fit a mixed-effects model instead of one-way repeated measures ANOVA
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 one-way repeated measures ANOVA. Another FAQ covers two-way repeated measures ANOVA with repeated measures in both factors.
Download the data file used by R and SAS. Pinheiro_Bates.ergoStool.csv
SAS code
DBMS=CS
OUT=ergoStool;
GETNAMES=YES;
RUN;
PROC MIXED data=ergoStool METHOD=REML;
CLASS effort Type Subject;
MODEL effort=Type;
RANDOM Int / SUBJECT=Subject;
RUN;
R code
options(contrasts = c("contr.sum","contr.poly"))
ergoStoolData<-read.csv("Pinheiro_Bates.ergoStool.csv")
fm1Stool <- lmer(effort ~ Type + (1|Subject), data = ergoStoolData)
summary(fm1Stool)
anova(fm1Stool)
Source
J. Pinheiro, D. Bates, Mixed-Effects Models in S and S-PLUS, 2000, Section 1.2