A while ago I asked for assistance in fitting a nested 3-way mixed effects
model ANOVA using splus. This proved to be quite a difficult task as I received
numerous replies, and entered into corredpondance with a number of people,
however none of us could figure out the correct syntax. (Although James Roger
came close, thanks for the help)
I finally contacted Tim Keighley at splus technical assistance who sent me
the following solution which was provided by Krista Kilmer of Insightful.
(thanks to both Tim and Krista if they're out there).
I have only one problem with the solution they sent, I don't fully
understand how Splus uses the grouping variables to define the correct model. I
can't find any documentation that deals with this method of using lme, can
someone suggest some please?
"My understanding of the model (which may be incorrect) is that he wants
two random effects, one associated with site nested within River and the
other to site nested within River and Time. The way the lme syntax is set
up,
he will need to specify grouping variables that can be associated
with
these
nested levels to be able to specify the correct random
effects model. Here
is
a suggestion (assuming his data.frame is called
"data"):
1) first create additional grouping variables
> data$RiverSite <- factor(paste(data$River, data$Site, sep = "/"))
> data$TimeRiverSite <- factor(paste(data$Time, data$RiverSite, sep =
"/"))
2) then fit the model with the desired random effects (assuming that
the
intended fixed effects are Time, River and Time:River)
> z <- lme(Nitrogen ~ Time * River, data = "" random=~1 |
RiverSite/TimeRiverSite) .
Christopher G Howden
Statistical Ecologist
Department of Land and Water
Conservation
(Work) 02 9895 7130
(Fax) 02 9895
7867
(Mob) 0410 689 945