[R] main effect & interaction in 2-way ANOVA

Prof Brian Ripley ripley at stats.ox.ac.uk
Fri Feb 25 08:58:59 CET 2005


On Thu, 24 Feb 2005, array chip wrote:

> I am just a little confused of mian effect in the
> analysis of variance (ANOVA) when you include or do
> not include an interaction term. Let's assume a simple
> case of 2-way ANOVA with 2 factors A and B, each with
> 2 levels. If it shows that main effect for A is
> significant when the interaction between A and B is
> NOT included, and the main effect for A is NOT
> significant when the interaction is included, what
> simply does this difference mean? I understand that
> main effect for A generally means averaging over
> levels of B,

Not in the presence of an interaction, with R's default coding.

  is this explanation for the situation
> when interaction is included or is not included or is
> irrelavant?
>
> And if my interest is in the main effect of A, in the
> above senario, should I include the interaction (thus
> lose the significance) or not include the interaction
> (thus keep my significance)?

In R's default coding you are being told:

1) That the effect of A in the base level of B is not significant
2) There is a significant difference between the effect of A at the
two levels of B.

So, probably, A has no effect at the base level of B and an effect at the 
other level.  You may or may not be interested in the effect of A averaged 
over the two levels of B.


Note that R's default coding is unusual, and using Helmert contrasts will
give results which are easier to interpret from conventional accounts.

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595




More information about the R-help mailing list