[R] 2-way Factorial with random factors

Daniel Lakeland dlakelan at street-artists.org
Fri Oct 26 20:04:07 CEST 2007


On Fri, Oct 26, 2007 at 10:02:23AM -0600, Eric Fuchs wrote:
> Hello:
> 
>   I am using R mainly on windows XP, version 2.5.  I´m a biologist,
> with a medium level statistics background.  I have a problem stating a
> two-way factorial design where both factors are random.  I´m using the
> lmer() function implemented in the Matrix package version 0.99.
> 
>   My design is as follows:  Two species were randomly selected from a
> total of 4 species.  This species are present in five different
> populations, again selected at random.  Five trees per species were
> selected randomly in each population and fruit number was estimated.
> The main question is to estimate variance components for species,
> population and their interaction.  Since both species are present in
> each population, I figured they are not nested, but are crossed.
> There is no fixed factor.
...
> fm3 <- lmer(fruto~(1|pop) + (1|spp) + (1|pop:spp), data=p1)

I am not an expert in this area, but I have been studying mixed models
off and on for a few months. I think you are misunderstanding the
terminology of fixed and random factors.

The most likely thing that I would be interested in in your case would
be, what is the effect of species overall, and then what are the
effects that population has on all species, and what are the effects
that population has for each given species...

The basic model would be that species is a controllable effect (fixed
effect) but that populations are essentially draws from random
variables (ie. soil conditions, weather conditions, etc are all
random)

fruto ~ spp + (1|pop) 

This says that there is something consistent about a given species
across populations, plus there is a random error for each
population. To move further along, you could add in a factor which
includes the interaction of species and population.

there are 10 trees that you looked at in each population so the
(1|pop) term is estimated from those 10 trees. You can also split the
random component by spp and pop

fruto ~ spp + (1|pop) + (1|pop:spp)

this says that not only is there an effect that is specific to the
average of a population, but there is an effect that is specific to
the difference between species in that population.

It is sometimes useful to think of causal issues as a way to describe
the models you want to fit, so in this case we think of a particular
soil and weather and soforth causing a deviation from the trend, and
we think of that particular soil and weather also causing a deviation
from the between species trend in the last model.

As I say, I'm not an expert in this field, so I would be very glad if
someone would correct any mistakes I have made here.

-- 
Daniel Lakeland
dlakelan at street-artists.org
http://www.street-artists.org/~dlakelan



More information about the R-help mailing list