The lifetimes, in hours, of two brands of batteries are given below :
Brand A : 40 30 40 45 55 30
Brand B : 50 50 45 55 60 40
Examine whether the two brands are different with respect to average life using (i) Kolmogorov-Smirnov test and (ii) median test.
[D_{6, 6, 0·05} = 4/6]
15 marks · directive: Examine
The core of a good answer
Kolmogorov-Smirnov: the largest gap between the two empirical CDFs is D = 3/6 = 0.5 (at 40 and 45 hours), less than the critical 4/6, so H₀ is not rejected. Median test: the pooled median is 45 hours, with 1 of 6 Brand A and 4 of 6 Brand B values above it; χ² = 3.09 < 3.84, so again no significant difference at 5%.
An outline written by upsc.help, not an official UPSC answer; every fact checked by a separate review. How we work
What the question asks
Two distribution-free two-sample tests are asked for. For the K-S test, build both empirical distribution functions at every observed value and compare the maximum absolute gap with the tabled value given. For the median test, find the combined median, form the 2 × 2 table of counts above and not above it, and test it (χ² with one degree of freedom). Marks 8 + 7.
Answer outline
Introduction
H₀: the two brands have the same lifetime distribution (same average life); H₁: they differ. n₁ = n₂ = 6, α = 0.05.
Step 1: Empirical CDFs (K-S)
- x = 30: F_A = 2/6, F_B = 0/6, gap 2/6.
- x = 40: F_A = 4/6, F_B = 1/6, gap 3/6.
- x = 45: F_A = 5/6, F_B = 2/6, gap 3/6.
- x = 50: F_A = 5/6, F_B = 4/6, gap 1/6.
- x = 55: F_A = 6/6, F_B = 5/6, gap 1/6.
- x = 60: both 1, gap 0.
Step 2: K-S decision
- D = max|F_A − F_B| = 3/6 = 0.5.
- D = 3/6 < D_{6,6,0.05} = 4/6, so H₀ is not rejected (Python exact p = 0.47).
Step 3: Combined median
- Pooled ordered sample: 30, 30, 40, 40, 40, 45, 45, 50, 50, 55, 55, 60.
- Median = (6th + 7th)/2 = (45 + 45)/2 = 45 hours.
Step 4: 2 × 2 table
- Above 45: A 1 (55), B 4 (50, 50, 55, 60); total 5.
- At or below 45: A 5, B 2; total 7.
- χ² = N(ad − bc)²/[(a + b)(c + d)(a + c)(b + d)] = 12(1×2 − 4×5)²/(5×7×6×6) = 3888/1260 = 3.09.
Step 5: Median test decision
- χ²₀.₀₅(1) = 3.84; 3.09 < 3.84, so H₀ is not rejected (with Yates correction χ² = 1.37).
- As a cross-check, Fisher's exact test on the same table gives two-sided p = 0.24 (p = 0.21 if the two values equal to the median are dropped); the conclusion is unchanged.
Conclusion
Both tests find no significant difference between the lifetimes of the two brands at the 5% level, although Brand B's values lie mostly to the right. With six batteries per brand both tests have low power. All figures were computed in Python.
Examples and data to cite
- K-S tests are used to compare whole distributions (location and shape); the median test looks only at location.
Facts to remember
- Two-sample K-S statistic: D = sup_x |F₁(x) − F₂(x)|; reject H₀ for large D.
- Median test: classify each observation as above or not above the pooled median and test the 2 × 2 table.
- 2 × 2 χ²: N(ad − bc)²/[(a + b)(c + d)(a + c)(b + d)], 1 d.f.; χ²₀.₀₅(1) = 3.84.