[R-sig-ME] ar(1)
Paul Chatfield
p.s.chatfield at reading.ac.uk
Tue Jan 25 15:36:25 CET 2011
I have what I believe is a relatively straightforward problem. I am trying to move from SAS to R and have coded the following successfully in R:
proc mixed;
class name run exam;
model y= a b c/s;
random name;
random run(name);
run;
as ... mod<-lme(y ~ a + b + c, random=~1|name/run, na.action=na.omit)
However, when trying to introduce a correlation structure in SAS by altering the 2nd random statement to random run(name)/type=ar(1), differences then appear. I've tried coding this in R:
e2<-lme(y ~ a + b + c, random=~1|name/run, correlation=corAR1(form=~1|name/run), na.action=na.omit)
and the model runs fine, however the results are very different to what seems sensible to me and what SAS gives. I have attached the data if anyone wants to have a play with it, but I suspect it's my coding that's at fault. I've been using Pinheiro and Bates to get this far, but seem to have hit a wall here.
Any help would be much appreciated,
Paul
More information about the R-sig-mixed-models
mailing list