# StatisticsExcel_TwoWayANOVA

Introduction to Two-Way ANOVA

Two Way Analysis of Variance is a way of studying the effects of two factors separately (their main effects) and (sometimes) together (their interaction effect).

The main effect is the simple effect of a factor on a dependent variable. It is the effect of the factor alone averaged across the levels of other factors.

An interaction is the variation among the differences between means for different levels of one factor over different levels of the other factor.

A factor of an experiment is a controlled independent variable; a variable whose levels are set by the experimenter. A factor is a general type or category of treatments. Different treatments constitute different levels of a factor. For example, three different groups of runners are subjected to different training methods. The runners are the experimental units, the training methods, the treatments, where the three types of training methods constitute three levels of the factor 'type of training'.1

$SST = \sum \displaystyle \text{(Each data value)}^2 - \displaystyle \frac{\text{(Total sum)}^2}{N} = (88)^2 + \cdots + (93)^2 - \frac{(1085)^2}{12} = 80.92$

$SSA = \displaystyle \frac{\sum \text{Every level of factor A (12 cells)}}{\text{No. of terms in every level sum}} - \frac{\text{(Total sum)}^2}{\text{Total no. of obs.}} = \frac{(363)^2 + (359)^2 + (363)^2}{4} - \frac{(1085)^2}{12} = 2.67$

\begin{align}SSB = \frac{\sum \text{Every level of factor B}}{\text{Number of terms in every level sum}} - \frac{\text{(Total sum)}^2}{\text{Total no. of obs.}} = \frac{(334)^2 + (551)^2}{6} - \frac{(1085)^2}{12} = 24.08 \end{align}

A new term, SS of the interaction between A and B:

\begin{align} SSAB &= \frac{\sum \text{Every cell}}{\text{No. of terms in every cell}} - \frac{\text{(Total sum)}^2}{\text{Total no. of obs.}} - \text{SSA} - \text{SSB} \\ &= \frac{(177)^2 + \dots + (188)^2}{2} - \frac{(1085)^2}{12} - 2.67 - 24.08 = 44.67 \end{align}

Example

Suppose an experiment is going to be performed in space to test the influence of two factors on the luminous flux (lumens) of projection lamps:

A: Filling pressure (1000, 1100, 1200) psi
B: Cleaning gas (N2, ArN2)

The total number of experimental combinations is the product of the two factors' levels: $3 \times 2 = 6$. It was decided to take 2 replicates per cell, hence the total number of observations is $6 \times 2 = 12$.

 Filling pressure (A) (psi) 1000 1100 1200 SUM Cleaning gas (B) N2 88 89 91 91 87 88 534 Cell sum 177 182 175 ArN2 92 94 87 90 95 93 551 Cell sum 186 177 188 SUM 363 359 363 1085

$\text{(*) Significant variable}$
$F_{0.05, \ 2, \ 6} = 5.14$ $\; \; \; F_{0.05, \ 1, \ 6} = 5.99$
SOURCE SS DF MS F
Filling pressure (A) 2.67 2 1.34 0.85
Cleaning gas (B) 24.08 1 24.08 15.21*
Interaction AB 44.67 2 22.34 14.11*
Error 9.5 6 1.58
TOTAL 80.92 11

$F = 0.85$ is to be compared with $F_{0.05, \ 2, \ 6} = 5.14$. Since $0.85 \lt 5.14$, A is not significant i.e. it does not affect the luminous flux significantly.

$F = 15.21$ is to be compared with $F_{0.05, \ 1, \ 6} = 5.99$. Since $15.21 \gt 5.99$, B significantly affects the luminous flux.

$F = 14.11$ is to be compared with $F_{0.05, \ 2, \ 6} = 5.14$. Since $14.11 \gt 5.14$, the interaction effect is statistically significant.

When the interaction term is statistically significant, it’s necessary to investigate the effect of its factors that individually appeared to be non significant. In this case the effect of A should be investigated further. For this example the assumptions of normality and constant variance held. Since the order of the experiments isn’t given it’s not possible to test the independence of the residuals.

## Using Excel

Under Data, Data Analysis, select ANOVA: Two-Factor With Replication.

Enter the table (from B2 to E23 as the input range). Fill in 2 in Rows per sample and hit OK.

The conclusion is the same as the analysis previously done.

Excercise 2

One wishes to test the efficiency of two types of dust versus the dissipated power on 75 Watts incandescent lamps that are manufactured in two different shifts. Compute the corresponding ANOVA and the factorial plots.

Shift
1 2
Dust 1 56 58
1 65 60
2 72 63
2 78 67

Solution

Dust is statistically significant but not Shift or their interaction.