Benjamin Tyner
2006-Oct-30 17:20 UTC
[R] correlation structure in lme without random effect
I was hoping to fit along the lines of g<-gl(20,5) y<-runif(100) fit<-lme(fixed=y~g,correlation=corAR1(0,~1|g)) But I get the error "Incompatible formulas for groups in "random" and "correlation"" Any help would be greatly appreciated. Ben
You haven't specified a random equation. Try: fit<-lme(fixed=y~g,random=~1|g,correlation=corAR1(0,~1|g)) On 30/10/06, Benjamin Tyner <btyner at stat.purdue.edu> wrote:> I was hoping to fit along the lines of > > g<-gl(20,5) > y<-runif(100) > fit<-lme(fixed=y~g,correlation=corAR1(0,~1|g)) > > But I get the error "Incompatible formulas for groups in "random" and > "correlation"" > > Any help would be greatly appreciated. > Ben > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >-- ================================David Barron Said Business School University of Oxford Park End Street Oxford OX1 1HP
Douglas Bates
2006-Oct-30 17:56 UTC
[R] correlation structure in lme without random effect
On 10/30/06, Benjamin Tyner <btyner at stat.purdue.edu> wrote:> I was hoping to fit along the lines of > > g<-gl(20,5) > y<-runif(100) > fit<-lme(fixed=y~g,correlation=corAR1(0,~1|g)) > > But I get the error "Incompatible formulas for groups in "random" and > "correlation""Use the gls function in the nlme package to fit a model with correlation but no random effects specification.
Benjamin Tyner
2006-Oct-30 17:59 UTC
[R] correlation structure in lme without random effect
Thanks! Douglas Bates wrote:> On 10/30/06, Benjamin Tyner <btyner at stat.purdue.edu> wrote: >> I was hoping to fit along the lines of >> >> g<-gl(20,5) >> y<-runif(100) >> fit<-lme(fixed=y~g,correlation=corAR1(0,~1|g)) >> >> But I get the error "Incompatible formulas for groups in "random" and >> "correlation"" > > Use the gls function in the nlme package to fit a model with > correlation but no random effects specification.