# Chapter 11 Nonparametric approaches to 1-way ANOVA problems

Non-parametric statistics had, for many decades, been a preferred choice when distributional assumptions are not met for parametric tests (normality assumption), along with scale transformation methods. Nonparametric methods employ a transformation of the DV to ranks and then inferences are made using the ranking values. For tests of group differences such as the independent samples situation (2 sample t-test), or a multiway oneway layout such as the 1way ANOVA models, the parametric tests are understood to be tests of hypotheses about population means. It is important to remember that for the non-parametric analogs, the hypotheses are “location” hypotheses, not narrowly tied to means and also not explicit hypotheses about medians, a mistake that is often made. These tests may also still be sensitive to assumptions regarding dispersion, so should not be considered as alternatives when the homogeneity of within-group variance assumptions are violated.

More recent developments such as permutation tests and bootstrapping are alternative ways of doing inferences when normality assumptions are violated. Their usage has increased, relative to the nonparametric tests, because of the change in computational power of modern computers. Robust methods are often combined with bootstrapping .

A good general reference for non-parametric methods is the textbook by Hollander, Wolfe, and Chicken (2013).

## 11.1 The Kruskal-Wallis Test for the 1way layout

The Kruskall-Wallis test is a well-accepted method for doing an omnibus 1way nonparametric analysis. It is implemented in several places in R, including this base system function, kruskal.test. The implementation uses the standard model formula approach and produces a test statistic that uses the Chi-squared distribution, where df are #groups minus one.

kruskal.test(hays$dv~hays$factora)
##
##  Kruskal-Wallis rank sum test
##
## data:  hays$dv by hays$factora
## Kruskal-Wallis chi-squared = 8.1309, df = 2, p-value = 0.01716

## 11.2 Follow ups to Kruskal

One method of following up an omnibus Kruskal-Wallis test is to compare pairs of groups using the Wilcoxon rank sum test (same as Mann-Whitney U test). This is somewhat like using multiple t-tests to follow up a 1way ANOVA, a method that is not recommended. However in the non-parametric situation this is one recommended approach, as long as corrections for error-rate inflation are employed. The pairwise.wilcox.test will do just such analyses of all possible pairs of groups. It implements the p.adjust method seen in an earlier section of this document, permitting p value adjustments for multiple comparison based Type I error inflation. The warning just means that the p values are approximated since the algorithm for handling ties produces an inability to produce exact calculations - and is an accepted outcome.

pairwise.wilcox.test(hays$dv,hays$factora, p.adjust.method="holm")
##
##  Pairwise comparisons using Wilcoxon rank sum test with continuity correction
##
## data:  hays$dv and hays$factora
##
##      control fast
## fast 0.056   -
## slow 0.030   0.447
##
## P value adjustment method: holm
                           # Adjusts p-values for multiple comparisons;
# See ?p.adjust for options

## 11.3 A test by Dunn for comparing pairs of groups

Alternatively the dunn.test function does both the omnibus test as a kruskal-wallis test and uses Dunn’s method of pairwise comparisons that also permits p-value adjustment for multiple comparisons. Note that the p values are not the same for the three comparisons as found above with pairwise.wilcox.test. This is because the Dunn test takes a slightly different approach. One tricky part of using dunn.test is that the returned p values are one-tailed and should be compared to the chosen alpha rate/2.

#library(dunn.test)
dunn.test(hays$dv, hays$factora, method="holm")      
##   Kruskal-Wallis rank sum test
##
## data: x and group
## Kruskal-Wallis chi-squared = 8.1309, df = 2, p-value = 0.02
##
##
##                            Comparison of x by group
##                                     (Holm)
## Col Mean-|
## Row Mean |    control       fast
## ---------+----------------------
##     fast |   2.647794
##          |    0.0122*
##          |
##     slow |   2.240441  -0.407353
##          |     0.0251     0.3419
##
## alpha = 0.05
## Reject Ho if p <= alpha/2
          # Adjusts p-values for multiple comparisons
# See ?dunnTest for other options for p value adjustments