Wilcoxon Tests
1. **Problem 1: Wilcoxon Signed-Rank Test for Twin Attention Span**
We want to test if the vitamin supplement (Twin B) leads to a longer attention span than the normal drink (Twin A) at significance level $\alpha=0.05$.
2. **Calculate differences (Twin B - Twin A):**
$$\begin{array}{c|ccccccccc}
\text{Pair} & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 \\
\hline
\text{Twin A} & 22 & 17 & 30 & 21 & 22 & 23 & 13 & 19 & 25 \\
\text{Twin B} & 26 & 22 & 27 & 26 & 22 & 29 & 18 & 20 & 26 \\
\text{Difference} & 4 & 5 & -3 & 5 & 0 & 6 & 5 & 1 & 1
\end{array}$$
Note: Differences of zero (Pair 5) are excluded.
3. **Rank the absolute differences (ignoring zeros):**
Absolute differences: 4,5,3,5,6,5,1,1
Sorted absolute differences: 1,1,3,4,5,5,5,6
Assign ranks (average ranks for ties):
- 1 and 1: ranks 1 and 2, average rank = 1.5 each
- 3: rank 3
- 4: rank 4
- 5,5,5: ranks 5,6,7 average rank = 6 each
- 6: rank 8
4. **Assign ranks to differences with signs:**
| Difference | Absolute | Rank | Signed Rank |
|------------|----------|------|-------------|
| 4 | 4 | 4 | +4 |
| 5 | 5 | 6 | +6 |
| -3 | 3 | 3 | -3 |
| 5 | 5 | 6 | +6 |
| 6 | 6 | 8 | +8 |
| 5 | 5 | 6 | +6 |
| 1 | 1 | 1.5 | +1.5 |
| 1 | 1 | 1.5 | +1.5 |
5. **Calculate sums of positive and negative ranks:**
- Positive ranks sum $W_+ = 4 + 6 + 6 + 8 + 6 + 1.5 + 1.5 = 33$
- Negative ranks sum $W_- = 3$
6. **Test statistic $W$ is the smaller of $W_+$ and $W_-$:**
$$W = 3$$
7. **Critical value for $n=8$ (non-zero differences) at $\alpha=0.05$ (one-tailed) is 5.**
Since $W=3 < 5$, we reject the null hypothesis.
**Conclusion:** There is significant evidence at the 0.05 level that the vitamin supplement increases attention span.
---
8. **Problem 2: Wilcoxon Signed-Rank Test for Shampoo Ratings**
Test if the darker-colour shampoo ratings are generally higher than original ratings at $\alpha=0.05$.
9. **Calculate differences (Darker - Original):**
$$\begin{array}{c|cccccccc}
\text{Customer} & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 \\
\hline
\text{Original} & 5 & 7 & 5 & 5 & 2 & 4 & 8 & 8 \\
\text{Darker} & 5 & 4 & 3 & 8 & 4 & 6 & 9 & 10 \\
\text{Difference} & 0 & -3 & -2 & 3 & 2 & 2 & 1 & 2
\end{array}$$
Exclude zero difference (Customer 1).
10. **Rank absolute differences:**
Absolute differences: 3,2,3,2,2,1,2
Sorted: 1,2,2,2,2,3,3
Ranks:
- 1: rank 1
- 2,2,2,2: ranks 2,3,4,5 average rank = 3.5 each
- 3,3: ranks 6,7 average rank = 6.5 each
11. **Assign signed ranks:**
| Difference | Absolute | Rank | Signed Rank |
|------------|----------|------|-------------|
| -3 | 3 | 6.5 | -6.5 |
| -2 | 2 | 3.5 | -3.5 |
| 3 | 3 | 6.5 | +6.5 |
| 2 | 2 | 3.5 | +3.5 |
| 2 | 2 | 3.5 | +3.5 |
| 1 | 1 | 1 | +1 |
| 2 | 2 | 3.5 | +3.5 |
12. **Sum positive and negative ranks:**
- $W_+ = 6.5 + 3.5 + 3.5 + 1 + 3.5 = 18$
- $W_- = 6.5 + 3.5 = 10$
13. **Test statistic $W$ is the smaller sum:**
$$W = 10$$
14. **Critical value for $n=7$ at $\alpha=0.05$ (one-tailed) is 2.**
Since $W=10 > 2$, we fail to reject the null hypothesis.
**Conclusion:** There is insufficient evidence at the 0.05 level to conclude that the darker shampoo is rated higher.