15.3 – Wilcoxon signed rank test

Introduction

When experimental units are repeated or paired, they lack independence and evaluating any difference between paired groups without accounting for the association between the repeat measures or between the pairs of related subjects would lead to incorrect inferences. A familiar pairing of experimental units occurs in clinical observational research in which control subjects and treatment subjects are matched by many characteristics.

In such cases, the parametric paired t-test would be used to evaluate inferences about the differences between repeat measures or between treatment and matched control subjects for some measured outcome. A nonparametric alternative to the paired t-test is the Wilcoxon signed rank test, also called paired Wilcoxon test.

Another common example of paired sampling units would be that individuals are measured more than once for the same character or feature. For example, Chapter 10.3 we presented results of running pace in minutes to complete the race of 15 women for repeated trials (different years) at a 5K race held annually in Honolulu (Table 1).

Table 1. 5K repeat measures running data from Chapter 10.3

ID

Race 1

Race 2

1

15.28

15.61

2

11.22

11.19

3

8.80

9.14

4

8.88

5.46

5

9.81

10.50

6

6.12

5.69

7

8.31

8.71

8

6.26

7.42

9

17.16

16.41

10

16.23

15.82

11

5.90

7.12

12

8.31

10.48

13

5.93

8.64

14

10.54

5.99

15

9.53

8.69

To get the paired Wilcoxon test in R Commander, select Rcmdr: Statistics → Nonparametric tests → Paired Wilcoxon Test 

R Commander paired Wilcoxon test menu (aka Wilcoxon signed rank sum test). Rcmdr version 2.7.

Figure 1. R Commander paired Wilcoxon test menu (aka Wilcoxon signed rank sum test). Rcmdr version 2.7.

Select first variable (e.g., Race1), second variable (e.g., Race2). Next, select Options tab and set null hypothesis. Accept defaults (Fig. 2).

R Commander Options, select null hypothesis.

Figure 2. R Commander Options, select null hypothesis.

For the nonparametric paired Wilcoxon test we choose among the options to set our conditions; from the context menu a two-tailed test and we elect to use the defaults for the tests and calculations of P-values.

The results, copied from the Output window, are shown below. The calculation of the Wilcoxon test statistic (V) is straightforward, involving summing the ranks. Obtaining the P-value of the test of the null is a bit more involved as it depends on permutations of all possible combinations of differences. For us, R will do nicely with the details, and we just need to check the P-value.

with(repeat15_banana5K, wilcox.test(Race.1, Race.2, alternative='two.sided', paired=TRUE))
# median difference
[1] -0.3313126

Wilcoxon signed rank exact test
data: Race.1 and Race.2
V = 58, p-value = 0.9341
alternative hypothesis: true location shift is not equal to 0

End R output

Here, we see that the median difference is small (-0.33), and the associated P-value is 0.93. Thus, we failed to reject the null hypothesis and should conclude that there was no difference in median running pace during the first and second trials.

Note that this is the same general conclusion we got when we ran a paired t-test on this data set: no difference between day one and day two.

R code

example.ch10.3 <- read.table(header=TRUE, text = "
ID Race1 Race2
1 15.28 15.61
2 11.22 11.19
3 8.80 9.14
4 8.88 5.46
5 9.81 10.50
6 6.12 5.69
7 8.31 8.71
8 6.26 7.42
9 17.16 16.41
10 16.23 15.82
11 5.90 7.12
12 8.31 10.48
13 5.93 8.64
14 10.54 5.99
15 9.53 8.69
")

Questions

  1. This question lists all fourteen statistical tests we have been introduced to so far
    a. Mark yes or no as to whether or not the test is a parametric test
    b. Identify the nonparametric test(s) with their equivalent parametric test(s). If there are no equivalency, simply write “none.”

Parametric test?
Yes/No

If nonparametric, write the number(s) of the tests that the nonparametric test serves as an alternate for

1. ANOVA by ranks

2. Bartlett Test

3. Chi-squared contingency table

4. Chi-squared goodness of fit

5. Fisher Exact test

6. Independent sample T-test

7. Kruskal-Walis test

8. Levene Test

9. One-sample T-test

10. One-way ANOVA

11. Paired T-test

12. Shapiro-Wilks test

13. Tukey posthoc comparisons

14. Welch’s test


Chapter 15 contents