1. **Problem Statement:**
Test the hypothesis that the two laboratories have the same samples at 5% significance level using:
i. Median test
ii. Mann-Whitney U test
iii. Wald run test
2. **Data:**
Lab A: 9, 3, 1, 3, 0, 7, 2, 11
Lab B: 12, 6, 6, 4, 8, 5, 4, 0
---
### i. Median Test
3. **Step 1: Find the combined median**
Combine all data: 0,0,1,2,3,3,4,4,5,6,6,7,8,9,11,12
Sorted combined data has 16 values, median is average of 8th and 9th values:
$$\text{Median} = \frac{4 + 5}{2} = 4.5$$
4. **Step 2: Create a 2x2 contingency table**
Count values above and below median for each lab:
- Lab A above median (>4.5): 7,9,11 (3 values)
- Lab A below median (<=4.5): 0,1,2,3,3 (5 values)
- Lab B above median: 5,6,6,8,12 (5 values)
- Lab B below median: 0,4,4 (3 values)
| | > Median | <= Median |
|--------|----------|-----------|
| Lab A | 3 | 5 |
| Lab B | 5 | 3 |
5. **Step 3: Perform Chi-square test**
Expected counts under null hypothesis:
$$E_{ij} = \frac{(\text{row total})(\text{column total})}{\text{grand total}}$$
Row totals: Lab A = 8, Lab B = 8
Column totals: >Median = 8, <=Median = 8
Grand total = 16
Expected counts:
$$E_{LabA,>Median} = \frac{8 \times 8}{16} = 4$$
$$E_{LabA,<=Median} = 4$$
$$E_{LabB,>Median} = 4$$
$$E_{LabB,<=Median} = 4$$
6. **Step 4: Calculate Chi-square statistic**
$$\chi^2 = \sum \frac{(O - E)^2}{E} = \frac{(3-4)^2}{4} + \frac{(5-4)^2}{4} + \frac{(5-4)^2}{4} + \frac{(3-4)^2}{4} = 1$$
7. **Step 5: Decision**
Degrees of freedom = (2-1)(2-1) = 1
Critical value at 5% significance = 3.841
Since $1 < 3.841$, fail to reject null hypothesis.
---
### ii. Mann-Whitney U Test
8. **Step 1: Rank all observations combined**
Data combined and sorted:
0,0,1,2,3,3,4,4,5,6,6,7,8,9,11,12
Ranks assigned (average ranks for ties):
0(1.5),0(1.5),1(3),2(4),3(5.5),3(5.5),4(7.5),4(7.5),5(9),6(10.5),6(10.5),7(12),8(13),9(14),11(15),12(16)
9. **Step 2: Sum ranks for each lab**
Lab A values and ranks:
9(14),3(5.5),1(3),3(5.5),0(1.5),7(12),2(4),11(15)
Sum Lab A ranks:
$$14 + 5.5 + 3 + 5.5 + 1.5 + 12 + 4 + 15 = 60.5$$
Lab B values and ranks:
12(16),6(10.5),6(10.5),4(7.5),8(13),5(9),4(7.5),0(1.5)
Sum Lab B ranks:
$$16 + 10.5 + 10.5 + 7.5 + 13 + 9 + 7.5 + 1.5 = 75.5$$
10. **Step 3: Calculate U statistics**
$$U_A = n_A n_B + \frac{n_A(n_A+1)}{2} - R_A = 8 \times 8 + \frac{8 \times 9}{2} - 60.5 = 64 + 36 - 60.5 = 39.5$$
$$U_B = n_A n_B - U_A = 64 - 39.5 = 24.5$$
11. **Step 4: Determine critical value**
For $n_A = n_B = 8$ and $\alpha = 0.05$, two-tailed critical value is 13.
Since $U_B = 24.5 > 13$, fail to reject null hypothesis.
---
### iii. Wald Run Test
12. **Step 1: Combine and order data by value, label by lab**
Sorted combined data with labels:
0(B),0(A),1(A),2(A),3(A),3(A),4(B),4(B),5(B),6(B),6(B),7(A),8(B),9(A),11(A),12(B)
13. **Step 2: Count runs**
A run is a sequence of identical labels:
Sequence: B, A, A, A, A, B, B, B, B, B, A, B, A, A, B
Runs:
1) B
2) A (0(A),1(A),2(A),3(A))
3) B (4(B),4(B),5(B),6(B),6(B))
4) A (7(A))
5) B (8(B))
6) A (9(A),11(A))
7) B (12(B))
Total runs = 7
14. **Step 3: Calculate expected runs and variance**
$$n_1 = 8, n_2 = 8, n = 16$$
Expected runs:
$$E(R) = \frac{2 n_1 n_2}{n} + 1 = \frac{2 \times 8 \times 8}{16} + 1 = 9$$
Variance:
$$Var(R) = \frac{2 n_1 n_2 (2 n_1 n_2 - n)}{n^2 (n-1)} = \frac{2 \times 8 \times 8 (2 \times 8 \times 8 - 16)}{16^2 \times 15} = \frac{128 (128 - 16)}{256 \times 15} = \frac{128 \times 112}{3840} = 3.733$$
15. **Step 4: Calculate Z statistic**
$$Z = \frac{R - E(R)}{\sqrt{Var(R)}} = \frac{7 - 9}{\sqrt{3.733}} = \frac{-2}{1.932} = -1.036$$
16. **Step 5: Decision**
At $\alpha = 0.05$, critical Z values are $\pm 1.96$
Since $-1.036$ is within $-1.96$ and $1.96$, fail to reject null hypothesis.
---
**Final conclusion:**
All three tests (Median, Mann-Whitney U, Wald run) fail to reject the null hypothesis at 5% significance level, indicating no significant difference between the two laboratories' samples.
Lab Sample Test 3739Fc
Step-by-step solutions with LaTeX - clean, fast, and student-friendly.