Rank tests

Wilcoxon Rank Sum Test

We learned how the sample mean and SD are susceptible to outliers. The
t-test is based on these measures and is susceptible as well. The
Wilcoxon rank test (equivalent to the Mann-Whitney test) provides an
alternative. In the code below, we perform a t-test on data for which
the null is true. However, we change one sum observation by mistake
in each sample and the values incorrectly entered are different. Here
we see that the t-test results in a small p-value, while the Wilcoxon
test does not:

W is the sum of the ranks for the first group relative to the second
group. We can compute an exact p-value for based on
combinatorics. We can also use the CLT since
statistical theory tells us that this W is approximated by the
normal distribution. We can construct a z-score as follows: