View Full Version : Help random factors in R


Campitor
10-26-2007, 08:13 AM
Hello All.

My first post here. I have been struggling with this for about a week now. I have a two factor anova, where both factors are random: fruit number is going to be determined on five randomly selected species, in two randomly selected populations; five maternal trees per species, per population are collected. The design is --IMHO-- no nested, since species 1 is found both in pop1 and in pop2. I'm interested in estimating variance components for 'pop', 'mother' and the interaction. The interaction is actually one o the most important things to estimate.

I've been trying to estimate the variance components from R with lmer, but have been unable to do so. In the process, I've managed to confuse myself regarding the random factor formula...and now I have no idea what I'm doing. This is what I've done:

fm1 <- aov(fruto~mom*pop, data)

summary(fm1)

The previous code allows me to estimate the variance components by hand, using EMS procedure. Now the weird stuff:

library(Matrix)

fm2 <- lmer(fruto~(1|mom)+(1|pop)+(1|mom:pop), data)

Various error messages stating that the interaction's variance component is nearly zero.

The summary from fm2 is nowhere near what it should be.

I've been reading a lot of forums, specially this one:
http://tolstoy.newcastle.edu.au/R/help/05/01/11297.html

and have come to the conclusion, that I need a fixed factor for the hole thing to work. Do I have to create a dummy one?
Can I do without a fixed factor ?
I'm afraid to post in R-help, but I need to do this in R.


Can someone please help me???

Camp

Mike White
11-01-2007, 04:50 AM
I cannot offer much specific help on this but have you tried looking at the 'Contributed Documentation' at http://cran.r-project.org/other-docs.html

There are lots of examples of using formulas in aov and lm which may help solve your problem.