[R-sig-ME] ar(1) model
Paul Chatfield
p.s.chatfield at reading.ac.uk
Tue Jan 25 18:20:45 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 (and SAS output from these models) 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
-----Original Message-----
From: Kevin Wright [mailto:kw.stat at gmail.com]
Sent: 25 January 2011 16:56
To: Paul Chatfield
Subject: Re: [R-sig-ME] ar(1)
no data attached?
Also, you might add the SAS results, since people may not have SAS.
Kevin
On Tue, Jan 25, 2011 at 8:36 AM, Paul Chatfield
<p.s.chatfield at reading.ac.uk> wrote:
> 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
>
>
> _______________________________________________
> R-sig-mixed-models at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>
>
--
Kevin Wright
More information about the R-sig-mixed-models
mailing list