A-Level Further Maths 9231 / Topic 4.4 / AS & A Level
Use the signs and the sizes.
The sign test throws away everything except whether each value is above or below the claimed median. The Wilcoxon signed-rank test keeps the sizes too, by ranking the differences, so it can detect a shift the sign test misses. The price is one assumption: the population must be symmetric.
Subtract the hypothesised median \(m_0\) from each value (or take the differences of matched pairs), rank the absolute differences from 1 (smallest) to \(n\), and add the ranks of the positive differences to get \(P\) and of the negative ones to get \(Q\). Always \(P + Q = \tfrac{1}{2}n(n + 1)\). The test statistic is \(T = \min(P, Q)\) and you reject \(H_0\) if \(T \le\) the critical value. For large \(n\), \(T \approx N\!\left(\tfrac{n(n + 1)}{4},\ \tfrac{n(n + 1)(2n + 1)}{24}\right)\). The test is valid only if the population (of values or of differences) is symmetric.
Fig. 1: the exact distribution of P, the sum of the positive ranks, for n = 8 when H0 is true. Each of the 2^8 = 256 sign patterns is equally likely, so the distribution is symmetric about E(P) = 18. P(P ≤ 5) = 10/256 ≈ 0.039 is within 5% but P(P ≤ 6) = 14/256 ≈ 0.055 is not, so the one-tailed 5% critical value for n = 8 is 5
Section 01
Rank the differences, keep the signs.
Suppose a population is symmetric with median \(m\). Test \(H_0: m = m_0\). If \(H_0\) is true, each difference \(x - m_0\) is as likely to be positive as negative, whatever its size, so the big ranks should be split roughly evenly between the two signs. A large imbalance of rank (not just of count) is evidence against \(H_0\). That is why this test is more powerful than the sign test: it uses the magnitudes. It is also why it needs symmetry: in a skewed population the large differences tend to fall on one side even when the median is \(m_0\).
Step 1: find each difference \(d = x - m_0\) and rank \(|d|\) from 1 (smallest) to \(n\).
Step 2: \(P\) = sum of the ranks with \(d > 0\), \(Q\) = sum of the ranks with \(d < 0\). Check \(P + Q = \tfrac{1}{2}n(n + 1)\).
Step 3: two-tailed, \(T = \min(P, Q)\). One-tailed, \(T\) is the sum that should be SMALL if \(H_1\) is true (\(Q\) for \(H_1: m > m_0\), \(P\) for \(H_1: m < m_0\)).
Step 4: reject \(H_0\) if \(T \le\) the critical value from the table for \(n\) and the significance level.
One-tailed
5%
2.5%
1%
0.5%
Two-tailed
10%
5%
2%
1%
\(n = 6\)
2
0
-
-
\(n = 7\)
3
2
0
-
\(n = 8\)
5
3
1
0
\(n = 9\)
8
5
3
1
\(n = 10\)
10
8
5
3
\(n = 11\)
13
10
7
5
\(n = 12\)
17
13
9
7
Worked example Ranking and the check P + Q
A machine is meant to fill bags with median mass 50 g. Eight bags have masses (g) 53.2, 47.9, 58.4, 55.1, 49.3, 61.0, 52.6, 56.8. Find \(P\) and \(Q\) for a test of \(m = 50\).
Answer: \(P = 33,\ Q = 3\); for \(H_1: m > 50\), \(T = Q = 3 \le 5\) (one-tailed 5%), so there is evidence that the median exceeds 50 g
Worked example A two-tailed single-sample test
A bus journey is claimed to have median time 12.0 minutes. Ten journeys took 10.4, 13.9, 9.1, 11.6, 8.7, 12.5, 10.9, 7.8, 13.2, 9.6 minutes. Assuming the times are symmetrically distributed, test at the 5% level whether the median differs from 12.0 minutes.
\(H_0: m = 12.0\), \(H_1: m \ne 12.0\), where \(m\) is the population median journey time.
Positive differences 0.5, 1.2, 1.9 have ranks 2, 4, 6, so \(P = 12\) and \(Q = 55 - 12 = 43\).
\(T = \min(12, 43) = 12\). Critical value for \(n = 10\), two-tailed 5%: 8.
\(12 > 8\), so do not reject \(H_0\).
Answer: Insufficient evidence at the 5% level that the median journey time differs from 12.0 minutes
Your turn
For \(n = 9\) differences, \(P = 37\). Find \(T\) and say whether a two-tailed test at 5% rejects \(H_0\).
\(Q = 45 - 37 = 8\), \(T = 8\). The critical value is 5 and \(8 > 5\), so do not reject \(H_0\).
Examiner trap
Rank the ABSOLUTE differences, but add up the ranks, not the differences. Summing the positive differences themselves (for example 3.2 + 8.4 + ...) is a common slip that produces a number the table knows nothing about.
Section 02
Matched pairs: test the differences.
When each subject is measured twice (before and after, judge A and judge B), the two samples are not independent. Take the difference within each pair and run a signed-rank test on those differences with hypothesised median 0. \(H_0\): the two populations are identical (the differences have median 0); \(H_1\): one population tends to give larger values. The symmetry assumption is now about the population of DIFFERENCES.
Worked example Before and after a revision course
Nine students took a test before and after a revision course. Before: 52, 61, 48, 70, 55, 63, 58, 66, 49. After: 56, 60, 54, 73, 62, 61, 67, 71, 57. Test at the 5% level whether scores tend to increase.
\(H_0\): the population median of after minus before is 0. \(H_1\): it is greater than 0 (one-tailed).
\(0.0898 > 0.05\), so the sign test does not reject \(H_0\).
The Wilcoxon test noticed that the two negatives were the SMALLEST differences; the sign test only counted them.
Answer: The sign test gives insufficient evidence, the Wilcoxon test gives sufficient evidence: using the sizes makes the Wilcoxon test more powerful
Examiner trap
Do not treat the before and after scores as two separate samples. Matched pairs are tested through their differences; the rank-sum test of the next lesson is for two INDEPENDENT samples.
Stage 1 · Learn
Check your understanding
Four quick checks. Each correct answer earns XP and records this skill on your profile.
Quick check+10 XP
In a signed-rank test with \(n = 12\), \(P = 50\). What is \(Q\)?
Quick check+10 XP
Why is the Wilcoxon signed-rank test valid only for a symmetric population?
Quick check+10 XP
The differences from \(m_0\) are -3.1, 1.4, 2.2, -0.6, 4.5. Find \(P\).
Quick check+10 XP
For \(n = 9\), a two-tailed test at 5% has critical value 5. The sample gives \(T = 6\). The correct decision is
Section 03
Large samples: the normal approximation.
Under \(H_0\) each rank \(r\) is added to \(P\) with probability \(\tfrac{1}{2}\), independently. So \(E(P) = \tfrac{1}{2}\sum r = \tfrac{n(n + 1)}{4}\) and \(\operatorname{Var}(P) = \tfrac{1}{4}\sum r^{2} = \tfrac{n(n + 1)(2n + 1)}{24}\), and the same holds for \(Q\) and \(T\). When \(n\) is too large for the table (beyond 20), use \(T \approx N\!\left(\tfrac{n(n + 1)}{4},\ \tfrac{n(n + 1)(2n + 1)}{24}\right)\). \(T\) takes whole-number values, so apply a continuity correction: \(P(T \le t)\) becomes \(P(\text{normal} < t + 0.5)\).
Worked example One-tailed with n = 30
A signed-rank test on \(n = 30\) differences gives \(T = 140\), where \(T\) is the sum that should be small under \(H_1\). Test at the 5% level.
The continuity correction moves \(T\) TOWARDS the mean: use \(T + 0.5\) because \(T\) is below \(E(T)\). Using \(T - 0.5\), or none at all, can flip a borderline decision, and dividing by the variance instead of its square root gives a tiny, meaningless \(z\).
Stage 2 · Exam
Exam-style questions
Unlocks once the four checks above are done. Worth more XP, written to AS & A Level Further Mathematics Paper 1 to 4 standard.
Finish the four checks above to unlock the exam questions
Exam style+20 XP
For a Wilcoxon signed-rank test with \(n = 40\), the normal approximation to \(T\) has
Exam style+20 XP
The median reaction time is claimed to be 20 ms. Seven values give differences from 20 of -4.1, -2.6, 1.3, -5.8, -0.9, -3.4, -6.2. Test \(H_1: m < 20\) at the 5% level (critical value 3).
Exam style+20 XP
A one-tailed matched-pairs test on 8 pairs gives \(T = 5\). The critical values for \(n = 8\) are 5 (5% level) and 3 (2.5% level). Which is correct?
Exam style+20 XP
A two-tailed signed-rank test at 5% on \(n = 24\) pairs gives \(T = 81\). Using a normal approximation, which is correct?
Skill unlocked
Signs and sizes ranked.
This skill is now recorded on your profile. Keep the chain going.