[R-sig-ME] Question regarding lme mixed model, error in case 1, not in case 2

Petter Hedberg phedberg at biol.uw.edu.pl
Wed Mar 21 14:26:38 CET 2012


Hi all subscribing to the r-sig-mixed-model list.
I have questions regarding the model I use, weather it makes sense, and why
I receive an error message in case 1 but not in case 2. It is a repeated
measure experiment.

The experiment consists of two fields, that are divided up in stripes were
every 2nd stripe has been treated with hay-transfer and every 2nd is a
control were no hay transfer has been conducted.
In each stripe 2 permanent plots of 2 m x 2 m were placed out, and
vegetation monitored for three years. Due to that there are differences in
elevation between the plot, each plots elevation has been measured.

The Explanatory variables I have is then Year (2009,2010,2011),Treatment
(Hay/No Hay), and (Elevation).
The response variables are % cover of different vegetation groups.
If I take the vegetation group sedges as an example.

Case 1: mydata<-lme(Sedges~as.factor(Year)*Treatment*Elevation) gives me
this error message

"Error in getGroups.data.frame(dataMix, groups) :
  Invalid formula for groups"

If I however include Site Number (There are 2 sites, with identical design)
I don´t get any error message at all.
Including it as a random is in my opinion not wrong, but not necessary for
this experiment.


Case 2:
mydata<-lme(Sedges~as.factor(Year)*Treatment*Elevation,random=~1|SiteNumber)

Would greatly appreciate any help on this issue.

Best regards, Petter Hedberg




More information about the R-sig-mixed-models mailing list