[R] Mixed Model notation SAS -> R
Jörg Trojan
joerg.trojan at osi.uni-mannheim.de
Thu May 11 13:35:09 CEST 2006
Dear experts,
I'm trying to transfer a mixed model developed in SAS to R. This it what
it looks like in SAS:
proc mixed method=ml;
class a b c subj;
model y = a|b|c;
repeated /subject=subj type=ar(1);
I tried something like this in R:
mixed <- lme(y ~ a + b + c + a*b + a*c + b*c + a*b*c,
random = ~ 1 | subj,
correlation = corAR1(form = ~ 1 | subj)
na.action = na.omit, method = "ML")
When I do an anova(mixed) the denomniator DFs do not compare to the ones
SAS uses in calculating Type III results, In R a common, quite high
(close to the total number of observations) denominator DF value is used
for all effects, while SAS seems to calculate the DFs directly from the
number of class categories. So obviously I have to specify my random
effects in R differently, but I don't know how...
Any hint on what I'm doing wrong is very much appreciated.
Thanks,
Jörg
P.S. I have the Mixed Model book by Pinheiro and Bates here with me in
case you can direct me to a specific section explaining my problem.
More information about the R-help
mailing list