Two-way analysis of variance explained

In statistics, the two-way analysis of variance (ANOVA) is an extension of the one-way ANOVA that examines the influence of two different categorical independent variables on one continuous dependent variable. The two-way ANOVA not only aims at assessing the main effect of each independent variable but also if there is any interaction between them.

History

In 1925, Ronald Fisher mentions the two-way ANOVA in his celebrated book, Statistical Methods for Research Workers (chapters 7 and 8). In 1934, Frank Yates published procedures for the unbalanced case.[1] Since then, an extensive literature has been produced. The topic was reviewed in 1993 by Yasunori Fujikoshi.[2] In 2005, Andrew Gelman proposed a different approach of ANOVA, viewed as a multilevel model.[3]

Data set

Let us imagine a data set for which a dependent variable may be influenced by two factors which are potential sources of variation. The first factor has

I

levels and the second has

J

levels . Each combination

(i,j)

defines a treatment, for a total of

I x J

treatments. We represent the number of replicates for treatment

(i,j)

by

nij

, and let

k

be the index of the replicate in this treatment .

From these data, we can build a contingency table, where

ni+=

J
\sum
j=1

nij

and

n+j=

I
\sum
i=1

nij

, and the total number of replicates is equal to

n=\sumi,jnij=\sumini+=\sumjn+j

.

The experimental design is balanced if each treatment has the same number of replicates,

K

. In such a case, the design is also said to be orthogonal, allowing to fully distinguish the effects of both factors. We hence can write

\foralli,jnij=K

, and

\foralli,jnij=

ni+n+j
n
.

Model

Upon observing variation among all

n

data points, for instance via a histogram, "probability may be used to describe such variation".[4] Let us hence denote by

Yijk

the random variable which observed value

yijk

is the

k

-th measure for treatment

(i,j)

. The two-way ANOVA models all these variables as varying independently and normally around a mean,

\muij

, with a constant variance,

\sigma2

(homoscedasticity):

Yijk|\muij,\sigma2\overset{i.i.d.

} \; \mathcal(\mu_, \sigma^2).

Specifically, the mean of the response variable is modeled as a linear combination of the explanatory variables:

\muij=\mu+\alphai+\betaj+\gammaij

,

where

\mu

is the grand mean,

\alphai

is the additive main effect of level

i

from the first factor (i-th row in the contingency table),

\betaj

is the additive main effect of level

j

from the second factor (j-th column in the contingency table) and

\gammaij

is the non-additive interaction effect of treatment

(i,j)

for samples

k=1,...,nij

from both factors (cell at row i and column j in the contingency table).

Another equivalent way of describing the two-way ANOVA is by mentioning that, besides the variation explained by the factors, there remains some statistical noise. This amount of unexplained variation is handled via the introduction of one random variable per data point,

\epsilonijk

, called error. These

n

random variables are seen as deviations from the means, and are assumed to be independent and normally distributed:

Yijk=\muij+\epsilonijkwith\epsilonijk\overset{i.i.d.

} \mathcal(0, \sigma^2).

Assumptions

Following Gelman and Hill, the assumptions of the ANOVA, and more generally the general linear model, are, in decreasing order of importance:[5]

  1. the data points are relevant with respect to the scientific question under investigation;
  2. the mean of the response variable is influenced additively (if not interaction term) and linearly by the factors;
  3. the errors are independent;
  4. the errors have the same variance;
  5. the errors are normally distributed.

Parameter estimation

To ensure identifiability of parameters, we can add the following "sum-to-zero" constraints:

\sumi\alphai=\sumj\betaj=\sumi\gammaij=\sumj\gammaij=0

Hypothesis testing

In the classical approach, testing null hypotheses (that the factors have no effect) is achieved via their significance which requires calculating sums of squares.

Testing if the interaction term is significant can be difficult because of the potentially-large number of degrees of freedom.[6]

Example

The following hypothetical example gives the yields of 15 plants subject to two different environmental variations, and three different fertilisers.

Extra CO2Extra humidity
No fertiliser7, 2, 17, 6
Nitrate11, 610, 7, 3
Phosphate5, 3, 411, 4

Five sums of squares are calculated:

FactorCalculationSum

\sigma2

Individual

72+22+12+72+62+112+62+102+72+32+52+32+42+112+42

64115
Fertilizer × Environment
(7+2+1)2
3

+

(7+6)2
2

+

(11+6)2
2

+

(10+7+3)2
3

+

(5+3+4)2
3

+

(11+4)2
2
556.16676
Fertilizer
(7+2+1+7+6)2
5

+

(11+6+10+7+3)2
5

+

(5+3+4+11+4)2
5
525.43
Environment
(7+2+1+11+6+5+3+4)2
8

+

(7+6+10+7+3+11+4)2
7

519.26792
Composite
(7+2+1+11+6+5+3+4+7+6+10+7+3+11+4)2
15

504.61

Finally, the sums of squared deviations required for the analysis of variance can be calculated.

FactorSum

\sigma2

TotalEnvironmentFertiliserFertiliser × EnvironmentResidual
Individual6411511
Fertiliser × Environment556.166761-1
Fertiliser525.431-1
Environment519.267921-1
Composite504.61-1-1-11
Squared deviations136.414.66820.816.09984.833
Degrees of freedom141229

See also

References

Notes and References

  1. Yates . Frank . March 1934 . The analysis of multiple classifications with unequal numbers in the different classes . 2278459 . Journal of the American Statistical Association . 29 . 185 . 51–66 . 10.1080/01621459.1934.10502686.
  2. Fujikoshi . Yasunori . 1993 . Two-way ANOVA models with unbalanced data . Discrete Mathematics . 116 . 1 . 315–334 . 10.1016/0012-365X(93)90410-U . free .
  3. Gelman . Andrew . February 2005 . Analysis of variance? why it is more important than ever . The Annals of Statistics . 33 . 1 . 1–53 . math/0504499. 10.1214/009053604000001048 . 125025956 .
  4. Kass . Robert E . 1 February 2011 . Statistical inference: The big picture . . 26 . 1 . 1–9 . 10.1214/10-sts337. 21841892 . 3153074 . 1106.2895 .
  5. Book: Gelman . Andrew . Hill . Jennifer. Jennifer Hill . 18 December 2006 . Data Analysis Using Regression and Multilevel/Hierarchical Models . . 45–46 . 978-0521867061 .
  6. Yi-An Ko. September 2013 . Novel Likelihood Ratio Tests for Screening Gene-Gene and Gene-Environment Interactions with Unbalanced Repeated-Measures Data . Genetic Epidemiology . 37 . 6 . 581–591 . 10.1002/gepi.21744 . 23798480 . etal. 4009698.