[R] mixed effects models with nested factors
Douglas Bates
bates at stat.wisc.edu
Thu May 15 17:22:09 CEST 2008
On Thu, May 15, 2008 at 9:22 AM, Luis Cayuela <luis.cayuela at uah.es> 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
>
> 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
> [[alternative HTML version deleted]]
>
>
> ______________________________________________
> 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.
>
>
More information about the R-help
mailing list