The shape of the lesson
By the end of the lesson, learners can
- Rank the differences, keep the signs: Suppose a population is symmetric with median \(m\).
- 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.
- Large samples: the normal approximation: Under \(H_0\) each rank \(r\) is added to \(P\) with probability \(\tfrac{1}{2}\), independently.
- Hypotheses: \(H_0: m = m_0\) (or the median difference is 0), with \(m\) defined in context; state symmetry as the assumption.
- Differences: \(x - m_0\), or within each pair; rank the absolute values 1 to \(n\).
- Sums: \(P\) (positive ranks), \(Q\) (negative ranks), check \(P + Q = \tfrac{1}{2}n(n + 1)\).
- Statistic: \(T = \min(P, Q)\) two-tailed; the sum \(H_1\) predicts small, one-tailed. Reject if \(T \le\) critical value.
- Large \(n\): \(z = \dfrac{T + 0.5 - n(n + 1)/4}{\sqrt{n(n + 1)(2n + 1)/24}}\), compared with the normal critical value.
One picture every idea returns to
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.
Forty-five minutes, phase by phase
| Time | Phase | What happens in the room | Grouping |
|---|---|---|---|
| 0 to 5 min | Hook: predict | Open with the question in the title, Use the signs and the sizes.. The sign test throws away everything except whether each value is above or below the claimed median. Put the figure on the board: it is the one picture every idea in the lesson returns to. | Whole class, then pairs |
| 5 to 13 min | Teach and check: Rank the differences, keep the signs | Suppose a population is symmetric with median \(m\). Project tab 3 of the lab (Distributions lab, signed-rank test) and let a student drive it while the class predicts. Model the worked example Ranking and the check P + Q on the board, one line at a time. Your turn: For \(n = 9\) differences, \(P = 37\). Find \(T\) and say whether a two-tailed test at 5% rejects \(H_0\). | Whole class, then pairs |
| 13 to 21 min | Teach and check: 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. Model the worked example Before and after a revision course on the board, one line at a time. | Pairs |
| 21 to 30 min | Teach and check: Large samples: the normal approximation | Under \(H_0\) each rank \(r\) is added to \(P\) with probability \(\tfrac{1}{2}\), independently. Model the worked example One-tailed with n = 30 on the board, one line at a time. Your turn: Find \(E(T)\) and \(\operatorname{Var}(T)\) for \(n = 40\). | Rally Coach |
| 30 to 36 min | Check | The four Stage 1 questions from the student lesson, answered on mini whiteboards or by show of fingers. Re-teach the one most get wrong. | Individual, then whole class |
| 36 to 43 min | Plenary | The exam-style questions from Stage 2, one at a time: thirty seconds alone, then a random call. The feedback lines in the key give the examiner's wording. | Individual, random call |
| 43 to 45 min | Exit and homework | Set the worksheet below (6 questions, 26 marks). Learners self-assess against the objectives before they leave. | Individual |
Protect the parts that carry the learning
The sequence carries about fifty minutes of material, so the lab is driven by one student while the class predicts rather than explored freely. Times are a guide.
Protected: the check at 30 minutes. It is the only individual read on whether the key idea landed, and it is not cut.
Cut first if the build overruns: the last check in Large samples: the normal approximation, never the check or the plenary.
In a 60 minute block: run worksheet questions 1 to 3 in class as a Rally Coach set and model both the hardest worked example and its check live.
Rally Coach
Pairs share one worksheet. One partner solves the first question aloud while the other coaches, checking each line and offering a prompt rather than the answer; they swap roles for the next question.
The full structure, with its PIES check and a worked example for every subject, is on the cooperative-learning page, one of fifteen structures there.
What to head off, and how
| Trap learners fall into | Teaching move that pre-empts it |
|---|---|
| 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. |
| 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. |
| 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\). |
Wilcoxon signed-rank tests: worksheet
6 questions, 26 marks. Written in the style of the papers; no past paper question is reproduced.
In a Wilcoxon signed-rank test on 15 differences, the sum of the positive ranks is \(P = 87\). Find \(Q\) and the value of \(T\) for a two-tailed test.
Packets of rice are labelled with median mass 250 g. Eleven packets have masses (g)
253.8, 248.8, 255.6, 252.1, 249.6, 257.3, 254.5, 247.3, 256.1, 251.6, 258.2.
Assuming the masses are symmetrically distributed, use a Wilcoxon signed-rank test at the 5% level to test whether the median mass differs from 250 g. (Critical value for \(n = 11\), two-tailed 5%: 10.)
Two judges, A and B, score the same ten entries.
A: 7.4, 6.2, 8.9, 5.5, 7.8, 4.6, 6.9, 5.8, 9.1, 6.0
B: 6.8, 7.6, 6.6, 5.8, 6.1, 7.5, 6.0, 6.3, 5.7, 7.1
Test at the 5% level whether there is a difference between the judges' scores. (Critical value for \(n = 10\), two-tailed 5%: 8.)
A Wilcoxon signed-rank test of \(H_0: m = m_0\) against \(H_1: m < m_0\) uses a sample of 50 values and gives \(P = 420\).
(a) Explain why \(P\) is the appropriate test statistic.
(b) Using a normal approximation, carry out the test at the 5% level and at the 1% level.
Ten differences are 2.4, 5.1, -0.8, 3.7, 1.5, 6.2, -1.1, 4.4, 0.6, 2.9. Test \(H_0\): median difference 0 against \(H_1\): median difference greater than 0.
(a) Carry out a sign test at the 5% level.
(b) Carry out a Wilcoxon signed-rank test at the 5% level (critical value 10).
(c) Explain why the conclusions differ, and state the extra assumption needed in (b).
(a) Show that for a sample of 4 differences a one-tailed Wilcoxon signed-rank test can never reject \(H_0\) at the 5% level.
(b) Show that for \(n = 5\) the one-tailed 5% critical value is 0.
Answer key and marking notes
- \(P + Q = \tfrac{1}{2}(15)(16) = 120\), so \(Q = 120 - 87 = 33\).
- \(T = \min(87, 33) = 33\).
- \(H_0: m = 250\), \(H_1: m \ne 250\), where \(m\) g is the population median mass.
- Differences: 3.8, -1.2, 5.6, 2.1, -0.4, 7.3, 4.5, -2.7, 6.1, 1.6, 8.2.
- The negative differences -0.4, -1.2, -2.7 have ranks 1, 2, 5, so \(Q = 8\) and \(P = 66 - 8 = 58\).
- \(T = \min(58, 8) = 8\), and \(8 \le 10\), so reject \(H_0\).
- There is sufficient evidence at the 5% level that the median mass is not 250 g.
- \(H_0\): the population median of A - B is 0 (no difference between judges). \(H_1\): it is not 0.
- Differences A - B: 0.6, -1.4, 2.3, -0.3, 1.7, -2.9, 0.9, -0.5, 3.4, -1.1.
- Ranks of the absolute values: 0.3 (1), 0.5 (2), 0.6 (3), 0.9 (4), 1.1 (5), 1.4 (6), 1.7 (7), 2.3 (8), 2.9 (9), 3.4 (10).
- Positive ranks 3, 4, 7, 8, 10: \(P = 32\); \(Q = 55 - 32 = 23\). \(T = 23\).
- \(23 > 8\), so do not reject \(H_0\): insufficient evidence at the 5% level of a difference between the judges.
- (a) If \(m < m_0\), most differences \(x - m_0\) are negative, so the positive ranks, and their sum \(P\), should be small.
- \[\begin{aligned} E(T) &= \tfrac{50 \times 51}{4} = 637.5 \\ \operatorname{Var}(T) &= \tfrac{50 \times 51 \times 101}{24} = 10731.25 \end{aligned}\]
- \[z = \frac{420.5 - 637.5}{\sqrt{10731.25}} = \frac{-217}{103.59} = -2.095\]
- 5%: \(-2.095 < -1.645\), so reject \(H_0\): sufficient evidence that \(m < m_0\).
- 1%: \(-2.095 > -2.326\), so do not reject \(H_0\) at the 1% level.
- (a) 8 of 10 are positive; \(X \sim B(10, 0.5)\): \(P(X \ge 8) = \dfrac{45 + 10 + 1}{1024} = 0.0547 > 0.05\). Do not reject \(H_0\).
- (b) The negative differences -0.8 and -1.1 have ranks 2 and 3, so \(Q = 5\), \(P = 50\).
- \(H_1\) predicts few negative ranks, so \(T = Q = 5 \le 10\): reject \(H_0\); sufficient evidence that the median difference is positive.
- (c) The Wilcoxon test also uses the fact that both negative differences are among the smallest; the sign test only counts signs, so it is less powerful.
- The Wilcoxon test assumes the population of differences is symmetric.
- (a) Under \(H_0\) each of the \(2^{4} = 16\) sign patterns is equally likely. The smallest possible \(T\) is 0 (no ranks of the predicted sign).
- \(P(T = 0) = \tfrac{1}{16} = 0.0625 > 0.05\), so even \(T = 0\) is not significant: no critical region exists.
- (b) With \(2^{5} = 32\) patterns, \(T = 0\) needs all five signs the same way: \(P(T = 0) = \tfrac{1}{32} = 0.03125 \le 0.05\).
- \(T = 1\) occurs only when rank 1 alone has the other sign, so \(P(T \le 1) = \tfrac{2}{32} = 0.0625 > 0.05\). Hence the critical value is 0.
8 multiple-choice questions on this lesson
From the topic question bank. Assign them in the app for a marked score in your gradebook, or run the topic as a class game.
The differences from a hypothesised median are 2.3, \(-0.8\), 4.1, \(-1.6\), 3.5, 0.4, \(-2.9\). Find \(P\), \(Q\) and \(T\) for a two-tailed Wilcoxon signed-rank test.
- A\(P = 4,\ Q = 3,\ T = 3\)
- B\(P = 18,\ Q = 10,\ T = 10\)
- C\(P = 18,\ Q = 10,\ T = 18\)
- D\(P = 22,\ Q = 6,\ T = 6\)
Which statement about the Wilcoxon signed-rank test, compared with the sign test, is correct?
- AIt uses only the signs, and needs no assumption about shape
- BIt tests the population mean, using ranks instead of values
- CIt uses the sizes of the differences, but needs a symmetric population
- DIt uses the sizes of the differences, but needs a normal population
A Wilcoxon signed-rank test with \(n = 11\) tests \(H_1\): median \(> m_0\). The rank sums are \(P = 54\) and \(Q = 12\). The critical values for \(n = 11\) are 13 (one-tailed 5%) and 10 (one-tailed 2.5%). At the 5% level, which is correct?
- A\(T = 12 > 10\): do not reject \(H_0\)
- B\(T = 12 \le 13\): reject \(H_0\)
- C\(T = 12 < 13\): do not reject \(H_0\)
- D\(T = 54 > 13\): do not reject \(H_0\)
For a Wilcoxon signed-rank test with \(n = 26\), find \(E(T)\) and \(\operatorname{Var}(T)\) for the normal approximation.
- A\(E(T) = 175.5,\ \operatorname{Var}(T) = 1550.25\)
- B\(E(T) = 351,\ \operatorname{Var}(T) = 1550.25\)
- C\(E(T) = 175.5,\ \operatorname{Var}(T) = 6201\)
- D\(E(T) = 175.5,\ \operatorname{Var}(T) = 39.4\)
Eight samples are each timed, in seconds, by method \(X\) and method \(Y\). \(X\): 23.5, 18.2, 27.6, 21.0, 25.3, 19.9, 30.1, 22.4. \(Y\): 20.3, 18.8, 22.5, 18.6, 20.6, 21.2, 24.1, 20.6 (same sample in each position). Critical values for \(n = 8\): 5 (one-tailed 5%), 3 (one-tailed 2.5%). Test at the 5% level whether the methods differ.
- A\(T = 33 > 3\): no evidence that the methods differ
- B\(T = 3 \le 3\): evidence that the methods differ
- C\(T = 2 \le 3\): evidence that the methods differ
- D\(T = 3\), not below 3: no evidence that the methods differ
For \(n = 7\), find the exact probability under \(H_0\) that \(P \le 3\).
- A\(\dfrac{10}{128}\)
- B\(\dfrac{5}{128}\)
- C\(\dfrac{3}{128}\)
- D\(\dfrac{4}{128}\)
A Wilcoxon signed-rank test on a sample of 22 tests \(H_1\): median \(< m_0\) at the 5% level. The sum of the positive ranks is 76. Using a normal approximation, which is correct?
- A\(z = -1.66\): evidence that the median is less than \(m_0\)
- B\(z = -5.73\): evidence that the median is less than \(m_0\)
- C\(z = -1.62\): insufficient evidence that the median is less than \(m_0\)
- D\(z = -0.0527\): insufficient evidence that the median is less than \(m_0\)
A two-tailed Wilcoxon signed-rank test at the 5% level uses \(n = 12\). Critical values for \(n = 12\): 17 (one-tailed 5%), 13 (one-tailed 2.5%). For which values of \(P\), the sum of the positive ranks, is \(H_0\) rejected?
- A\(P \le 13\) only
- B\(P \le 13\) or \(P \ge 65\)
- C\(P \le 13\) or \(P \ge 66\)
- D\(P \le 17\) or \(P \ge 61\)
Quiz key
In order of size: 0.4 (1), 0.8 (2), 1.6 (3), 2.3 (4), 2.9 (5), 3.5 (6), 4.1 (7). Positive: \(1 + 4 + 6 + 7 = 18 = P\). Negative: \(2 + 3 + 5 = 10 = Q\). Check: \(P + Q = 28 = \tfrac{1}{2}(7)(8)\). \(T = \min(P, Q) = 10\). Taking \(T = 18\) uses the larger sum. \(P = 22,\ Q = 6\) ranks the signed values instead of their sizes. \(P = 4,\ Q = 3\) just counts the signs, which is a sign test.
Ranking the absolute differences uses their sizes as well as their signs, so the test is usually more powerful than the sign test; the price is that it is valid only when the population (of values or differences) is symmetric. Using only the signs describes the sign test. Normality is the \(t\)-test assumption. Like the sign test, it is a test of the median.
Under \(H_1\) the negative differences should have small ranks, so \(T = Q = 12\) (check \(P + Q = 66 = \tfrac{1}{2}(11)(12)\)). One-tailed 5% critical value: 13. \(12 \le 13\), so reject \(H_0\): there is evidence that the median exceeds \(m_0\). Using \(T = 54\) takes the sum that is large under \(H_1\). Saying small \(T\) means do not reject reverses the rule. Comparing with 10 uses the two-tailed 5% value.
\(E(T) = \dfrac{26 \times 27}{4} = 175.5\) and \(\operatorname{Var}(T) = \dfrac{26 \times 27 \times 53}{24} = 1550.25\). \(351\) is \(\tfrac{1}{2}n(n + 1)\), the total of all the ranks. \(6201\) divides by 6 instead of 24 (it is \(\sum r^{2}\), forgetting the factor \(\tfrac{1}{4}\)). \(39.4\) is the standard deviation, not the variance.
\(X - Y\): 3.2, \(-0.6\), 5.1, 2.4, 4.7, \(-1.3\), 6.0, 1.8. Sizes ranked: 0.6 (1), 1.3 (2), 1.8 (3), 2.4 (4), 3.2 (5), 4.7 (6), 5.1 (7), 6.0 (8). Negative ranks: \(Q = 1 + 2 = 3\), so \(P = 36 - 3 = 33\) and \(T = 3\). Two-tailed 5% critical value 3: \(3 \le 3\), so reject \(H_0\); there is evidence that the two methods give different times. \(T = 33\) uses the larger sum. \(T = 2\) counts the negative differences instead of adding their ranks. Rejection includes equality with the critical value.
Each of the \(2^{7} = 128\) choices of which ranks are positive is equally likely. Sets with total at most 3: \(\{\}\) (0), \(\{1\}\), \(\{2\}\), \(\{3\}\), \(\{1, 2\}\) (3). That is 5, so \(P(P \le 3) = \dfrac{5}{128} = 0.0391\); since \(P(P \le 4) = \dfrac{7}{128} = 0.0547\), the one-tailed 5% critical value for \(n = 7\) is 3. \(\dfrac{4}{128}\) misses \(\{1, 2\}\). \(\dfrac{10}{128}\) doubles for two tails. \(\dfrac{3}{128}\) misses both the empty set and \(\{1, 2\}\).
\(E(T) = \dfrac{22 \times 23}{4} = 126.5\), \(\operatorname{Var}(T) = \dfrac{22 \times 23 \times 45}{24} = 948.75\). \(z = \dfrac{76.5 - 126.5}{\sqrt{948.75}} = \dfrac{-50}{30.80} = -1.62\). Since \(-1.62 > -1.645\), do not reject \(H_0\): there is insufficient evidence that the median is less than \(m_0\) (the exact tail, 0.0527, agrees). \(-1.66\) corrects the wrong way (75.5). \(-5.73\) uses the mean \(\tfrac{1}{2}n(n + 1) = 253\). \(-0.0527\) divides by the variance instead of the standard deviation.
Two-tailed 5% uses the one-tailed 2.5% value, 13. \(P + Q = 78\), so \(T \le 13\) when \(P \le 13\) or \(Q = 78 - P \le 13\), i.e. \(P \ge 65\). \(P \le 13\) only forgets that a very large \(P\) means a very small \(Q\). \(17\) and \(61\) use the one-tailed 5% value. \(P \ge 66\) is an off-by-one slip: \(P = 65\) gives \(Q = 13\), which is rejected.
What to project
The student lesson embeds these tabs. Open them full screen on the projector; every slider has a drag handle on the stage.
Slides for this lesson
A projectable deck for every pack is on the way. Until then, present the student lesson full screen: its sections, figure and lab tabs follow the same order as the plan above.