24.2 Nonparametric ANOVA
When assumptions of normality and equal variance are not satisfied, we use nonparametric ANOVA tests, which rank the data instead of using raw values.
24.2.1 Kruskal-Wallis Test (One-Way Nonparametric ANOVA)
The Kruskal-Wallis test is a generalization of the Wilcoxon rank-sum test to more than two independent samples. It is an alternative to one-way ANOVA when normality is not assumed.
Setup
- a≥2 independent treatments.
- ni is the sample size for the i-th treatment.
- Yij is the j-th observation from the i-th treatment.
- No assumption of normality.
- Assume observations are independent random samples from continuous CDFs F1,F2,…,Fa.
Hypotheses
H0:F1=F2=⋯=Fa(All distributions are identical)Ha:Fi<Fj for some i≠j If the data come from a location-scale family, the hypothesis simplifies to:
H0:θ1=θ2=⋯=θa
Procedure
Rank all N=∑ai=1ni observations in ascending order.
Let rij=rank(Yij)
The sum of ranks must satisfy:∑i∑jrij=N(N+1)2
Compute rank sums and averages: ri.=ni∑j=1rij,ˉri.=ri.ni
Calculate the test statistic:
χ2KW=SSTRSSTON−1
where:
- Treatment Sum of Squares: SSTR=∑ni(ˉri.−ˉr..)2
- Total Sum of Squares: SSTO=∑i∑j(rij−ˉr..)2
- Overall Mean Rank: ˉr..=N+12
Compare to a chi-square distribution:
- For large ni (≥5), χ2KW∼χ2a−1.
- Reject H0 if: χ2KW>χ2(1−α;a−1)
Exact Test for Small Samples:
- Compute all possible rank assignments:
N!n1!n2!…na! - Evaluate each Kruskal-Wallis statistic and determine the empirical p-value.
- Compute all possible rank assignments:
24.2.2 Friedman Test (Nonparametric Two-Way ANOVA)
The Friedman test is a distribution-free alternative to two-way ANOVA when data are measured in a randomized complete block design and normality cannot be assumed.
Setup
- Yij represents responses from n blocks and r treatments.
- Assume no normality or homogeneity of variance.
- Let Fij be the CDF of Yij, corresponding to observed values.
Hypotheses
H0:Fi1=Fi2=⋯=Fir∀i(Identical distributions within each block)Ha:Fij<Fij′ for some j≠j′∀i
For location-scale families, the hypothesis simplifies to:
H0:τ1=τ2=⋯=τrHa:τj>τj′ for some j≠j′
Procedure
Rank observations within each block separately (ascending order).
- If there are ties, assign average ranks.
Compute test statistic:
χ2F=SSTRSSTR+SSEn(r−1)
where:
- Treatment Sum of Squares: SSTR=n∑(ˉr.j−ˉr..)2
- Error Sum of Squares: SSE=∑i∑j(rij−ˉr.j)2
- Mean Ranks: ˉr.j=∑irijn,ˉr..=r+12
Alternative Formula for Large Samples (No Ties):
If no ties, Friedman’s statistic simplifies to:
χ2F=[12nr(n+1)∑jr2.j]−3n(r+1)
Compare to a chi-square distribution:
- For large n, χ2F∼χ2r−1.
- Reject H0 if: χ2F>χ2(1−α;r−1)
Exact Test for Small Samples:
- Compute all possible ranking permutations: (r!)n
- Evaluate each Friedman statistic and determine the empirical p-value.