Re: [R] lme:correlationstructure AR1 and random factor

From: Ben Bolker <bbolker_at_gmail.com>
Date: Tue, 29 Mar 2011 21:32:31 +0000

yvonne fabian <yvo.fabian <at> gmx.de> writes:

>
> Dear helpers,
>
> I tried these models to run in the package nlme, but allways got the same
> error message...
>
> I have a correlation in 5 sessions within a field (n=12) with ten traps in
> one field.
>
> res2a <- lme(response~x+y+z+treatment),correlation =
> corARMA(form = ~ session|trapfield, p = 1, q = 0), random=~1|field,
> na.action=na.omit, data=plates, method="ML")
>
> res2a <- lme(response~x+y+z+treatment,correlation =
> corCAR1(form = ~ session|trapfield), random=~1|field, na.action=na.omit,
> data=plates, method="ML")
>
> Error: Incompatible formulas for groups in "random" and "correlation"
>
> What is the problem?

  lme() insists that the grouping variable for the random effects and for the correlation be the same. In your example they are "field" and "trapfield" respectively. (The error message seems pretty clear to me ...)
  You might want to:

  I don't know offhand of an R package that will allow you to fit the model you want (correlation within trap-field combinations, random effects across fields), but you might have some options/ get some ideas from posting to r-sig-mixed-models.   

  Ben Bolker



R-help_at_r-project.org 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. Received on Tue 29 Mar 2011 - 21:44:18 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 29 Mar 2011 - 22:20:25 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive