# [R] significance for a random effect in Mixed Model ANOVA

Nathaniel Street nathaniel.street at plantphys.umu.se
Wed Oct 17 09:36:56 CEST 2007

```Hi

Thanks for you reply. I wonder if you can help me further.

During my degree, I was taught that a factor should be specified as
random if it represents a sample of the total population. So in my case,
I need to test the factor genotype to see if genotypes are significantly
different from each other (I work on trees that can be clonally
replicated and so have biological replication at the level of genotype).
As genotypes in my experiment represent only a sample of the total
possible number of possible genotypes (which is effectively infinite), I
was taught to specify genotype as a random factor (but it is a factor
that I am explicitly interested in).

In the statistics package I have always used before (Minitab), you
specify your model (so maybe height~treatment:genotype to get main
factor effects and interaction) and then specify genotype as a random
factor and you get an answer.

If I read about the calculation of F for mixed models, the main
difference seems to be the denominator used. Here is an example from a
stats book for the case of a mixed model (type III) with Factor A as
fixed and Factor B as random

Factor A - factor A MS/AxB MS
Factor B - factor B MS/error MS
AxB interaction - AxB MS/error MS

So I could do that manually in R to recreate the same result that I get
in Minitab (but this just recreates the black box without me
understanding what the issue is).

I think to some extent I might be getting confused because the examples
of ANOVA calculation using lme in R concentrate on testing linear models
and I was taught ANOVA purely in a SS and MS context with no reference
to linear regression and I am finding it hard to think of my
requirements in relation to testing the intercept and slope etc
(obviously this is entirely my own limitation but any help would be
great as I don't have a mathematical background but clearly need to
learn some maths).

What I need to know from the test is whether treatment has an effect,
whether genotypes differ from each other and whether the difference
between genotypes is dependant on treatment (i.e. the interaction term).
In some cases, I also want to know if the replicates of a genotype
differ from each other (so replicate would be nested in genotype).
Normally I would presume that replicates of a genotype are just an
indication of noise but in some cases I specifically want to know if the
lack of a treatment or genotype effect is due to the fact that genotype
replicates are highly variable (which would be an indication of
phenotypic plasticity).

Can you tell me if my thinking that genotype should be a random factor
is a mistake on my part or if not, how to specify a model for treatment
and genotype with genotype as random and treatment as fixed and then how
to get the significance for both factors?

Thanks again

Nat Street

PS I use SS and MS for sum of squares and mean squares.

joris.dewolf at cropdesign.com wrote:
>
> Nathaniel,
>
> If you are interested in the particular subject, you should consider them
> as a fixed effect, which wil give you what you want.
>
> If your subjects are really random, the only thing you could be interested
> in, is whether considering the subjects as a grouping is helping you in
> improving your model. The logical way is to compare two models, one with
> and one without Subject, and compare their loglikelihood with the usual
> anova() function.
>
> Joris
>
>
>
>
>
>
>
>              "Nathaniel
>              Street"
>              <nathaniel.street                                          To
>              @plantphys.umu.se         r-help at r-project.org
>              >                                                          cc
>              Sent by:
>              r-help-bounces at r-                                     Subject
>              project.org               [R] significance for a random
>                                        effect in Mixed Model ANOVA
>
>              14/10/2007 23:48
>
>
>              nathaniel.street@
>              plantphys.umu.se
>
>
>
>
>
>
> In a number of cases I want to use mixed-model ANOVA tests where I am
> interested in whether both the fixed and random effects (and their
> interactions) are significant.
>
> If I use this example
>
>> library(nlme)
>> data(Orthodont)
>> anova(lme(distance ~ age + Sex, data = Orthodont, random = ~ 1))
>
> I get the result
>
>              numDF denDF  F-value p-value
> (Intercept)     1    80 4123.156  <.0001
> age             1    80  114.838  <.0001
> Sex             1    25    9.292  0.0054
>
> How do I also get a significance value for the random factor (Subject)?
>
> Incidentally, why does it seem that people are not generally interested in
> whether the random variables are different from each other? In the case of
> the Orthodont data (if there was replication at the Subject level i.e. if
> you could clone humans [as you can plants]), would it not be interesting
> to know if subjects (nested within sex) are different to each other as
> well as
> if there is an age effect (so to know if underlying genotype is also an
> important factor)?
>
> Thanks
>
> Nat Street
> --
> Nathaniel Street
> Umeå Plant Science Centre
> Department of Plant Physiology
> University of Umeå
> SE-901 87 Umeå
> SWEDEN
>
> email: nathaniel.street at plantphys.umu.se
> tel: +46-90-786 5477
> fax:  +46-90-786 6676
> www.upsc.se
> http://www.citeulike.org/user/natstreet
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>
>
>

--
Nathaniel Street
Umeå Plant Science Centre
Department of Plant Physiology
University of Umeå
SE-901 87 Umeå
SWEDEN

email: nathaniel.street at plantphys.umu.se
tel: +46-90-786 5477
fax:  +46-90-786 6676
www.upsc.se
http://www.citeulike.org/user/natstreet

```