Thanks for the help provided to fit the model. I still have two questions:
1) What is the syntax for nested fixed and random factors. I have tried
using the %in% operator but it does not work. The model I want to fit would
be as follow:
lmer 1 <- lmer(Growing ~ Seed + Species%in%Seed + Treatment +
(1|Block%in%Treatment), data)
2) Seed, Species and Treatment are intra-subject factors. This means that an
ANOVA of repeated measure should apply here. How should this be specified in
the model? Or should I assume that this is incorporated by specifying the
Block as a random factor?
All the best,
Luis
Luis Cayuela
Departamento de Ecología
Universidad de Alcalá
Crta. de Barcelona km. 33,600
E-28871 Alcalá de Henares
Madrid
España
Tlf: (+0034) 918856407
Fax: (+0034) 918854929
----- Original Message -----
From: "Douglas Bates" <[EMAIL PROTECTED]>
To: "Luis Cayuela" <[EMAIL PROTECTED]>
Cc: <r-help@r-project.org>
Sent: Thursday, May 15, 2008 5:22 PM
Subject: Re: [R] mixed effects models with nested factors
On Thu, May 15, 2008 at 9:22 AM, Luis Cayuela <[EMAIL PROTECTED]> wrote:
Hi everybody,
I am trying to fit a model with the lmer function for mixed effects. I
have an experimental design consisting of 5 field plots. Each plot is
divided in 12 subplots where the influence of three factors on the growing
of tree seedlings is tested: (1) seed (1 = presence; 0 = absence); (2)
seedling species (oak holm vs. pine); (3) treatment (three different
treatments). In each of these subplots we planted 13 seedlings. Therefore
I would have a model with three fixed factors and one random factor (a
block?). If I´m not wrong the model would be as follows:
model2 <- lmer(Growing ~ Seed + Species + Treatment +(Seed + Species +
Treatment|Block), data)
That's unlikely. This specification would fit 5 fixed effects
parameters and 5, possibly correlated, random effects for each level
of the Block factor. This would require estimating a total of 15
variance-covariance parameters for the random effects from the 5
blocks.
Can you indicate how many random effects you expect to obtain and how
many variance-covariance parameters would be involved? For example, a
model with a simple random effect would be expressed as
lmer(Growing ~ Seed + Species + Treatment + (1|Block), data)
and would involve estimating the 5 fixed effects and one variance for
the random effects.
My first question is: if the three fixed factors occur within-subjects
(considering the plot as a subject), is the model correctly defined
(assuming no interactions)? Should I specify the model in some other way?
I second problem I had is that the factors are not crossed because some of
the seedling died during the experiment. This means that some factors are
nested. Specifically Species is nested within Seed and Block would be
nested within Treatment. I have tried to use the %in% specification for
nested designs but it does not work.
model2 <- lmer(Growing ~ Seed + Species%in%Seed + Treatment +(Seed +
Species + Treatment|Block%in%Treatment), data)
I get the following error:
Error en lmer(Growing ~ Seed + Species %in% Seed + Treatment + : ..
Leading minor of order 5 in downdated X'X is not positive definite
I would appreciate some help to fit this model.
Thanks to everybody,
Luis
______________________________________________
R-help@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.