# Two-way analysis of variance

(Redirected from Two-way ANOVA)

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.

## HistoryEdit

In 1925, Ronald Fisher mentions the two-way ANOVA in his celebrated book from 1925, 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 setEdit

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 ${\displaystyle I}$  levels (${\displaystyle i\in \{1,\ldots ,I\}}$ ) and the second has ${\displaystyle J}$  levels (${\displaystyle j\in \{1,\ldots ,J\}}$ ). Each combination ${\displaystyle (i,j)}$  defines a treatment, for a total of ${\displaystyle I\times J}$  treatments. We represent the number of replicates for treatment ${\displaystyle (i,j)}$  by ${\displaystyle n_{ij}}$ , and let ${\displaystyle k}$  be the index of the replicate in this treatment (${\displaystyle k\in \{1,\ldots ,n_{ij}\}}$ ).

From these data, we can build a contingency table, where ${\displaystyle n_{i+}=\sum _{j=1}^{J}n_{ij}}$  and ${\displaystyle n_{+j}=\sum _{i=1}^{I}n_{ij}}$ , and the total number of replicates is equal to ${\displaystyle n=\sum _{i,j}n_{ij}=\sum _{i}n_{i+}=\sum _{j}n_{+j}}$ .

The experimental design is balanced if each treatment has the same number of replicates, ${\displaystyle 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 ${\displaystyle \forall i,j\;n_{ij}=K}$ , and ${\displaystyle \forall i,j\;n_{ij}={\frac {n_{i+}\cdot n_{+j}}{n}}}$ .

## ModelEdit

Upon observing variation among all ${\displaystyle n}$  data points, for instance via a histogram, "probability may be used to describe such variation".[4] Let us hence denote by ${\displaystyle Y_{ijk}}$  the random variable which observed value ${\displaystyle y_{ijk}}$  is the ${\displaystyle k}$ -th measure for treatment ${\displaystyle (i,j)}$ . The two-way ANOVA models all these variables as varying independently and normally around a mean, ${\displaystyle \mu _{ij}}$ , with a constant variance, ${\displaystyle \sigma ^{2}}$  (homoscedasticity):

${\displaystyle Y_{ijk}\,|\,\mu _{ij},\sigma ^{2}\;{\overset {i.i.d.}{\sim }}\;{\mathcal {N}}(\mu _{ij},\sigma ^{2})}$ .

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

${\displaystyle \mu _{ij}=\mu +\alpha _{i}+\beta _{j}+\gamma _{ij}}$ ,

where ${\displaystyle \mu }$  is the grand mean, ${\displaystyle \alpha _{i}}$  is the additive main effect of level ${\displaystyle i}$  from the first factor (i-th row in the contigency table), ${\displaystyle \beta _{j}}$  is the additive main effect of level ${\displaystyle j}$  from the second factor (j-th column in the contigency table) and ${\displaystyle \gamma _{ij}}$  is the non-additive interaction effect of treatment ${\displaystyle (i,j)}$  from both factors (cell at row i and column j in the contigency 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, ${\displaystyle \epsilon _{ijk}}$ , called error. These ${\displaystyle n}$  random variables are seen as deviations from the means, and are assumed to be independent and normally distributed:

${\displaystyle Y_{ijk}=\mu _{ij}+\epsilon _{ijk}{\text{ with }}\epsilon _{ijk}{\overset {i.i.d.}{\sim }}{\mathcal {N}}(0,\sigma ^{2})}$ .

## AssumptionsEdit

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 estimationEdit

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

${\displaystyle \sum _{i}\alpha _{i}=\sum _{j}\beta _{j}=\sum _{i}\sum _{j}\gamma _{ij}=0}$

## Hypothesis testingEdit

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]

## NotesEdit

1. ^ Yates, Frank (March 1934). "The analysis of multiple classifications with unequal numbers in the different classes". Journal of the American Statistical Association. American Statistical Association. 29 (185): 51–66. doi:10.1080/01621459.1934.10502686. JSTOR 2278459.
2. ^ Fujikoshi, Yasunori (1993). "Two-way ANOVA models with unbalanced data". Discrete Mathematics. Elsevier. 116 (1): 315–334. doi:10.1016/0012-365X(93)90410-U. Retrieved 19 June 2014.
3. ^ Gelman, Andrew (February 2005). "Analysis of variance? why it is more important than ever". The Annals of Statistics. 33 (1): 1–53. doi:10.1214/009053604000001048. Retrieved 19 June 2014.
4. ^ Kass, Robert E (1 February 2011). "Statistical inference: The big picture". Statistical Science. Institute of Mathematical Statistics. 26 (1): 1–9. arXiv:. doi:10.1214/10-sts337.
5. ^ Gelman, Andrew; Hill, Jennifer (18 December 2006). Data Analysis Using Regression and Multilevel/Hierarchical Models. Cambridge University Press. pp. 45–46. ISBN 0521867061.
6. ^ Yi-An Ko; et al. (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. doi:10.1002/gepi.21744. PMC . Retrieved 19 June 2014.