3.10 Practice Problems

Problem 3.1. In a clinical investigation of a new drug intended to reduce repetitive behaviour in children with autism, the drug is effective if a child shows less such behaviour on treatment. Eight children were enrolled. Each was observed for three hours before treatment and again after a week on the drug, and the percentage of the observation period spent in repetitive behaviour was recorded.

Child 1 2 3 4 5 6 7 8
Before treatment 85 70 40 65 80 75 55 20
After one week 75 50 50 40 20 65 40 25

Test \(H_0\): the median difference is zero, against \(H_1\): the median difference is positive, using

(a).
the sign test;
(b).
the Wilcoxon signed-rank test;
(c).
and comment on the two results.

Show solution

Solution. The differences \(d=\text {before}-\text {after}\) are \[10,\hspace {0.3cm}20,\hspace {0.3cm}-10,\hspace {0.3cm}25,\hspace {0.3cm}60, \hspace {0.3cm}10,\hspace {0.3cm}15,\hspace {0.3cm}-5 .\] A positive \(d\) means the behaviour fell, so the drug working corresponds to positive differences and the alternative is one-sided upward. None is zero, so \(n=8\) throughout.

(a) Sign test. Six differences are positive and two negative, so \(N_{+}=6\) with \(N_{+}\sim \operatorname {Bin}\left (8,\tfrac {1}{2}\right )\) under \(H_0\). Large \(N_{+}\) favours \(H_1\): \[p=P\left (N_{+}\geq 6\right ) =\dfrac {\binom {8}{6}+\binom {8}{7}+\binom {8}{8}}{2^{8}} =\dfrac {28+8+1}{256}=\dfrac {37}{256}=0.1445 .\] Since \(0.1445>0.05\) we do not reject \(H_0\). The sign test finds no evidence that the drug works.

(b) Wilcoxon signed-rank test. Rank the absolute differences, averaging ties:

\(\left |d\right |\) sorted 5 10 10 10 15 20 25 60
provisional rank 1 2 3 4 5 6 7 8
rank used 1 3 3 3 5 6 7 8
sign of \(d\) \(-\) \(+\) \(-\) \(+\) \(+\) \(+\) \(+\) \(+\)

The three \(\left |d\right |=10\) would take ranks \(2,3,4\) and so each receives \(\frac {2+3+4}{3}=3\). Then \[T_{+}=3+3+5+6+7+8=32,\hspace {0.8cm}T_{-}=1+3=4,\] and the check holds: \(32+4=36=\dfrac {8\times 9}{2}\).

The alternative says the differences run positive, which drives \(T_{-}\) down, so \(T_{-}\) is the statistic and small values are significant. For \(n=8\) one-sided at \(\alpha =0.05\) the critical value is \(T_0=5\), since \(P\left (T\leq 5\right )=0.0391\) while \(P\left (T\leq 6\right )=0.0547\). Here \[T_{-}=4\leq 5,\] so we reject \(H_0\). The exact \(p\)-value is \(P\left (T\leq 4\right )=\frac {7}{256}=0.0273\).

(c) Comment. The two tests disagree: \(p=0.1445\) against \(p=0.0273\), on identical data. The reason is that the two negative differences, \(-10\) and \(-5\), are among the smallest in the set, while the positive ones include \(60\), \(25\) and \(20\). The sign test counts six arrows up and two down and finds that unremarkable in eight children. The signed-rank test sees that the two children who worsened did so barely, and that between them they account for only \(4\) of the \(36\) available rank points.

Where both tests apply, the signed-rank test is the more powerful and is the one to report. It buys that power by assuming the differences are symmetric about their median, which the sign test does not require — so on markedly skewed differences the sign test’s verdict would be the one to trust.

Problem 3.2. Derive the null distribution of the Wilcoxon signed-rank statistic \(T_{+}\) for \(n=4\) by enumeration. Hence give the critical values for a one-sided and a two-sided test at \(\alpha =0.05\), and comment.

Show solution

Solution. Under \(H_0\) each of the ranks \(1,2,3,4\) independently carries a plus or a minus with probability \(\tfrac {1}{2}\), so there are \(2^{4}=16\) equally likely sign patterns and \(T_{+}\) is the sum of the ranks carrying a plus. Enumerating the subsets of \(\{1,2,3,4\}\) by their totals:

\(t\) 0 1 2 3 4 5 6 7 8 9 10
subsets summing to \(t\) 1 1 1 2 2 2 2 2 1 1 1
\(P\left (T_{+}=t\right )\) \(\frac {1}{16}\) \(\frac {1}{16}\) \(\frac {1}{16}\) \(\frac {2}{16}\) \(\frac {2}{16}\) \(\frac {2}{16}\) \(\frac {2}{16}\) \(\frac {2}{16}\) \(\frac {1}{16}\) \(\frac {1}{16}\) \(\frac {1}{16}\)

The two subsets summing to \(3\) are \(\{3\}\) and \(\{1,2\}\); those summing to \(4\) are \(\{4\}\) and \(\{1,3\}\), and so on. The distribution is symmetric about \(\dfrac {n(n+1)}{4}=5\) and the totals check: \(1+1+1+2+2+2+2+2+1+1+1=16\).

Accumulating the lower tail, \[P\left (T_{+}\leq 0\right )=\dfrac {1}{16}=0.0625,\hspace {0.6cm} P\left (T_{+}\leq 1\right )=\dfrac {2}{16}=0.1250,\hspace {0.6cm} P\left (T_{+}\leq 2\right )=\dfrac {3}{16}=0.1875 .\]

Critical values. There are none. Even the most extreme outcome possible — every one of the four differences pointing the same way — has one-sided probability \(0.0625\), which exceeds \(0.05\). No critical region of size at most \(0.05\) exists, one-sided or two-sided, so at \(n=4\) the test cannot reject \(H_0\) at the \(5\%\) level whatever the data.

Comment. This is a property of the design, not of the sample. With four paired observations the smallest attainable significance level is \(2/16=0.125\) two-sided, and no amount of favourable data will improve it. The practical consequence is that the sample size must be checked before the study is run: for a two-sided \(5\%\) signed-rank test \(n\geq 6\) is needed for any critical region to exist at all, and \(n=6\) only rejects when all six differences agree in sign.

Questions on this section

Stuck on something here? Ask below and it stays attached to this topic.