[R] PROC MIXED vs. lme()
Manuel A. Morales
Manuel.A.Morales at williams.edu
Tue Dec 9 15:48:09 CET 2003
I'm trying to learn how to do a repeated measures ANOVA in R using lme().
A data set that comes from the book Design and Analysis has the following
structure: Measurements (DV) were taken on 8 subjects (SUB) with two
experimental levels (GROUP) at four times (TRIAL).
In SAS, I use the code:
PROC MIXED DATA=[data set below];
CLASS sub group trial;
MODEL dv = group trial group*trial;
REPEATED trial / SUBJECT=sub TYPE=CS;
run;
which gives the results:
Tests of Fixed Effects
Source NDF DDF Type III F Pr > F
GROUP 1 6 2.51 0.1645
TRIAL 3 18 22.34 0.0001
GROUP*TRIAL 3 18 0.58 0.6380
In R, I'm trying the code:
results.cs <- lme(DV ~ factor(GROUP)*factor(TRIAL), data=[data set below],
random= ~factor(TRIAL)|SUB, correlation=corCompSymm() )
anova(results.cs)
which gives the results:
numDF denDF F-value p-value
(Intercept) 1 18 3383.953 <.0001
factor(GROUP) 1 6 4.887 0.0691
factor(TRIAL) 3 18 239.102 <.0001
factor(GROUP):factor(TRIAL) 3 18 1.283 0.3103
Why are these results different? I'm a newbie to R, have the book "Mixed
Effects Models in S and S-Plus", but can't seem to get this analysis to
work. Any suggestions?
Thanks!
Manuel
Data:
SUB GROUP DV TRIAL
1 1 3 1
1 1 4 2
1 1 7 3
1 1 3 4
2 1 6 1
2 1 8 2
2 1 12 3
2 1 9 4
3 1 7 1
3 1 13 2
3 1 11 3
3 1 11 4
4 1 0 1
4 1 3 2
4 1 6 3
4 1 6 4
5 2 5 1
5 2 6 2
5 2 11 3
5 2 7 4
6 2 10 1
6 2 12 2
6 2 18 3
6 2 15 4
7 2 10 1
7 2 15 2
7 2 15 3
7 2 14 4
8 2 5 1
8 2 7 2
8 2 11 3
8 2 9 4
More information about the R-help
mailing list