Skip to content
Prev 174585 / 398506 Next

Syntax in lmer...

Dear Anne,

Is age a continuous or a categorical variable? If it is a continuous
variable, then I would add it to the fixed effects.

You have two options for the random effect: (Fertilier|Family/Species)
or (1|Family/Species) + (0 + Fertilizer|Family/Species). Both yield a
random intercept and a random slope along Fertilizer. But the main
difference is the correlation between the random effects. The first
model allows for correlation between the random effect and the random
slope. Whereas the second model implies that they are independent.

This is what I would do to test for the interaction.
#If age is categorical
M0 <- lmer(RGR ~ Fertilizer * Status + (1|Age) + (1|Family/Species) + (0
+ Fertilizer|Family/Species), data=rgr, REML =  TRUE)
M1 <- lmer(RGR ~ Fertilizer * Status + (1|Age) + (1|Family/Species),
data=rgr, REML =  TRUE)
anova(M0, M1)

#If age is continuous
M0 <- lmer(RGR ~ Fertilizer * Status + Age + (1|Family/Species) + (0 +
Fertilizer|Family/Species), data=rgr, REML =  TRUE)
M1 <- lmer(RGR ~ Fertilizer * Status + Age + (1|Family/Species),
data=rgr, REML =  TRUE)
anova(M0, M1)

HTH,

Thierry

PS. The R-Sig-mixed models mailing list is better suited for questions
on lme4.

------------------------------------------------------------------------
----
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature
and Forest
Cel biometrie, methodologie en kwaliteitszorg / Section biometrics,
methodology and quality assurance
Gaverstraat 4
9500 Geraardsbergen
Belgium 
tel. + 32 54/436 185
Thierry.Onkelinx at inbo.be 
www.inbo.be 

To call in the statistician after the experiment is done may be no more
than asking him to perform a post-mortem examination: he may be able to
say what the experiment died of.
~ Sir Ronald Aylmer Fisher

The plural of anecdote is not data.
~ Roger Brinner

The combination of some data and an aching desire for an answer does not
ensure that a reasonable answer can be extracted from a given body of
data.
~ John Tukey

-----Oorspronkelijk bericht-----
Van: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
Namens Anne Kempel
Verzonden: maandag 23 maart 2009 9:54
Aan: r-help at r-project.org
Onderwerp: [R] Syntax in lmer...

Sorry for bothering you - but I have a little problem. I`m completely 
new in R and trying to use lmer. That works, but I m not sure if my code

is right, so I would just like to get an opinion from the experts.

I have a Growthrate of plants (RGR
Fixed Factors: Fertilizer, Status (alien or native plants) and their 
interaction
Random Factors: Age is a covariable; than I have plantfamily and Species

nested within Family.
Now I want also to test for the interaction of Fertilizer with 
plantfamily and species. Did I do this the right way, and is the 0+ 
necessary?

model<-lmer(RGR~Fertilizer+Status+Fertilizer:Status+(1|Age)+(1|Family/Sp
ecies)+(0+Fertilizer|Family/Species),data=rgr)

I`m thankful for any comments!
anne