15.4 Wicoxon Matched-Pairs Signed-Rank Test

Michael Sullivan

2023-08-30

Within Base R there is a built in function to complete a Wilcoxon test. This will follow Example 1 from Section 15.4. Enter the two samples of the data.

In this example, we are testing H_0: M_D = 0 versus H_1: M_D > 0.

WBA <- c(8.9, 6.3, 6.2, 7.2, 2.8, 3.3, 23.6, 6, 15.6, 5.2, 6.3, 10.1,4, 8.4)
MCD <- c(8.5, 7.6, 8.3, 10.4, 2.5, 2.6, 3.5, 4.7, 9,6, 5.6, 5, 4.4, 5.6)

To perform a Wicoxon Matched-Pairs Signed-Rank Test, use the wilcox.test function. The command paired = T must be included. The default hypothesis test is a two-tailed test. If the alternative is a right-tailed test, include alternative = ‘greater’; if the alternative is a left-tailed test, include alternative = ‘less’.

In this example, we have a right-tailed test.

wilcox.test(WBA, MCD, paired = T, alternative = 'greater')

## Warning in wilcox.test.default(WBA, MCD, paired = T, alternative = "greater"):
## cannot compute exact p-value with ties

##
##  Wilcoxon signed rank test with continuity correction
##
## data:  WBA and MCD
## V = 69, p-value = 0.1575
## alternative hypothesis: true location shift is greater than 0

The P-value is 0.1575.