Analysis of Variance (ANOVA) / Kruskal-Wallis Tests for Comparison of Groups

Background Information

Analysis of Variance (ANOVA) analyzes numerical data sampled from two or more populations, such as well-groupings. When data is assumed to be normally distributed, a traditional parametric ANOVA can be performed to initially determine if there are any significant differences between any groups. When a normal distribution cannot be assumed, then a non-parametric ANOVA, a Kruskal-Wallis test, can be performed. Both ANOVA and Kruskal-Wallis are common statistical methods and appear in many statistical textbooks, for example, Devore, 1991, pages 371-396, (ANOVA) and 623-625 (Kruskal-Wallis).

For both tests, the null hypothesis, \( H_0 \), is that the groups have equal means, and the alternative hypothesis, \( H_a\), is that at least two groups have different means.

ANOVA for Normally Distributed Data

ANOVA in VSP is intended to analyze groups which will typically vary in size. Therefore the method in VSP is designed to account for when group sizes may be unequal (Devore, 1991, pages 390-391) as opposed to other ANOVA methods which require that group sizes be equal. Let \( J_1, J_2, ..., J_I \) denote the sizes of the \(I\) groups. Then the ANOVA can be represented in the following table and uses the subsequent calculations.

Source of Variation

Degrees of freedom

Sum of Squares

Mean Square

Test Statistic

Groups (or Treatments)

\(I-1\)

\(\text{SSTr}\)

\(\text{MSTr} = \text{SSTr}/(I-1)\)

\(F = \text{MSTr}/\text{MSE}\)

Error

\(n-I = \displaystyle\sum(J_{i-1}-1)\)

\(\text{SSE}\)

\(\text{MSE} = \text{SSE}/(n-I)\)

 

Total

\(n-1\)

\(\text{SST}\)

 

 

 

$$  SST = \displaystyle\sum_{i=1}^I \displaystyle\sum_{j=1}^{J_i} (X_{ij} - \bar X_{..} )^2 = \displaystyle\sum_{i=1}^I \displaystyle\sum_{j=1}^{J_i} X_{ij}^2 - \frac{1}{n} X_{..}^2 $$

$$  SSTr = \displaystyle\sum_{i=1}^I \displaystyle\sum_{j=1}^{J_i} (\bar X_{i \bullet} - \bar X_{..} )^2 = \displaystyle\sum_{i=1}^I \frac{1}{J_i} X_{i \bullet}^2 - \frac{1}{n} X_{..}^2 $$

$$  SSE = \displaystyle\sum_{i=1}^I \displaystyle\sum_{j=1}^{J_i} ( X_{ij} - \bar X_{i \bullet} )^2 = SST - SSTr $$

$$ X_{i \bullet} = \displaystyle\sum_{j=1}^{J_i} x_{ij} $$

$$ X_{..} = \displaystyle\sum_{i=1}^I \displaystyle\sum_{j=1}^{J_i} x_{ij} $$

$$ n = \displaystyle\sum_{i=1}^I J_i $$

The F-statistic is compared against an F-distribution with \( I - 1\) and \( n - I \) degrees of freedom to determine if it is statistically significant (\( F > F_{ \alpha , I-1, n-I} \)).

Multiple Comparison Tests

When ANOVA is performed assuming a normal distribution, and the F-test is statistically significant, a multiple comparison procedure is applied to compare each possible pair of groups. The method implemented in VSP is a modification of Tukey's procedure with changes made to account for having groups of unequal sizes, and is described in Devore, 1991, pages 391-392 and Miller, 1986. For each pair of groups \( i \) and \( j \), a critical value is computed:

$$ w_{ij} = Q_{\alpha , I, n-1} \sqrt{ \frac{MSE}{2} \Big( \frac{1}{J_i} + \frac{1}{J_j}\Big)} $$

Note that \( Q\) is the Studentized range distribution. If the differences in the group means exceeds the critical value, then the pair of groups are significantly different.

Kruskal-Wallis Test

When data cannot be assumed to be normally distributed, the Kruskal-Wallis test can be used. Where \( N = \displaystyle\sum J_i \), all observations from all groups are ranked from \(1\) (smallest) to \(N\) (largest) with ties having the average of the applicable ranks. For example, if the 6th through 9th smallest values are tied, use the average of the ranks which is 7.5. Let the rank of the \( j^{th}\) observation of the \(i^{th}\) group be denoted as \(R_{ij} \) . Then the test statistic, \(K\), is computed as follows:

$$ K = \frac{12}{N(N-1)} \displaystyle\sum_{j=1}^I J_i \left( \bar R_{i \bullet} - \frac{N+1}{2} \right)^2 = \frac{12}{N(N-1)} \displaystyle\sum_{i=1}^I \frac{R_{i \bullet}^2}{J_i} - 3(N+1) $$

\(H_0\) is rejected if \( K \) is greater than \(K_{\alpha , I-1} \) which uses the chi-squared distribution.

References:

Devore, J. L., 1991. Probability and Statistics for Engineering and the Sciences, Belmont, CA, Wadsworth, Inc.

Miller, R.G. 1986. Beyond ANOVA: The Basics of Applied Statistics, New York, Wiley.