# One Way Analysis of Variance

Menu location: **Analysis_Analysis of Variance_One Way**.

This function compares the sample means for k groups. There is an overall test for k means, multiple comparison methods for pairs of means and tests for the equality of the variances of the groups.

Consider four groups of data that represent one experiment performed on four occasions with ten different subjects each time. You could explore the consistency of the experimental conditions or the inherent error of the experiment by using one way analysis of variance (ANOVA), however, agreement analysis might be more appropriate. One way ANOVA is more appropriate for finding statistical evidence of inconsistency or difference across the means of the four groups.

One way ANOVA assumes that each group comes from an approximately normal distribution and that the variability within the groups is roughly constant. The factors are arranged so that experiments are columns and subjects are rows, this is how you must enter your data in the StatsDirect workbook. The overall F test is fairly robust to small deviations from these assumptions but you could use the Kruskal-Wallis test as an alternative to one way ANOVA if there was any doubt.

Numerically, one way ANOVA is a generalisation of the two sample t test. The F statistic compares the variability between the groups to the variability within the groups:

- where F is the variance ratio for the overall test, MST is the mean square due to treatments/groups (between groups), MSE is the mean square due to error (within groups, residual mean square), Y_{ij} is an observation, T_{i} is a group total, G is the grand total of all observations, n_{i} is the number in group i and n is the total number of observations.

Assumptions:

- random samples
- normally distributed observations in each population
- equal variance of observations in each population

- the homogeneity of variance option (marked as "Equality of variance tests (Levene, Bartlett)" in the ANOVA results window) can be used to test the variance assumption. The Shapiro-Wilk test can be used to look for evidence of non-normality. The most commonly unacceptable deviation from the assumptions is inequality of variance when the groups are of unequal sizes.

A significant overall test indicates a difference between the population means for the groups as a whole; you may then go on to make multiple comparisons between the groups but this "dredging" should be avoided if possible.

If the groups in this example had been a series of treatments/exposures to which subjects were randomly allocated then a two way randomized block design ANOVA should have been used.

__Example__

From Armitage and Berry (1994, p. 214).

Test workbook (ANOVA worksheet: Expt 1, Expt 2, Expt 3, Expt 4).

The following data represent the numbers of worms isolated from the GI tracts of four groups of rats in a trial of carbon tetrachloride as an anthelminthic. These four groups were the control (untreated) groups.

Expt 1 | Expt 2 | Expt 3 | Expt 4 |

279 | 378 | 172 | 381 |

338 | 275 | 335 | 346 |

334 | 412 | 335 | 340 |

198 | 265 | 282 | 471 |

303 | 286 | 250 | 318 |

To analyse these data in StatsDirect you must first prepare them in four workbook columns appropriately labelled. Alternatively, open the test workbook using the file open function of the file menu. Then select One Way from the Analysis of Variance section of the analysis menu. Select the columns marked "Expt 1", "Expt 2","Expt 3" and "Expt 4" in one action when prompted for data.

For this example:

__One way analysis of variance__

Variables: Expt 1, Expt 2, Expt 3, Expt 4

Source of Variation | Sum Squares | DF | Mean Square |

Between Groups | 27234.2 | 3 | 9078.066667 |

Within Groups | 63953.6 | 16 | 3997.1 |

Corrected Total | 91187.8 | 19 |

F (variance ratio) = 2.271163 P = .1195

The null hypothesis that there is no difference in mean worm counts across the four groups is held. If we had rejected this null hypothesis then we would have had to take a close look at the experimental conditions to make sure that all control groups were exposed to the same conditions.

__Technical validation__

The American National Institute of Standards and Technology provide Statistical Reference Datasets for testing statistical software (McCullough and Wilson, 1999; http://www.itl.nist.gov/div898/strd/). The results below for the SiResits data set are given to 12 decimal places, StatsDirect provides 15 decimal places of accuracy internally.

__One way analysis of variance__

Variables: Instrument 1, Instrument 2, Instrument 3, Instrument 4, Instrument 5

Source of Variation | Sum Squares | DF | Mean Square |

Between Groups | 0.0511462616 | 4 | 0.0127865654 |

Within Groups | 0.21663656 | 20 | 0.010831828 |

Corrected Total | 0.2677828216 | 24 |

F (variance ratio) = 1.180462374402 P = .3494