SH5 - The Wilcoxon signed rank test

SH5 - The Wilcoxon signed rank test

SH5 tests a single population median using the signs and ranks of deviations from its hypothesised value. You will check the symmetry assumption, handle zero deviations and ties, choose the correct one- or two-tailed table column, and reach a non-assertive conclusion in context.

Use ranks without forgetting the population assumption

If the largest observation becomes ten times more extreme, must it count ten times as much in a test? A signed rank test gives the largest absolute deviation rank nn, however far away it is, provided its sign and rank order do not change.

The test still uses information about size: a large deviation gets a larger rank than a small one. It uses less information than a calculation based on the actual magnitudes, but more than simply counting positive and negative signs.

You already know

A population median is fixed, while a sample median varies between samples. A hypothesis test compares sample evidence with a proposed population value; a critical region contains results judged too unlikely under H0H_0. Not rejecting H0H_0 does not prove it.

Here the evidence comes from signed ranks, and the parameter in the hypotheses is the population median.

Wilcoxon signed rank test

The Wilcoxon signed rank test is a non-parametric, or distribution-free, test for the median of a population with a symmetric distribution, using an independent random sample.

For a hypothesised median m0m_0, form deviations di=xi−m0d_i=x_i-m_0. Rank their non-zero absolute values, then compare the rank sums for positive and negative deviations.

“Distribution-free” does not mean “assumption-free”. The underlying population must be symmetric, and the sampling design must support independence. The test is useful when a Normal model is not justified but symmetry is reasonable. A strongly skewed population is not made suitable merely by replacing observations with ranks.

State hypotheses about the population median, for example

H0:m=50,H1:m>50H_0:m=50,\qquad H_1:m>50

where mm is the population median reading in the stated setting. A two-sided alternative would be m≠50m\ne50. Do not silently replace the median by the mean.

Key idea

Under the null symmetric model, positive and negative deviations should balance in their rank weights. A small rank sum on one side signals an imbalance; the alternative determines which imbalance matters.

Check the assumptions before carrying out the arithmetic.

Rank magnitudes, then restore the signs

First subtract the hypothesised median. Omit zero deviations before ranking: they carry neither sign and do not count in the effective sample size nn. Rank the remaining absolute deviations from smallest to largest. If every deviation is zero, no non-zero ranks remain and this table method cannot be used.

If absolute deviations tie, assign each the mean of the ranks they occupy. A tie depends on absolute size, so deviations −3-3 and +3+3 tie.

Signed rank sums

W+W^+ is the sum of ranks belonging to positive deviations; W−W^- is the sum belonging to negative deviations.

The effective sample size nn is the number of non-zero deviations. With mean ranks for ties,

W++W−=n(n+1)2W^++W^-=\frac{n(n+1)}2

The rank-total check is not printed in the formula booklet. It is the sum of ranks 11 to nn, preserved when tied ranks are averaged. The booklet supplies critical values, rather than a full ranking algorithm.

Worked example 1: a zero deviation

Question. For readings 17,19,20,22,24,2717,19,20,22,24,27, calculate the signed rank sums relative to hypothesised median 2020.

Plan. Remove the zero deviation, rank absolute deviations, and add ranks by sign.

| Reading | d=x−20d=x-20 | ∣d∣|d| | Rank |
|---:|---:|---:|---:|
| 1717 | −3-3 | 33 | 33 |
| 1919 | −1-1 | 11 | 11 |
| 2020 | 00 | 00 | omitted |
| 2222 | 22 | 22 | 22 |
| 2424 | 44 | 44 | 44 |
| 2727 | 77 | 77 | 55 |

n=5exclude the zeroW+=2+4+5=11ranks of positive deviationsW−=3+1=4ranks of negative deviations\begin{aligned} n&=5 && \text{exclude the zero}\\ W^+&=2+4+5=11 && \text{ranks of positive deviations}\\ W^-&=3+1=4 && \text{ranks of negative deviations} \end{aligned}

Why this step? The zero must be removed before assigning ranks; giving it rank 11 would shift every other rank.

Answer. n=5n=5, W+=11W^+=11, W−=4W^-=4.

Check. 11+4=15=5(6)/211+4=15=5(6)/2.

Change only the final reading from 2727 to 2323. The zero remains, but the positive deviation 33 now ties with the negative deviation −3-3.

Worked example 2: tied absolute deviations

Question. Calculate the rank sums for readings 17,19,20,22,24,2317,19,20,22,24,23, again relative to 2020.

Plan. Omit the zero and average the ranks occupied by the two absolute deviations of size 33.

Deviation−3-3−1-100224433
Rank3.53.511omitted22553.53.5
tied rank=3+42=3.5average occupied positionsW+=2+5+3.5=10.5positive deviationsW−=3.5+1=4.5negative deviations\begin{aligned} \text{tied rank}&=\frac{3+4}{2}=3.5 && \text{average occupied positions}\\ W^+&=2+5+3.5=10.5 && \text{positive deviations}\\ W^-&=3.5+1=4.5 && \text{negative deviations} \end{aligned}

Why this step? Opposite signs do not prevent a tie: ranking is based on magnitude before the signs are restored.

Answer. n=5n=5, W+=10.5W^+=10.5, W−=4.5W^-=4.5.

Check. The total remains 1515, although the individual sums are no longer integers.

For a table-based question, keep the mean ranks unrounded and use the effective sample size with the supplied table, following any stated instructions. The ordinary table is based on untied ranks, so its quoted significance level is approximate when ties occur. The complete table-based tests below use untied, non-zero absolute deviations, for which the cutoffs apply directly.

Watch out

Wrong: rank signed deviations from the most negative to the most positive.

Right: rank their absolute values, then attach each rank to its original sign.

Change only the last reading again.

Let the alternative choose the small rank sum

For H1:m>m0H_1:m>m_0, positive deviations should dominate, so reject for a sufficiently small W−W^-. For H1:m<m0H_1:m<m_0, negative deviations should dominate, so reject for a sufficiently small W+W^+.

The booklet's Wilcoxon table labels both 1-tail and 2-tail percentages. For n=8n=8, the one-tailed 5%5\% critical value is 55. Reject when the rank sum selected by the alternative is at most this cutoff.

Worked example 3: evidence of a larger median

Question. Eight independent instrument readings are 49,52,53,54,55,56,57,5849,52,53,54,55,56,57,58. Assume their population is symmetric. Test at the 5%5\% level whether its median is greater than 5050.

Plan. State the median hypotheses, calculate ranks about 5050, and compare W−W^- with the one-tailed cutoff.

H0:m=50,H1:m>50m is the population median readingd=−1,2,3,4,5,6,7,8subtract the hypothesised medianW−=1only negative deviation has rank 1W+=36−1=35remaining ranksW−=1≤5one-tailed 5% cutoff, n=8\begin{aligned} H_0&:m=50,\qquad H_1:m>50 && m\text{ is the population median reading}\\ d&=-1,2,3,4,5,6,7,8 && \text{subtract the hypothesised median}\\ W^-&=1 && \text{only negative deviation has rank }1\\ W^+&=36-1=35 && \text{remaining ranks}\\ W^-&=1\le5 && \text{one-tailed }5\%\text{ cutoff, }n=8 \end{aligned}

Why this step? The upper-sided alternative needs unusually little negative rank weight, so W−W^- is the relevant lower-tail statistic.

Answer. Reject H0H_0. There is sufficient evidence at the 5%5\% level to suggest that the population median reading is greater than 5050.

Check. 1+35=36=8(9)/21+35=36=8(9)/2, and the observed direction agrees with the alternative.

Continue this lesson.

You’re previewing NovaLearn without an account. Create a free account to read the rest.

Create free account