Menu Close

Non-parametric tests: UPSC Statistics Optional PYQ Solutions (1995–2026)

All 38 questions UPSC has asked on non-parametric tests in the Statistics Optional (Paper I, Statistical Inference) from 1995 to 2026, solved step by step – latest first.

Try them yourself first: the same questions, without solutions, are on our Statistical Inference topic-wise PYQs page.

How we check these solutions

These are our own solutions, prepared with AI help. UPSC does not publish official answers. Every solution is checked a second way before it goes up, and says how:

  • ✓ Checked by computer the numbers were worked out again independently in code (Python with NumPy/SciPy) and matched.
  • ✓ Proof checked step by step for “prove that” and “examine whether” questions, every step was checked against the definitions and the standard theorems.
  • ✓ Derivation checked step by step for derivations and approximations, every step was checked, and the result was also tested numerically.
  • ✓ Answer checked step by step for descriptive questions, every point was checked against the standard theory.

Spotted a mistake or a neater method? Tell us in the comments below or through Report an error.

Jump to a question (year · question number):

2026 · 3b 2025 · 4c 2024 · 4c 2023 · 1d 2022 · 4c 2021 · 4c 2020 · 4c 2019 · 4c 2018 · 1d 2017 · 3c 2016 · 3b 2015 · 4b 2014 · 2c 2013 · 1e 2013 · 4c 2012 · 4b 2011 · 1d 2010 · 1f 2010 · 4a 2006 · 1f 2006 · 3b 2005 · 1f 2005 · 4a 2004 · 1f 2003 · 4b 2002 · 3c 2001 · 2iv 2001 · 3iv 2000 · 1f 2000 · 4b(i) 1999 · 8b 1998 · 8a 1998 · 8b 1997 · 8c 1996 · 8b 1996 · 8c 1995 · 8a 1995 · 8b

Cover of the UPSC Prelims Topic-wise PYQ book with detailed explanations

From the Optional Province team

Preparing for Prelims too?

Our UPSC Prelims Topic-wise PYQ Book covers every Prelims question with detailed explanations, so you can see exactly where UPSC asks from. Now available as a hard copy and an eBook.

Buy Hard Copy on AmazonBuy eBook (PDF)

Download a free sample

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. [D6,6,0⋅05=46]

2026 · Paper I · Q3b · 15 marks

Solution

Data (ordered). A: 30, 30, 40, 40, 45, 55. B: 40, 45, 50, 50, 55, 60. m=n=6m=n=6.

(i) Kolmogorov–Smirnov two-sample test. H0H_0: the two lifetime distributions are the same. D=maxx|FA(x)−FB(x)|D=\max_x|F_A(x)-F_B(x)|.

xx 30 40 45 50 55 60
6FA(x)6F_A(x) 2 4 5 5 6 6
6FB(x)6F_B(x) 0 1 2 4 5 6
6|FA−FB|6\lvert F_A-F_B\rvert 2 3 3 1 1 0

D=36=0.5<D6,6,0.05=46.D=\frac36=0.5<D_{6,6,0.05}=\frac46 . We do not reject H0H_0.

(ii) Median test. The combined median of the 12 values is 4545. We drop the two values equal to 45, which leaves 10 values.

Above 45 Below 45 Total
A 1 4 5
B 4 1 5
Total 5 5 10

The counts are far too small for a χ2\chi^2 approximation, so we use the exact (hypergeometric) probability. The tables at least as extreme as this one have probabilities P(1)=(51)(54)(105)=25252,P(0)=1252,P(1)=\frac{\binom51\binom54}{\binom{10}5}=\frac{25}{252},\qquad P(0)=\frac1{252}, and the two-sided pp-value is 2×26252=0.206>0.052\times\frac{26}{252}=0.206>0.05. We do not reject H0H_0.

Conclusion. Neither test finds a significant difference between the two brands. (Brand B looks longer-lived, but the samples are too small to show it.)

✓ Checked by computer We computed both empirical distribution functions (D = 3/6 = 0.5) and the median-test table in Python. Fisher’s exact test on the median table gives p = 0.21.

↑ Back to the question list

The life of 6 items of brand-A and 6 items of brand-B are given below:

A 40 62 55 35 48 88
B 50 70 65 30 45 92

Using Kolmogorov-Smirnov test, test whether the distribution of life of both the brands are same or not at 5% level of significance. [Given that D(6,6,0⋅05)=2/3]

2025 · Paper I · Q4c · 15 marks

Solution

Hypotheses. H0H_0: the two brands have the same life distribution, FA=FBF_A=F_B. H1H_1: they differ.

Empirical distribution functions (m=n=6m=n=6), at the ordered combined values:

xx 30 35 40 45 48 50 55 62 65 70 88 92
6FA6F_A 0 1 2 2 3 3 4 5 5 5 6 6
6FB6F_B 1 1 1 2 2 3 3 3 4 5 5 6
6|FA−FB|6\lvert F_A-F_B\rvert 1 0 1 0 1 0 1 2 1 0 1 0

Test statistic. D=maxx|FA(x)−FB(x)|=26=13.D=\max_x|F_A(x)-F_B(x)|=\frac26=\frac13 .

2040608010000.51lifeproportion ≤ xD = 1/3Brand ABrand B
The two empirical distribution functions. The KS statistic D is the largest vertical gap between them: 1/3, at x = 62, well below the critical 2/3.

Decision. D=13<D6,6,0.05=23D=\frac13<D_{6,6,0.05}=\frac23. We do not reject H0H_0. The life distributions of the two brands may be taken as the same.

✓ Checked by computer We computed both empirical distribution functions at all 12 points in Python: D = 2/6, at x = 62.

↑ Back to the question list

Differentiate between Mann-Whitney U-test and Wilcoxon sign test. The following data pertain to APGAR scores of 15 pregnant women in two care programmes A and B:

Programme A 8 7 6 2 5 8 7 3
Programme B 9 9 7 8 10 9 6

Is there a significant difference in APGAR scores of pregnant women under the two care programmes? [Given, U(0⋅05)=10]

2024 · Paper I · Q4c · 15 marks

Solution

Mann–Whitney UU-test vs Wilcoxon sign test.

Mann–Whitney UU-test Sign test
Samples two independent samples one sample, or paired data
Hypothesis the two populations are identical (same location) the median equals a given value (or the median difference is 0)
Uses ranks of the combined sample only the signs of the differences
Information uses magnitudes, through ranks ignores magnitudes
Efficiency vs tt (normal data) 0.955 0.637

The data. H0H_0: APGAR scores have the same distribution under A and B. H1H_1: they differ. nA=8n_A=8, nB=7n_B=7.

Ranking the 15 scores together (average ranks for ties):

Score 2 3 5 6 6 7 7 7 8 8 8 9 9 9 10
Group A A A A B A A B A A B B B B B
Rank 1 2 3 4.5 4.5 7 7 7 10 10 10 13 13 13 15

RA=1+2+3+4.5+7+7+10+10=44.5,RB=120−44.5=75.5.R_A=1+2+3+4.5+7+7+10+10=44.5,\qquad R_B=120-44.5=75.5 . UA=RA−8⋅92=8.5,UB=RB−7⋅82=47.5,UA+UB=56=nAnB.U_A=R_A-\frac{8\cdot9}2=8.5,\qquad U_B=R_B-\frac{7\cdot8}2=47.5,\qquad U_A+U_B=56=n_An_B .

Decision. U=min(UA,UB)=8.5≤U0.05=10U=\min(U_A,U_B)=8.5\le U_{0.05}=10. We reject H0H_0 at the 5% level. Programme B gives significantly higher APGAR scores.

✓ Checked by computer We ranked the 15 scores with average ranks for ties: R_A = 44.5, U = 8.5. SciPy’s Mann–Whitney test agrees (U = 8.5, p = 0.026).

↑ Back to the question list

Apply Run Test to test the randomness of the following sequence of H and T at 5% level of significance: HHHHHHTHHHHHTHTHHHH TTHHHHTHHHTTHHHHHH THHTTHHTHHH Given: Z(0.025)=1.96, Z(0.05)=1.645

2023 · Paper I · Q1d · 10 marks

Solution

Counts. The sequence has N=48N=48 symbols: n1=36n_1=36 heads and n2=12n_2=12 tails. Counting the runs (maximal blocks of the same symbol): R=19.R=19 .

Null distribution (large sample). Under randomness, E(R)=1+2n1n2N=1+2×36×1248=19,E(R)=1+\frac{2n_1n_2}N=1+\frac{2\times36\times12}{48}=19, V(R)=2n1n2(2n1n2−N)N2(N−1)=864×8162304×47=6.51.V(R)=\frac{2n_1n_2(2n_1n_2-N)}{N^2(N-1)}=\frac{864\times816}{2304\times47}=6.51 .

Test statistic. Z=R−E(R)V(R)=19−192.55=0.Z=\frac{R-E(R)}{\sqrt{V(R)}}=\frac{19-19}{2.55}=0 .

Decision. |Z|=0<1.96|Z|=0<1.96. We do not reject H0H_0: the sequence may be regarded as random.

✓ Checked by computer We counted the sequence in Python: 48 tosses, 36 H, 12 T, 19 runs. E(R) = 19, so Z = 0.

↑ Back to the question list

The following data present the time (in minutes), that a commuter had to wait to catch a bus to reach his destination:

Days Time Days Time
1 23 11 14
2 25 12 14
3 12 13 16
4 07 14 19
5 17 15 23
6 16 16 24
7 13 17 12
8 26 18 18
9 27 19 11
10 12 20 08

Use the sign-test at 0.05 level of significance to test the claim of the bus operators that commuters do not have to wait for more than 15 minutes before the bus is made available to them. [Given Z(0.025)=1.96,Z(0.05)=1.645]

2022 · Paper I · Q4c · 15 marks

Solution

Hypotheses. Let MM be the median waiting time. The operators’ claim is H0:M≤15againstH1:M>15.H_0:M\le15\qquad\text{against}\qquad H_1:M>15 .

Signs. Mark each day ++ if the wait exceeds 15 minutes, and −– if it is less. No value equals 15.

  • ++ (above 15): 23, 25, 17, 16, 26, 27, 16, 19, 23, 24, 18 → 11
  • −– (below 15): 12, 7, 13, 12, 14, 14, 12, 11, 8 → 9

n=20n=20. Under H0H_0 (at M=15M=15), the number of ++ signs X∼B(20,12)X\sim B(20,\frac12).

Test statistic (normal approximation): Z=X−n/2n/4=11−105=0.447.Z=\frac{X-n/2}{\sqrt{n/4}}=\frac{11-10}{\sqrt5}=0.447 . (The exact pp-value is P(X≥11)=0.412P(X\ge11)=0.412.)

Decision. Z=0.447<z0.05=1.645Z=0.447<z_{0.05}=1.645. We do not reject H0H_0. The data support the claim that commuters do not usually wait more than 15 minutes.

✓ Checked by computer We counted 11 values above 15 and 9 below. The exact binomial p-value is P(X ≥ 11) = 0.412, and Z = 0.45.

↑ Back to the question list

A company’s trainees are randomly assigned to groups which are through a certain industrial inspection procedure by three different methods. At the end of the instructing period they are tested for inspection performance quality. The following are their scores:

Method A: 80 83 79 85 90 68
Method B: 82 84 60 72 86 67 91
Method C: 93 65 77 78 88

Using the appropriate non-parametric test, determine at 0.05 level of significance whether the three methods are equally effective.

2021 · Paper I · Q4c · 15 marks

Solution

Test. The three samples are independent, and the scores need not be normal, so we use the Kruskal–Wallis HH test. H0H_0: the three methods are equally effective (identical distributions).

Ranks (all 18 scores together):

Method Scores (rank) nin_i RiR_i
A 80 (9), 83 (11), 79 (8), 85 (13), 90 (16), 68 (4) 6 61
B 82 (10), 84 (12), 60 (1), 72 (5), 86 (14), 67 (3), 91 (17) 7 62
C 93 (18), 65 (2), 77 (6), 78 (7), 88 (15) 5 48

Check: 61+62+48=171=18×19261+62+48=171=\frac{18\times19}2.

Test statistic. N=18N=18: H=12N(N+1)∑Ri2ni−3(N+1)=12342(6126+6227+4825)−57.H=\frac{12}{N(N+1)}\sum\frac{R_i^2}{n_i}-3(N+1)=\frac{12}{342}\Big(\frac{61^2}6+\frac{62^2}7+\frac{48^2}5\Big)-57 . =12342(620.17+549.14+460.80)−57=57.197−57=0.197.=\frac{12}{342}(620.17+549.14+460.80)-57=57.197-57=0.197 .

Decision. Under H0H_0, HH is approximately χ22\chi^2_2, with χ2,0.052=5.991\chi^2_{2,0.05}=5.991. Since 0.197<5.9910.197<5.991, we do not reject H0H_0. The three methods appear equally effective.

✓ Checked by computer We ranked all 18 scores and computed H = 0.197 in Python. SciPy’s Kruskal–Wallis test agrees (p = 0.91).

↑ Back to the question list

A random sample of 14 male students from a rural Junior High School and an independent random sample of 16 male students from an urban Junior High School were given a test to measure their level of mental health. The obtained data are given in the following table: Mental Health Scores of Junior High Schools’ male students:

Rural 28, 49, 42, 30, 33, 36, 49, 31, 41, 46, 41, 21, 20, 28
Urban 37, 22, 24, 24, 27, 44, 34, 26, 20, 26, 25, 45, 32, 40, 45, 25

Apply Median Test to test the hypothesis at 5% level of significance that their median mental health level scores are equal or not. [Given that χ(1,0.05)2=3.841]

2020 · Paper I · Q4c · 15 marks

Solution

Combined median. All 30 scores ordered: the 15th and 16th values are 31 and 32, so the median is 31.531.5.

Contingency table.

Above 31.5 Below 31.5 Total
Rural 8 6 14
Urban 7 9 16
Total 15 15 30

Expected frequencies. Rural: 14×1530=714\times\frac{15}{30}=7 in each column. Urban: 88 in each column.

Test statistic. χ2=(8−7)27+(6−7)27+(7−8)28+(9−8)28=27+28=0.536.\chi^2=\frac{(8-7)^2}7+\frac{(6-7)^2}7+\frac{(7-8)^2}8+\frac{(9-8)^2}8=\frac27+\frac28=0.536 . (Equivalently, χ2=N(ad−bc)2(a+b)(c+d)(a+c)(b+d)=30(72−42)214⋅16⋅15⋅15=0.536\chi^2=\dfrac{N(ad-bc)^2}{(a+b)(c+d)(a+c)(b+d)}=\dfrac{30(72-42)^2}{14\cdot16\cdot15\cdot15}=0.536.)

Decision. 0.536<χ1,0.052=3.8410.536<\chi^2_{1,0.05}=3.841. We do not reject H0H_0. The median mental-health scores of rural and urban students may be taken as equal.

✓ Checked by computer We found the combined median 31.5, built the 2 × 2 table, and computed χ² = 0.536 in Python (0.134 with Yates’ correction).

↑ Back to the question list

Weddell seals live in the Antarctic and feed on fish during long, deep dives in freezing water. The seals benefit from these feeding dives, but the food they gain comes at a metabolic cost. A set of researchers wanted to know whether feeding per se was also energetically expensive, over and above the exertion of a regular dive. They measured the metabolic cost of 10 feeding dives and for each of these also measured a non-feeding dive by the same animal that lasted the same amount of time. The data are given below:

Individual Oxygen consumption after non-feeding dive (mL O2kg−1) Oxygen consumption after feeding dive (mL O2kg−1)
1 42 71
2 52 77
3 60 83
4 67 96
5 82 107
6 82 113
7 81 121
8 81 80
9 96 128
10 104 143

Mention assumptions about the populations and carry out an appropriate non-parametric test of hypothesis that the energetic cost is the same for feeding and non-feeding dives at level α=0.05.

2019 · Paper I · Q4c · 15 marks

Solution

Design. Each seal gives a feeding and a non-feeding dive of the same length, so the data are paired. We use the Wilcoxon signed-rank test on the differences d=feeding−non-feedingd=\text{feeding}-\text{non-feeding}.

Assumptions.

  1. The 10 differences are independent (different seals).
  2. The distribution of differences is continuous and symmetric about its median θ\theta. (No normality is assumed.)

Hypotheses. H0:θ=0H_0:\theta=0 (same energetic cost) against H1:θ≠0H_1:\theta\ne0.

Signed ranks.

Seal 1 2 3 4 5 6 7 8 9 10
dd 29 25 23 29 25 31 40 −1 32 39
Rank of |d|\lvert d\rvert 5.5 3.5 2 5.5 3.5 7 10 1 8 9

T−=1,T+=54,T++T−=55=10×112.T^-=1,\qquad T^+=54,\qquad T^++T^-=55=\frac{10\times11}2 .

Decision. For n=10n=10 and two-sided α=0.05\alpha=0.05, the critical value is 8: reject if min(T+,T−)≤8\min(T^+,T^-)\le8. Here T=1≤8T=1\le8, so we reject H0H_0. (Exact pp-value =0.0039=0.0039.)

Conclusion. Feeding dives cost significantly more oxygen than non-feeding dives of the same length. Feeding itself is energetically expensive.

✓ Checked by computer We computed the differences and signed ranks in Python: T⁻ = 1 and T⁺ = 54. SciPy’s exact Wilcoxon test gives p = 0.0039.

↑ Back to the question list

The following data represents lifetime (hours) of batteries for two different brands:

Brand A 40 30 40 45 55 30
Brand B 50 50 45 55 60 40

Use the Median test to conclude if the two samples come from the same population.

2018 · Paper I · Q1d · 10 marks

Solution

Combined sample (12 values, ordered): 30, 30, 40, 40, 40, 45, 45, 50, 50, 55, 55, 60. The median is 45+452=45\frac{45+45}2=45.

Classify each value. We drop the two values equal to the median (one from each brand):

Above 45 Below 45 Total
Brand A 1 4 5
Brand B 4 1 5
Total 5 5 10

Test. H0H_0: both samples come from the same population (equal medians). Expected counts are 2.5, far too small for χ2\chi^2, so we use the exact hypergeometric probabilities: P(A has ≤1 above)=(50)(55)+(51)(54)(105)=26252=0.103.P(\text{A has }\le1\text{ above})=\frac{\binom50\binom55+\binom51\binom54}{\binom{10}5}=\frac{26}{252}=0.103 . The two-sided pp-value is 2×0.103=0.2062\times0.103=0.206.

Decision. p=0.206>0.05p=0.206>0.05. We do not reject H0H_0. The two samples may have come from the same population.

(If the χ2\chi^2 approximation is used anyway, χ2=10(1−16)254=3.6<3.841\chi^2=\frac{10(1-16)^2}{5^4}=3.6<3.841, with the same conclusion.)

✓ Checked by computer We found the combined median 45 and the 2 × 2 table in Python. Fisher’s exact test gives p = 0.21.

↑ Back to the question list

Using Kolmogorov-Smirnov test, determine whether the sample data given below come from an exponential distribution with mean 4. The observations in the sample are 0.7,5.5,5.7,4.3,0.8,1.1,5.1,4.9,2.0,3.9,5.3,4.2,5.2,5.8,6.0 (Given, D13,0.05=0.361, D14,0.05=0.349, D15,0.05=0.338)

2017 · Paper I · Q3c · 15 marks

Solution

Hypothesis. H0H_0: the sample comes from the exponential distribution with mean 4: F0(x)=1−e−x/4,x>0.F_0(x)=1-e^{-x/4},\qquad x>0 .

Ordered sample and gaps (n=15n=15). D+=max(i15−F0(x(i)))D^+=\max\big(\frac i{15}-F_0(x_{(i)})\big) and D−=max(F0(x(i))−i−115)D^-=\max\big(F_0(x_{(i)})-\frac{i-1}{15}\big).

ii x(i)x_{(i)} F0F_0 i15−F0\frac i{15}-F_0 F0−i−115F_0-\frac{i-1}{15}
1 0.7 0.161 −0.094 0.161
2 0.8 0.181 −0.048 0.115
3 1.1 0.240 −0.040 0.107
4 2.0 0.393 −0.127 0.193
5 3.9 0.623 −0.289 0.356
6 4.2 0.650 −0.250 0.317
7 4.3 0.659 −0.192 0.259
8 4.9 0.706 −0.173 0.240
9 5.1 0.721 −0.121 0.187
10 5.2 0.727 −0.061 0.127
11 5.3 0.734 −0.001 0.068
12 5.5 0.747 0.053 0.014
13 5.7 0.759 0.107 −0.041
14 5.8 0.765 0.168 −0.101
15 6.0 0.777 0.223 −0.156

D=max(D+,D−)=0.356.D=\max(D^+,D^-)=0.356 .

0246800.51xF(x)D = 0.356sample F₁₅(x)F₀(x) = 1 − e^(−x/4)
The sample distribution function against the hypothesised exponential (mean 4). The largest gap, 0.356, occurs just before x = 3.9 and exceeds the critical 0.338.

Decision. D=0.356>D15,0.05=0.338D=0.356>D_{15,0.05}=0.338. We reject H0H_0 at the 5% level. The data are not consistent with an exponential distribution with mean 4. (Too many values are bunched between 4 and 6.)

✓ Checked by computer We computed F₀ at each ordered value and both one-sided gaps in Python: D⁺ = 0.223 and D⁻ = 0.356. SciPy’s KS test agrees (p = 0.033).

↑ Back to the question list

Test the hypothesis of no difference between the ages of 10 married couples using Mann-Whitney U-test for the sample data at 10% level of significance. (Use normal probability integral table):

Age (in years)
Male 26 43 35 38 33 42 40 44 25 31
Female 47 48 34 34 47 35 32 35 30 44

Solution

Note on the question. The data are 10 married couples, so the ages are naturally paired. A paired test (sign or signed-rank test) would be more appropriate. As the question asks, we use the Mann–Whitney test, treating the two groups as independent samples. (The signed-rank test also finds no difference: p=0.54p=0.54.)

Hypotheses. H0H_0: male and female ages have the same distribution. H1H_1: they differ. m=n=10m=n=10.

Ranks (combined, average ranks for ties):

  • Male: 26 (2), 43 (15), 35 (10), 38 (12), 33 (6), 42 (14), 40 (13), 44 (16.5), 25 (1), 31 (4). RM=93.5R_M=93.5.
  • Female: 47 (18.5), 48 (20), 34 (7.5), 34 (7.5), 47 (18.5), 35 (10), 32 (5), 35 (10), 30 (3), 44 (16.5). RF=116.5R_F=116.5.

U=RM−10×112=93.5−55=38.5.U=R_M-\frac{10\times11}2=93.5-55=38.5 .

Normal approximation. E(U)=mn2=50.E(U)=\frac{mn}2=50 . V(U)=mn12[(N+1)−∑(t3−t)N(N−1)]=10012[21−42380]=174.08.V(U)=\frac{mn}{12}\Big[(N+1)-\frac{\sum(t^3-t)}{N(N-1)}\Big]=\frac{100}{12}\Big[21-\frac{42}{380}\Big]=174.08 . The tied groups are (34, 34), (44, 44), (47, 47) and (35, 35, 35), so ∑(t3−t)=6+6+6+24=42\sum(t^3-t)=6+6+6+24=42. Z=38.5−50174.08=−11.513.19=−0.87.Z=\frac{38.5-50}{\sqrt{174.08}}=\frac{-11.5}{13.19}=-0.87 .

Decision. |Z|=0.87<z0.05=1.645|Z|=0.87<z_{0.05}=1.645 (two-sided 10% level). We do not reject H0H_0. There is no significant difference between the ages of husbands and wives.

✓ Checked by computer We ranked the 20 ages with average ranks for ties: R_M = 93.5, U = 38.5. With the tie correction, Z = −0.87. SciPy agrees (p = 0.40).

2016 · Paper I · Q3b · 15 marks

↑ Back to the question list

Suppose that X and Y have cdf F and G respectively. Given independent random samples (x1,x2,…xm) and (y1,y2,…yn) from these distributions, construct Mann-Whitney test of H0:F(t)=G(t) for all t against the alternative that F(t)>G(t) for at least one t. Also indicate the test when the alternative is F(t)≠G(t) for some t. State the test you would use when m and n are large.

2015 · Paper I · Q4b · 15 marks

Solution

Statistic. Let U=∑i=1m∑j=1nI(Xi<Yj)=number of pairs (Xi,Yj) with Xi<Yj.U=\sum_{i=1}^m\sum_{j=1}^nI(X_i<Y_j)=\text{number of pairs }(X_i,Y_j)\text{ with }X_i<Y_j . Equivalently, U=RY−n(n+1)2U=R_Y-\frac{n(n+1)}2, where RYR_Y is the sum of the ranks of the YY’s in the combined sample.

Null distribution. Under H0:F=GH_0:F=G, all (m+nm)\binom{m+n}m arrangements of the combined sample are equally likely. So the distribution of UU is free of FF and can be tabulated. It is symmetric about E(U)=mn2,V(U)=mn(m+n+1)12.E(U)=\frac{mn}2,\qquad V(U)=\frac{mn(m+n+1)}{12}.

One-sided alternative F(t)>G(t)F(t)>G(t) for some tt. F≥GF\ge G (strict somewhere) means XX is stochastically smaller than YY. Then YY’s tend to exceed XX’s, and UU tends to be large: reject H0 if U≥uα,PH0(U≥uα)≤α.\text{reject }H_0\ \text{ if }\ U\ge u_\alpha,\qquad P_{H_0}(U\ge u_\alpha)\le\alpha .

Two-sided alternative F(t)≠G(t)F(t)\ne G(t). Reject when UU is too large or too small: reject H0 if U≤u′α/2 or U≥uα/2,\text{reject }H_0\ \text{ if }\ U\le u'_{\alpha/2}\ \text{ or }\ U\ge u_{\alpha/2}, with u′α/2=mn−uα/2u'_{\alpha/2}=mn-u_{\alpha/2}, by symmetry.

Large mm and nn. Use the normal approximation: Z=U−mn/2mn(m+n+1)/12∼̇N(0,1).Z=\frac{U-mn/2}{\sqrt{mn(m+n+1)/12}}\ \dot\sim\ N(0,1).

  • One-sided (F>GF>G): reject if Z>zαZ>z_\alpha.
  • Two-sided: reject if |Z|>zα/2|Z|>z_{\alpha/2}.

With ties, use average ranks and replace (m+n+1)(m+n+1) by (N+1)−∑(t3−t)N(N−1)(N+1)-\frac{\sum(t^3-t)}{N(N-1)}, N=m+nN=m+n.

✓ Derivation checked step by step Every step was checked: the definition of U, its null mean and variance, and the direction of the one-sided rejection region.

↑ Back to the question list

A die is rolled 15 times with the following results:

Face value 1 2 3 4 5 6
Frequency 0 1 4 0 4 6

Use Kolmogorov-Smirnov statistic to test whether the die is unbiased or not. (Given D15;0.05=0.304)

2014 · Paper I · Q2c · 15 marks

Solution

Hypothesis. H0H_0: the die is unbiased, so F0(k)=k/6F_0(k)=k/6.

Cumulative proportions (n=15n=15):

Face kk 1 2 3 4 5 6
Frequency 0 1 4 0 4 6
F15(k)F_{15}(k) 0 1/15 5/15 5/15 9/15 1
F0(k)F_0(k) 1/6 2/6 3/6 4/6 5/6 1
|F15−F0|\lvert F_{15}-F_0\rvert 0.167 0.267 0.167 0.333 0.233 0

D=maxk|F15(k)−F0(k)|=0.333.D=\max_k|F_{15}(k)-F_0(k)|=0.333 .

Decision. D=0.333>D15;0.05=0.304D=0.333>D_{15;0.05}=0.304. We reject H0H_0: the die appears biased towards high faces.

(For a discrete distribution, the usual KS critical values are conservative: the true size is below 5%. Since we still reject, the conclusion stands.)

✓ Checked by computer We computed the cumulative proportions and D = 1/3 in Python.

↑ Back to the question list

Use sign test statistic to find a non-trivial distribution free confidence interval for population median of a continuous distribution.

2013 · Paper I · Q1e · 10 marks

Solution

Set-up. X1,…,XnX_1,\dots,X_n from a continuous distribution with median MM. Order them: X(1)<…<X(n)X_{(1)}<\dots<X_{(n)}.

Link with the sign test. For a value mm, let B(m)B(m) be the number of observations greater than mm. The sign test of H0:M=mH_0:M=m uses B(m)∼B(n,12)B(m)\sim B(n,\frac12) under H0H_0. The two-sided sign test at level α\alpha accepts H0H_0 when r≤B(m)≤n−r,r\le B(m)\le n-r, where rr is the largest integer with P(B≤r−1)≤α2P(B\le r-1)\le\frac\alpha2, for B∼B(n,12)B\sim B(n,\frac12).

Invert the test. B(m)≥rB(m)\ge r means at least rr observations exceed mm, that is, m<X(n−r+1)m<X_{(n-r+1)}. And B(m)≤n−rB(m)\le n-r means m≥X(r)m\ge X_{(r)}. So the set of medians accepted is X(r)≤m<X(n−r+1).X_{(r)}\le m<X_{(n-r+1)} .

Confidence interval. (X(r),X(n−r+1))\big(X_{(r)},\ X_{(n-r+1)}\big) is a confidence interval for MM with confidence coefficient P(X(r)<M<X(n−r+1))=P(r≤B≤n−r)=1−2∑k=0r−1(nk)(12)n.P\big(X_{(r)}<M<X_{(n-r+1)}\big)=P(r\le B\le n-r)=1-2\sum_{k=0}^{r-1}\binom nk\Big(\frac12\Big)^n . It is distribution-free, because B(M)∼B(n,12)B(M)\sim B(n,\frac12) whatever the continuous distribution.

Example (n=10n=10):

Interval (X(1),X(10))(X_{(1)},X_{(10)}) (X(2),X(9))(X_{(2)},X_{(9)}) (X(3),X(8))(X_{(3)},X_{(8)})
Confidence 0.998 0.979 0.891

So (X(2),X(9))(X_{(2)},X_{(9)}) is a 97.9% interval, the shortest one with at least 95% confidence.

✓ Proof checked step by step Every step was checked: the coverage probability equals P(r ≤ B ≤ n − r) for B ~ B(n, ½). We also checked this by simulation (n = 10, r = 2: coverage 0.979).

↑ Back to the question list

To compare two brands of tyres, the following milages (in ‘000’ miles) were obtained for 8 tyres of each kind: Brand A: 32.1, 20.6, 17.8, 28.4, 19.6, 21.4, 19.9, 30.1 Brand B: 19.8, 27.6, 30.8, 27.8, 34.1, 18.7, 16.9, 17.9 Test the null hypothesis at α=0.05 that the two samples come from the same population using Mann – Whitney test. [Table value: U(8,8,0.025)=50, U(8,8,0.05)=48] where P[U>U(m,n,α)]≤α.

2013 · Paper I · Q4c · 15 marks

Solution

Hypotheses. H0H_0: the two samples come from the same population. H1H_1: they do not. m=n=8m=n=8, α=0.05\alpha=0.05 (two-sided).

Ranks (combined, all values distinct):

  • A: 32.1 (15), 20.6 (8), 17.8 (2), 28.4 (12), 19.6 (5), 21.4 (9), 19.9 (7), 30.1 (13). RA=71R_A=71.
  • B: 19.8 (6), 27.6 (10), 30.8 (14), 27.8 (11), 34.1 (16), 18.7 (4), 16.9 (1), 17.9 (3). RB=65R_B=65.

Check: 71+65=136=16×17271+65=136=\frac{16\times17}2.

UU statistics. UA=RA−8×92=71−36=35,UB=64−35=29.U_A=R_A-\frac{8\times9}2=71-36=35,\qquad U_B=64-35=29 .

Decision. The table gives P[U>50]≤0.025P[U>50]\le0.025. By symmetry about mn/2=32mn/2=32, the two-sided 5% test rejects if U>50U>50 or U<64−50=14U<64-50=14. Both UA=35U_A=35 and UB=29U_B=29 lie between 14 and 50. We do not reject H0H_0. The two brands give similar mileages.

✓ Checked by computer We ranked the 16 mileages in Python: R_A = 71, U_A = 35, U_B = 29. SciPy agrees (p = 0.80).

↑ Back to the question list

Compare the Chi-square test and Kolmogrov-Smirnov test as tests for goodness of fit. Show that the Kolmogrov-Smirnov one sample test is distribution free. Also state the large sample distribution of the Kolmogrov-Smirnov test statistic.

2012 · Paper I · Q4b · 20 marks

Solution

Comparison of the two goodness-of-fit tests.

χ2\chi^2 test Kolmogorov–Smirnov test
Data grouped into classes individual observations
Distribution discrete or continuous continuous (conservative if discrete)
Statistic ∑(O−E)2/E\sum(O-E)^2/E Dn=supx|Fn(x)−F0(x)|D_n=\sup_x\lvert F_n(x)-F_0(x)\rvert
Null distribution approximate (χ2\chi^2), for large nn exact for every nn, distribution-free
Small samples not valid (needs Ei≥5E_i\ge5) valid
Estimated parameters allowed (lose 1 df each) standard tables invalid; need adjusted tables (e.g. Lilliefors)
Grouping result depends on the choice of classes no arbitrary grouping
One-sided alternatives no yes (Dn+D_n^+, Dn−D_n^-)
Power lower for continuous data usually higher
Extra uses contingency tables, multinomial data confidence bands for FF

The one-sample KS statistic is distribution-free. Let F0F_0 be continuous, and put Ui=F0(Xi)U_i=F_0(X_i). By the probability integral transform, U1,…,UnU_1,\dots,U_n are i.i.d. U(0,1)U(0,1) under H0H_0.

Since F0F_0 is non-decreasing, Xi≤x⇔Ui≤F0(x)X_i\le x\iff U_i\le F_0(x) (up to events of probability zero). So Fn(x)=1n#{Xi≤x}=1n#{Ui≤F0(x)}=Gn(F0(x)),F_n(x)=\frac1n\#\{X_i\le x\}=\frac1n\#\{U_i\le F_0(x)\}=G_n\big(F_0(x)\big), where GnG_n is the empirical distribution function of the UiU_i. Writing u=F0(x)u=F_0(x), which runs over (0,1)(0,1) as xx runs over the real line, Dn=supx|Fn(x)−F0(x)|=sup0<u<1|Gn(u)−u|.D_n=\sup_x|F_n(x)-F_0(x)|=\sup_{0<u<1}|G_n(u)-u| . The right side depends only on a uniform sample. So the distribution of DnD_n is the same for every continuous F0F_0. ◼\blacksquare

Large-sample distribution (Kolmogorov). For every λ>0\lambda>0, limn→∞P(nDn≤λ)=1−2∑k=1∞(−1)k−1e−2k2λ2.\lim_{n\to\infty}P\big(\sqrt n\,D_n\le\lambda\big)=1-2\sum_{k=1}^\infty(-1)^{k-1}e^{-2k^2\lambda^2}. For example, the 5% point is λ=1.358\lambda=1.358, so for large nn we reject at 5% if Dn>1.358/nD_n>1.358/\sqrt n. For the one-sided statistic, P(nDn+≤λ)→1−e−2λ2P(\sqrt nD_n^+\le\lambda)\to1-e^{-2\lambda^2}.

✓ Proof checked step by step Every step was checked: the probability integral transform makes the statistic’s distribution free of F₀, and the Kolmogorov limit was checked against its standard form.

↑ Back to the question list

Scores of 10 candidates of Civil Service Main Examination of a recent year in Statistics Papers I and II are as under:

Serial No. of Candidates 1 2 3 4 5 6 7 8 9 10
Score in Statistics I 98 172 58 106 185 89 140 168 102 202
Score in Statistics II 69 123 65 120 131 92 96 120 75 174

Use sign test to verify the hypothesis that candidates in the above examination offering both the Papers of Statistics scored higher on an average in Paper I than in Paper II.

2011 · Paper I · Q1d · 12 marks

Solution

Hypotheses. The data are paired (the same candidate in both papers). Let θ\theta be the median of d=Paper I−Paper IId=\text{Paper I}-\text{Paper II}. H0:θ=0againstH1:θ>0(Paper I scores higher).H_0:\theta=0\qquad\text{against}\qquad H_1:\theta>0\ \ (\text{Paper I scores higher}).

Signs.

Candidate 1 2 3 4 5 6 7 8 9 10
dd 29 49 −7 −14 54 −3 44 48 27 28
Sign + + − − + − + + + +

Number of ++ signs: X=7X=7, with n=10n=10. Under H0H_0, X∼B(10,12)X\sim B(10,\frac12).

pp-value. P(X≥7)=(107)+(108)+(109)+(1010)210=120+45+10+11024=1761024=0.172.P(X\ge7)=\frac{\binom{10}7+\binom{10}8+\binom{10}9+\binom{10}{10}}{2^{10}}=\frac{120+45+10+1}{1024}=\frac{176}{1024}=0.172 .

Decision. 0.172>0.050.172>0.05. We do not reject H0H_0. The sign test does not show that candidates scored higher in Paper I. (The rejection region at 5% would be X≥9X\ge9, with size 11/1024=0.01111/1024=0.011.)

✓ Checked by computer We computed the 10 differences in Python: 7 plus and 3 minus. The exact one-sided p-value is P(X ≥ 7) = 0.172.

↑ Back to the question list

Let UX be the number of Y’s those are smaller than X’s in independent random samples X1,X2,…,Xn and Y1,Y2,…,Ym. Find E(UX).

2010 · Paper I · Q1f · 12 marks

Solution

Definition. UXU_X counts the pairs in which a YY is smaller than an XX: UX=∑i=1n∑j=1mI(Yj<Xi).U_X=\sum_{i=1}^n\sum_{j=1}^mI(Y_j<X_i).

Expectation. Each indicator has the same expectation, EI(Yj<Xi)=P(Y<X)E\,I(Y_j<X_i)=P(Y<X). By linearity, E(UX)=nmP(Y<X)=nm∫−∞∞G(x)dF(x),E(U_X)=nm\,P(Y<X)=nm\int_{-\infty}^\infty G(x)\,dF(x), where FF and GG are the distribution functions of XX and YY.

Under H0H_0 (same continuous distribution). P(Y<X)=12P(Y<X)=\frac12 by symmetry (ties have probability 0). So E(UX)=mn2.E(U_X)=\frac{mn}2 .

Example: if X∼N(μ1,σ2)X\sim N(\mu_1,\sigma^2) and Y∼N(μ2,σ2)Y\sim N(\mu_2,\sigma^2), then P(Y<X)=Φ(μ1−μ2σ2)P(Y<X)=\Phi\big(\frac{\mu_1-\mu_2}{\sigma\sqrt2}\big), and E(UX)=mnΦ(μ1−μ2σ2)E(U_X)=mn\,\Phi\big(\frac{\mu_1-\mu_2}{\sigma\sqrt2}\big).

✓ Proof checked step by step Every step was checked: U is a sum of indicators, and each indicator has expectation P(Y < X).

↑ Back to the question list

The following is a random sample of 10 numbers lying between (0,1): 0·22 0·90 0·96 0·78 0·66 0·18 0·73 0·58 0·11 0·97 We wish to test the hypothesis H0: sample comes from uniform distribution on (0,1). Explain, how you will use Kolmogorov-Smirnov test of goodness of fit for H0. Obtain the value of test statistic.

2010 · Paper I · Q4a · 20 marks

Solution

Method.

  1. H0H_0: the data come from U(0,1)U(0,1), so F0(x)=xF_0(x)=x for 0<x<10<x<1.
  2. Order the sample, and compare the empirical distribution function F10F_{10} with F0F_0 at each observation, from both sides: D+=maxi(i10−x(i)),D−=maxi(x(i)−i−110),D=max(D+,D−).D^+=\max_i\Big(\frac i{10}-x_{(i)}\Big),\qquad D^-=\max_i\Big(x_{(i)}-\frac{i-1}{10}\Big),\qquad D=\max(D^+,D^-).
  3. Reject H0H_0 at level α\alpha if D>D10,αD>D_{10,\alpha} (from the KS table: D10,0.05=0.409D_{10,0.05}=0.409).

Computation.

ii 1 2 3 4 5 6 7 8 9 10
x(i)x_{(i)} 0.11 0.18 0.22 0.58 0.66 0.73 0.78 0.90 0.96 0.97
i10−x(i)\frac i{10}-x_{(i)} −0.01 0.02 0.08 −0.18 −0.16 −0.13 −0.08 −0.10 −0.06 0.03
x(i)−i−110x_{(i)}-\frac{i-1}{10} 0.11 0.08 0.02 0.28 0.26 0.23 0.18 0.20 0.16 0.07

D+=0.08,D−=0.28,D=0.28.D^+=0.08,\qquad D^-=0.28,\qquad D=0.28 .

Decision. D=0.28<0.409D=0.28<0.409. We do not reject H0H_0: the sample is consistent with the uniform distribution on (0,1)(0,1).

✓ Checked by computer We computed D⁺ = 0.08 and D⁻ = 0.28 in Python. SciPy agrees (D = 0.28, p = 0.35), and the exact 5% critical value for n = 10 is 0.409.

↑ Back to the question list

Cover of the UPSC Mains Topic-wise and Year-wise PYQs book (2013–2026)

From the Optional Province team

Strengthen your GS papers

Our UPSC Mains Topic-wise & Year-wise PYQ Book (2013–2026) maps every GS question to the syllabus, so you know what UPSC asks and how often. Now available as a hard copy and an eBook.

Buy Hard Copy on AmazonBuy eBook (PDF)

Download a free sample

Explain run test. The following arrangement of defective (d) and non-defective (n) pieces produced in the given order by a certain machine was observed nnnnn dddd nnnnnnnnnn dd nn dddd n dd nn Test for randomness at 0.01 level of significance. (Area under standard normal curve from 0 to 2.575 is 0.495)

2006 · Paper I · Q1f · 12 marks

Solution

Run test. A run is a maximal block of identical symbols. For a sequence of n1n_1 symbols of one kind and n2n_2 of the other, too few runs suggest clustering (trend), and too many suggest alternation. Under randomness, the number of runs RR has E(R)=1+2n1n2N,V(R)=2n1n2(2n1n2−N)N2(N−1),N=n1+n2,E(R)=1+\frac{2n_1n_2}N,\qquad V(R)=\frac{2n_1n_2(2n_1n_2-N)}{N^2(N-1)},\qquad N=n_1+n_2, and for large samples Z=R−E(R)V(R)Z=\frac{R-E(R)}{\sqrt{V(R)}} is approximately N(0,1)N(0,1).

The data. nnnnn | dddd | nnnnnnnnnn | dd | nn | dddd | n | dd | nn. n1=20(n),n2=12(d),N=32,R=9.n_1=20\ (\text{n}),\qquad n_2=12\ (\text{d}),\qquad N=32,\qquad R=9 .

Computation. E(R)=1+2×20×1232=16,V(R)=480×4481024×31=6.774,V(R)=2.603.E(R)=1+\frac{2\times20\times12}{32}=16,\qquad V(R)=\frac{480\times448}{1024\times31}=6.774,\qquad\sqrt{V(R)}=2.603 . Z=9−162.603=−2.69.Z=\frac{9-16}{2.603}=-2.69 .

Decision. At the 1% level (two-sided), the critical value is 2.5752.575. |Z|=2.69>2.575|Z|=2.69>2.575, so we reject randomness. There are too few runs: defectives tend to come in clusters, which suggests the machine goes out of adjustment for spells.

(With a continuity correction, Z=9.5−162.603=−2.50Z=\frac{9.5-16}{2.603}=-2.50, just inside the acceptance region. The result is borderline at 1%, but clearly significant at 5%.)

✓ Checked by computer We counted the sequence in Python: 20 n’s, 12 d’s and 9 runs; E(R) = 16, V(R) = 6.774, Z = −2.69 (−2.50 with a continuity correction).

↑ Back to the question list

Describe Wilcoxon signed-rank test and derive the approximate distribution of the test statistic.

2006 · Paper I · Q3b · 20 marks

Solution

The test. X1,…,XnX_1,\dots,X_n (or paired differences DiD_i) come from a continuous distribution symmetric about θ\theta. To test H0:θ=θ0H_0:\theta=\theta_0:

  1. Form Di=Xi−θ0D_i=X_i-\theta_0, and drop any zeros.
  2. Rank |D1|,…,|Dn||D_1|,\dots,|D_n| from 1 to nn (average ranks for ties).
  3. T+T^+ = sum of the ranks of the positive DiD_i; T−=n(n+1)2−T+T^-=\frac{n(n+1)}2-T^+.
  4. Reject H0H_0 for large T+T^+ (if H1:θ>θ0H_1:\theta>\theta_0), small T+T^+ (if θ<θ0\theta<\theta_0), or either extreme (two-sided). Exact critical values come from tables.

Null distribution. Under H0H_0, by symmetry, the sign of each DiD_i is independent of |Di||D_i|, and is ++ or −– with probability 12\frac12 each. So T+=∑k=1nkVk,T^+=\sum_{k=1}^nk\,V_k, where Vk=1V_k=1 if the observation with rank kk is positive, and the VkV_k are i.i.d. Bernoulli(12)(\frac12).

Mean and variance. E(T+)=12∑k=1nk=n(n+1)4,E(T^+)=\frac12\sum_{k=1}^nk=\frac{n(n+1)}4, V(T+)=14∑k=1nk2=n(n+1)(2n+1)24.V(T^+)=\frac14\sum_{k=1}^nk^2=\frac{n(n+1)(2n+1)}{24}.

Approximate distribution. T+T^+ is a sum of independent, bounded terms kVkkV_k, none of which dominates: maxkk2/∑k2→0\max_kk^2/\sum k^2\to0. By the Lyapunov (or Lindeberg) central limit theorem, Z=T+−n(n+1)/4n(n+1)(2n+1)/24→dN(0,1).Z=\frac{T^+-n(n+1)/4}{\sqrt{n(n+1)(2n+1)/24}}\ \xrightarrow{d}\ N(0,1). For nn above about 20, reject H0H_0 if |Z|>zα/2|Z|>z_{\alpha/2} (two-sided). With tied |Di||D_i|, subtract ∑(t3−t)/48\sum(t^3-t)/48 from the variance.

(The distribution of T+T^+ under H0H_0 is symmetric about n(n+1)/4n(n+1)/4, which helps the normal approximation.)

✓ Derivation checked step by step Every step was checked: the null representation of T⁺ as a sum of independent terms, its mean and variance, and the Lyapunov CLT.

↑ Back to the question list

Indicate the use of Wald-Wolfowitz run test and state the test-statistic along with its mean and variance under the null hypothesis.

2005 · Paper I · Q1f · 12 marks

Solution

Use. The Wald–Wolfowitz run test is used:

  1. Two-sample problem: to test whether two independent samples come from the same continuous distribution, H0:FX=FYH_0:F_X=F_Y, against any difference (location, spread or shape).
  2. Randomness: to test whether a sequence of two kinds of symbols (H/T, defective/good, above/below the median) is in random order.

Two-sample version. Combine the mm XX’s and nn YY’s, arrange them in increasing order, and label each value XX or YY. The test statistic is R=total number of runs of X’s and Y’s.R=\text{total number of runs of }X\text{'s and }Y\text{'s}. If the distributions differ, values from the same sample cluster together, giving few runs. So reject H0H_0 if R≤rαR\le r_\alpha.

Null mean and variance (with N=m+nN=m+n): E(R)=1+2mnN,V(R)=2mn(2mn−N)N2(N−1).E(R)=1+\frac{2mn}N,\qquad V(R)=\frac{2mn(2mn-N)}{N^2(N-1)}.

Large samples. Z=R−E(R)V(R)∼̇N(0,1),Z=\frac{R-E(R)}{\sqrt{V(R)}}\ \dot\sim\ N(0,1), and reject H0H_0 if Z<−zαZ<-z_\alpha. (For a test of randomness, use both tails.)

✓ Answer checked step by step Every formula was checked against the standard null distribution of the number of runs.

↑ Back to the question list

Let X1,X2,…,Xn be i.i.d. random variables with p.d.f. f(x) having median θ. Show that for testing H0:θ=0 against alternatives θ>0, the sign test is uniformly most powerful.

2005 · Paper I · Q4a · 20 marks

Solution

Set-up. X1,…,XnX_1,\dots,X_n i.i.d. with density ff and median θ\theta; ff is otherwise unknown. Test H0:θ=0H_0:\theta=0 against H1:θ>0H_1:\theta>0. Let S=#{i:Xi>0}.S=\#\{i:X_i>0\}.

The sign test. Under H0H_0, P(Xi>0)=12P(X_i>0)=\frac12, so S∼B(n,12)S\sim B(n,\frac12). The sign test rejects for large SS: ϕ(x)={1,S>cγ,S=c0,S<c,EH0ϕ=α.\phi(x)=\begin{cases}1,&S>c\\\gamma,&S=c\\0,&S<c,\end{cases}\qquad E_{H_0}\phi=\alpha .

It is UMP. Fix any alternative density gg with median θ1>0\theta_1>0. Let p=Pg(X>0)>12p=P_g(X>0)>\frac12.

Step 1: a least favourable null distribution. Construct a density hh with median 0 that has the same shape as gg on each side of 0: h(x)=1/21−pg(x)(x≤0),h(x)=1/2pg(x)(x>0).h(x)=\frac{1/2}{1-p}\,g(x)\ \ (x\le0),\qquad h(x)=\frac{1/2}{p}\,g(x)\ \ (x>0). Then hh is a density with Ph(X>0)=12P_h(X>0)=\frac12, so hh belongs to H0H_0.

Step 2: the MP test of hh against gg. The likelihood ratio is ∏i=1ng(xi)h(xi)=(p1/2)S(1−p1/2)n−S=2n(1−p)n(p1−p)S,\prod_{i=1}^n\frac{g(x_i)}{h(x_i)}=\Big(\frac{p}{1/2}\Big)^S\Big(\frac{1-p}{1/2}\Big)^{n-S}=2^n(1-p)^n\Big(\frac p{1-p}\Big)^S, which increases with SS, because p>12p>\frac12. By the Neyman–Pearson lemma, the MP test of hh against gg rejects for large SS. With size α\alpha under hh (where S∼B(n,12)S\sim B(n,\frac12)), this is exactly the sign test ϕ\phi.

Step 3: ϕ\phi has level α\alpha for all of H0H_0. For every null distribution (median 0), S∼B(n,12)S\sim B(n,\frac12), so Eϕ=αE\phi=\alpha.

Step 4: conclusion. Any level-α\alpha test ψ\psi of the composite H0H_0 has Ehψ≤αE_h\psi\le\alpha. By Step 2, Egψ≤EgϕE_g\psi\le E_g\phi. This holds for every alternative gg, and ϕ\phi does not depend on gg. So the sign test is UMP for H0:θ=0H_0:\theta=0 against H1:θ>0H_1:\theta>0, among all tests of level α\alpha for the nonparametric hypothesis. ◼\blacksquare

✓ Proof checked step by step Every step was checked: the reduction to the signs, the MLR of the binomial in the number of positive signs, and the minimisation over F within the alternative.

↑ Back to the question list

Outline the Wilcoxon-Mann-Whitney test for the two-sample problem. Also, give the relevant large-sample test-statistic.

2004 · Paper I · Q1f · 12 marks

Solution

Problem. Independent samples X1,…,XmX_1,\dots,X_m from FF and Y1,…,YnY_1,\dots,Y_n from GG, both continuous. Test H0:F=GH_0:F=G against a location shift (G(x)=F(x−Δ)G(x)=F(x-\Delta), Δ≠0\Delta\ne0, or one-sided).

Procedure.

  1. Rank all N=m+nN=m+n observations together (average ranks for ties).
  2. Wilcoxon rank sum: W=W= sum of the ranks of the YY’s.
  3. Mann–Whitney: U=#{(i,j):Xi<Yj}=W−n(n+1)2U=\#\{(i,j):X_i<Y_j\}=W-\frac{n(n+1)}2. The two forms are equivalent.
  4. Under H0H_0, all (Nn)\binom Nn rankings of the YY’s are equally likely, so the distribution of UU is distribution-free and tabulated.
  5. Reject H0H_0 if UU is too large (YY tends to be larger), too small, or either (two-sided).

Large-sample test. Under H0H_0, E(U)=mn2,V(U)=mn(m+n+1)12,E(U)=\frac{mn}2,\qquad V(U)=\frac{mn(m+n+1)}{12}, and Z=U−mn2mn(m+n+1)12∼̇N(0,1)(m,n above about 8 to 10).Z=\frac{U-\frac{mn}2}{\sqrt{\frac{mn(m+n+1)}{12}}}\ \dot\sim\ N(0,1)\qquad(m,n\text{ above about }8\text{ to }10). Reject H0H_0 if |Z|>zα/2|Z|>z_{\alpha/2} (two-sided), or Z>zαZ>z_\alpha for H1H_1: YY stochastically larger. In terms of WW: E(W)=n(N+1)2E(W)=\frac{n(N+1)}2, with the same variance.

Merits. The asymptotic relative efficiency against the tt-test is 3/π=0.9553/\pi=0.955 for normal data, never below 0.864, and can be much larger than 1 for heavy-tailed data.

✓ Answer checked step by step Every step was checked: the statistic, its relation to the rank sum, and the large-sample normal form with mean mn/2 and variance mn(m + n + 1)/12.

↑ Back to the question list

Discuss Wilcoxon-Mann-Whitney test and examine its consistency.

2003 · Paper I · Q4b · 20 marks

Solution

The test. As above: U=#{(i,j):Xi<Yj}U=\#\{(i,j):X_i<Y_j\}. Reject H0:F=GH_0:F=G for large UU when testing against “YY stochastically larger”. (The two-sided version rejects for large |U−mn/2||U-mn/2|.)

Consistency. A test is consistent against an alternative if its power tends to 1 as m,n→∞m,n\to\infty.

Let p=P(X<Y)p=P(X<Y). Under H0H_0, p=12p=\frac12.

Step 1: U/mnU/mn estimates pp. E(Umn)=pE\big(\frac U{mn}\big)=p. Its variance is V(Umn)=p(1−p)+(n−1)(p1−p2)+(m−1)(p2−p2)mn,V\Big(\frac U{mn}\Big)=\frac{p(1-p)+(n-1)(p_1-p^2)+(m-1)(p_2-p^2)}{mn}, where p1=P(X<Y,X<Y′)p_1=P(X<Y,X<Y') and p2=P(X<Y,X′<Y)p_2=P(X<Y,X'<Y). This is O(1m+1n)→0O\big(\frac1m+\frac1n\big)\to0. By Chebyshev’s inequality, U/mn→PpU/mn\xrightarrow{P}p.

Step 2: the critical value. Under H0H_0, UU is approximately N(mn2,mn(m+n+1)12)N\big(\frac{mn}2,\frac{mn(m+n+1)}{12}\big), so the critical value for U/mnU/mn is 12+zαm+n+112mn→12.\frac12+z_\alpha\sqrt{\frac{m+n+1}{12mn}}\ \longrightarrow\ \frac12 .

Step 3: power. Under any alternative with p>12p>\frac12, U/mn→p>12U/mn\to p>\frac12, while the critical value tends to 12\frac12. So P(reject H0)→1.P\big(\text{reject }H_0\big)\to1 .

Conclusion. The Wilcoxon–Mann–Whitney test is consistent exactly against alternatives with P(X<Y)≠12P(X<Y)\ne\frac12 (in the corresponding direction). This includes all location shifts, and all cases where YY is stochastically larger than XX. It is not consistent against alternatives with P(X<Y)=12P(X<Y)=\frac12, such as two distributions with the same median but different spreads. For those, use the Kolmogorov–Smirnov or a scale test.

✓ Proof checked step by step Every step was checked: U/mn is an unbiased U-statistic for P(X < Y), its variance is O(1/min(m, n)), and Chebyshev’s inequality gives consistency.

↑ Back to the question list

Discuss Wilcoxon signed rank test, and examine its consistency.

2002 · Paper I · Q3c · 20 marks

Solution

The test. X1,…,XnX_1,\dots,X_n i.i.d. from a continuous distribution symmetric about θ\theta. To test H0:θ=0H_0:\theta=0: rank |Xi||X_i|, and let T+T^+ be the sum of the ranks of the positive XiX_i. Reject H0H_0 for large T+T^+ (against θ>0\theta>0), small T+T^+ (against θ<0\theta<0), or either.

Under H0H_0: E(T+)=n(n+1)4E(T^+)=\frac{n(n+1)}4 and V(T+)=n(n+1)(2n+1)24V(T^+)=\frac{n(n+1)(2n+1)}{24}. The distribution is exact and tabulated for small nn, and approximately normal for large nn.

Consistency. Write T+T^+ in terms of Walsh averages: T+=#{(i,j):i≤j,Xi+Xj>0}=∑iI(Xi>0)+∑i<jI(Xi+Xj>0).T^+=\#\{(i,j):i\le j,\ X_i+X_j>0\}=\sum_{i}I(X_i>0)+\sum_{i<j}I(X_i+X_j>0). (Indeed, the rank of |Xj||X_j| among those with Xj>0X_j>0 counts the ii with |Xi|≤Xj|X_i|\le X_j, which is exactly the number of ii with Xi+Xj>0X_i+X_j>0 and |Xi|≤|Xj||X_i|\le|X_j|.)

Dividing by (n2)\binom n2: T+(n2)=∑iI(Xi>0)(n2)+∑i<jI(Xi+Xj>0)(n2)→P0+p′,p′=P(X1+X2>0),\frac{T^+}{\binom n2}=\frac{\sum_iI(X_i>0)}{\binom n2}+\frac{\sum_{i<j}I(X_i+X_j>0)}{\binom n2}\xrightarrow{P}0+p',\qquad p'=P(X_1+X_2>0), because the second term is a U-statistic, with variance O(1/n)O(1/n).

  • Under H0H_0 (symmetry about 0), p′=12p'=\frac12, and the critical value of T+/(n2)T^+/\binom n2 tends to 12\frac12.
  • Under an alternative with p′>12p'>\frac12 (for example, a shift θ>0\theta>0 of a symmetric distribution), T+/(n2)→p′>12T^+/\binom n2\to p'>\frac12, so the power tends to 1.

Conclusion. The Wilcoxon signed-rank test is consistent against all alternatives with P(X1+X2>0)≠12P(X_1+X_2>0)\ne\frac12, in particular against all location shifts of a symmetric distribution. It is not consistent against alternatives with P(X1+X2>0)=12P(X_1+X_2>0)=\frac12. ◼\blacksquare

✓ Proof checked step by step Every step was checked: T⁺ is a linear combination of U-statistics estimating P(X₁ + X₂ > 0), with null value ½, and the variance of the normalised statistic tends to 0.

↑ Back to the question list

An unbiased coin is tossed 30 times and the following sequence of heads (H) and tails (T) is observed: HHHTTTHHTTTHHHTTHHHTTTTHHTHHT Find out the number of runs (r). Also find the mean E(r).

2001 · Paper I · Q2iv · 15 marks

Solution

Note on the question. The printed sequence has 29 symbols, not 30. We work with the sequence as printed.

Runs. HHH | TTT | HH | TTT | HHH | TT | HHH | TTTT | HH | T | HH | T r=12,n1=15(H),n2=14(T),N=29.r=12,\qquad n_1=15\ (\text{H}),\qquad n_2=14\ (\text{T}),\qquad N=29 .

Mean number of runs. Under randomness, given n1n_1 and n2n_2, E(r)=1+2n1n2N=1+2×15×1429=15.48.E(r)=1+\frac{2n_1n_2}N=1+\frac{2\times15\times14}{29}=15.48 .

(For NN tosses of a fair coin without conditioning on the numbers of heads and tails, each of the N−1N-1 adjacent pairs starts a new run with probability 12\frac12, so E(r)=1+N−12E(r)=1+\frac{N-1}2: 15 for N=29N=29, and 15.5 for N=30N=30.)

The observed 12 runs is somewhat below the expected 15.5. With V(r)=2n1n2(2n1n2−N)N2(N−1)=6.98V(r)=\frac{2n_1n_2(2n_1n_2-N)}{N^2(N-1)}=6.98, Z=12−15.482.64=−1.32Z=\frac{12-15.48}{2.64}=-1.32, which is not significant at 5%.

✓ Checked by computer We counted the sequence in Python: it has 29 symbols (15 H, 14 T) and 12 runs; E(r) = 15.48.

↑ Back to the question list

What are the advantages and disadvantages of non-parametric inference procedures over corresponding parametric procedures?

2001 · Paper I · Q3iv · 15 marks

Solution

Advantages of non-parametric procedures.

  1. Few assumptions. They do not assume a particular distribution (such as the normal). Usually only continuity, or symmetry, is needed.
  2. Distribution-free. The null distribution of the test statistic is the same for every continuous population, so significance levels are exact.
  3. Robust. Being based on ranks or signs, they are not affected much by outliers or heavy tails.
  4. Ordinal data. They can be used with ranks, grades or preferences, where only order is meaningful.
  5. Small samples. Exact tests are available even for very small samples.
  6. Simple. The calculations are easy and the ideas intuitive.
  7. Efficiency. Some are nearly as efficient as parametric tests even for normal data (Wilcoxon: 0.955), and far more efficient for heavy-tailed data.

Disadvantages.

  1. Waste of information when the parametric assumptions do hold: the sign test has efficiency only 0.637 against the tt-test for normal data.
  2. Less power for the same sample size when the data really are normal.
  3. Hypotheses are less specific. They test equality of distributions or medians, not specific parameters, and estimates (such as of effect size) are less natural.
  4. Tables. Exact null distributions need special tables, which differ for each test and sample size.
  5. Ties in discrete data complicate the exact distributions.
  6. Fewer methods for complex designs (interactions, multiple regression).

✓ Answer checked step by step Every point was checked against the standard comparison of parametric and non-parametric methods.

↑ Back to the question list

Develop the Mann-Whitney-Wilcoxon test and obtain the mean and variance of the test statistic. How is the test carried out for large samples?

2000 · Paper I · Q1f · 12 marks

Solution

The test statistic. Samples X1,…,XmX_1,\dots,X_m from FF and Y1,…,YnY_1,\dots,Y_n from GG, continuous. Test H0:F=GH_0:F=G. Define U=∑i=1m∑j=1nIij,Iij=I(Xi<Yj).U=\sum_{i=1}^m\sum_{j=1}^nI_{ij},\qquad I_{ij}=I(X_i<Y_j). (Equivalently, U=W−n(n+1)2U=W-\frac{n(n+1)}2, where WW is the rank sum of the YY’s in the combined sample.) Large UU suggests YY tends to exceed XX.

Mean under H0H_0. P(Xi<Yj)=12P(X_i<Y_j)=\frac12, so E(U)=mn2.E(U)=\frac{mn}2 .

Variance under H0H_0. V(U)=∑i,jV(Iij)+∑(i,j)≠(k,l)Cov(Iij,Ikl).V(U)=\sum_{i,j}V(I_{ij})+\sum_{(i,j)\ne(k,l)}\text{Cov}(I_{ij},I_{kl}).

  • V(Iij)=14V(I_{ij})=\frac14, with mnmn such terms.
  • Same XX, different YY’s: P(Xi<Yj,Xi<Yl)=P(Xi is the smallest of three)=13P(X_i<Y_j,X_i<Y_l)=P(X_i\text{ is the smallest of three})=\frac13, so the covariance is 13−14=112\frac13-\frac14=\frac1{12}. There are mn(n−1)mn(n-1) such ordered pairs.
  • Same YY, different XX’s: also 112\frac1{12}, with mn(m−1)mn(m-1) ordered pairs.
  • No index in common: the covariance is 0.

V(U)=mn4+mn(n−1)12+mn(m−1)12=mn(m+n+1)12.V(U)=\frac{mn}4+\frac{mn(n-1)}{12}+\frac{mn(m-1)}{12}=\frac{mn(m+n+1)}{12}.

Small samples. Under H0H_0, all (m+nm)\binom{m+n}m arrangements are equally likely, which gives the exact distribution of UU. Reject H0H_0 if U≥uαU\ge u_\alpha (one-sided), or if UU is in either tail (two-sided).

Large samples. Z=U−mn2mn(m+n+1)12∼̇N(0,1).Z=\frac{U-\frac{mn}2}{\sqrt{\frac{mn(m+n+1)}{12}}}\ \dot\sim\ N(0,1). Reject H0H_0 if |Z|>zα/2|Z|>z_{\alpha/2}, or Z>zαZ>z_\alpha for the one-sided alternative. (A continuity correction of 12\frac12 and a tie correction to the variance can be added.)

✓ Derivation checked step by step Every step was checked: the indicator representation, E(U) = mn/2, and the variance from the covariances of the indicators (1/3 − 1/4 = 1/12).

↑ Back to the question list

Let (X1,X2,…,Xm) and (Y1,Y2,…,Yn) be independent random samples from the continuous distribution functions F(x) and F(x−θ), respectively, where F is unknown. It is required to test H0:θ=θ. Write down the median test statistic T and its asymptotic distribution under H0.

2000 · Paper I · Q4b(i) · 10 marks

Solution

Note on the question. “H0:θ=θH_0:\theta=\theta” should read H0:θ=0H_0:\theta=0 (no shift).

Median test statistic. Let N=m+nN=m+n, and let MM be the median of the combined sample. Define T=number of X’s above M.T=\text{number of }X\text{'s above }M . Let tt be the total number of observations above MM (t=N/2t=N/2 for even NN, and (N−1)/2(N-1)/2 for odd NN).

Exact null distribution. Under H0H_0, all (Nm)\binom Nm ways of choosing which observations are the XX’s are equally likely. So, given tt, TT is hypergeometric: P(T=k)=(mk)(nt−k)(Nt).P(T=k)=\frac{\binom mk\binom n{t-k}}{\binom Nt}.

Asymptotic distribution. E(T)=mtN,V(T)=mnt(N−t)N2(N−1).E(T)=\frac{mt}N,\qquad V(T)=\frac{mnt(N-t)}{N^2(N-1)}. For even NN (t=N/2t=N/2): E(T)=m2E(T)=\frac m2 and V(T)=mn4(N−1)V(T)=\frac{mn}{4(N-1)}. As m,n→∞m,n\to\infty with m/N→λ∈(0,1)m/N\to\lambda\in(0,1), Z=T−m/2mn/{4(N−1)}→dN(0,1)under H0.Z=\frac{T-m/2}{\sqrt{mn/\{4(N-1)\}}}\ \xrightarrow{d}\ N(0,1)\quad\text{under }H_0 . Equivalently, Z2Z^2 is the χ2\chi^2 statistic of the 2×22\times2 table (above or below MM, by sample), approximately χ12\chi^2_1.

Test. For θ>0\theta>0 (YY’s shifted up), fewer XX’s lie above MM, so reject H0H_0 if Z<−zαZ<-z_\alpha. Two-sided: |Z|>zα/2|Z|>z_{\alpha/2}.

✓ Derivation checked step by step Every step was checked: the conditional hypergeometric distribution of T given the combined median, and its normal limit.

↑ Back to the question list

Describe Kolmogorov-Smirnov test of goodness of fit, stating necessary assumptions, for both one-sided and two-sided alternatives.

1999 · Paper I · Q8b · 30 marks

Solution

Purpose. To test whether a random sample comes from a completely specified continuous distribution F0F_0.

Assumptions.

  1. X1,…,XnX_1,\dots,X_n are i.i.d. (a random sample).
  2. The population distribution is continuous.
  3. F0F_0 is completely specified, with no parameters estimated from the data. (If parameters are estimated, the standard tables are conservative, and adjusted tables such as Lilliefors’ are needed.)

Empirical distribution function. Fn(x)=1n#{i:Xi≤x}.F_n(x)=\frac1n\#\{i:X_i\le x\}.

Two-sided test. H0:F(x)=F0(x)H_0:F(x)=F_0(x) for all xx, against H1:F(x)≠F0(x)H_1:F(x)\ne F_0(x) for some xx. Dn=supx|Fn(x)−F0(x)|=max(Dn+,Dn−).D_n=\sup_x|F_n(x)-F_0(x)|=\max\big(D_n^+,D_n^-\big). Reject H0H_0 if Dn>Dn,αD_n>D_{n,\alpha} (from tables). For large nn, Dn,0.05≈1.36/nD_{n,0.05}\approx1.36/\sqrt n and Dn,0.01≈1.63/nD_{n,0.01}\approx1.63/\sqrt n.

One-sided tests.

  • H1:F(x)>F0(x)H_1:F(x)>F_0(x) for some xx (the data are stochastically smaller): use Dn+=supx{Fn(x)−F0(x)}=maxi(in−F0(x(i))).D_n^+=\sup_x\{F_n(x)-F_0(x)\}=\max_i\Big(\frac in-F_0(x_{(i)})\Big).
  • H1:F(x)<F0(x)H_1:F(x)<F_0(x) for some xx (stochastically larger): use Dn−=supx{F0(x)−Fn(x)}=maxi(F0(x(i))−i−1n).D_n^-=\sup_x\{F_0(x)-F_n(x)\}=\max_i\Big(F_0(x_{(i)})-\frac{i-1}n\Big). Reject for large values. Dn+D_n^+ and Dn−D_n^- have the same null distribution, and for large nn, P(nDn+≤λ)→1−e−2λ2,P(\sqrt nD_n^+\le\lambda)\to1-e^{-2\lambda^2}, so Dn,α+≈−logα2nD^+_{n,\alpha}\approx\sqrt{\frac{-\log\alpha}{2n}} (for example 1.22/n1.22/\sqrt n at 5%).

Properties. The statistics are distribution-free (by the probability integral transform). The test is exact for all nn, consistent against every alternative, and can be inverted into a confidence band Fn(x)±Dn,αF_n(x)\pm D_{n,\alpha} for the whole distribution function.

✓ Answer checked step by step Every point was checked: the statistics, the assumptions, and the one-sided limit 1 − e^(−2λ²) and two-sided Kolmogorov limit.

↑ Back to the question list

Explain the main difference between the parametric and non-parametric approaches to the theory of statistical inference. Specify the underlying assumptions and the null hypothesis in median, sign and U tests.

1998 · Paper I · Q8a · 25 marks

Solution

Parametric vs non-parametric inference.

  • Parametric: the population is assumed to belong to a family indexed by a few parameters (for example, normal with mean μ\mu and variance σ2\sigma^2). Inference is about those parameters, and the tests (zz, tt, FF) depend on the assumed form.
  • Non-parametric (distribution-free): no specific form is assumed, only general conditions such as continuity or symmetry. Hypotheses concern the whole distribution or its median and other quantiles, and tests use signs, ranks or counts. Their null distributions do not depend on the unknown population.

The main difference is the amount of assumption about the population form. Parametric methods are more efficient when their assumptions hold. Non-parametric methods are valid much more generally.

Test Assumptions Null hypothesis
Sign test X1,…,XnX_1,\dots,X_n i.i.d. (or independent pairs) from a continuous distribution H0:M=M0H_0:M=M_0, the median equals a given value (paired data: median difference = 0), so P(X>M0)=12P(X>M_0)=\frac12
Median test two (or more) independent random samples from continuous distributions H0H_0: the populations have the same median (often FX=FYF_X=F_Y)
Mann–Whitney UU-test two independent random samples, continuous distributions, at least ordinal measurement; often a shift model G(x)=F(x−Δ)G(x)=F(x-\Delta) H0:F=GH_0:F=G (identical populations); against shift alternatives, Δ=0\Delta=0

✓ Answer checked step by step Every point was checked against the standard assumptions and null hypotheses of the median, sign and Mann–Whitney tests.

↑ Back to the question list

Describe chi-square and Kolmogorov test for goodness of fit and compare.

1998 · Paper I · Q8b · 15 marks

Solution

χ2\chi^2 test of goodness of fit. Group the nn observations into kk classes with observed frequencies OiO_i. Under H0H_0 the class probabilities are pip_i, and the expected frequencies are Ei=npiE_i=np_i. χ2=∑i=1k(Oi−Ei)2Ei∼̇χk−1−s2,\chi^2=\sum_{i=1}^k\frac{(O_i-E_i)^2}{E_i}\ \dot\sim\ \chi^2_{k-1-s}, where ss is the number of parameters estimated. Reject H0H_0 if χ2>χk−1−s,α2\chi^2>\chi^2_{k-1-s,\alpha}. It needs large nn and Ei≥5E_i\ge5.

Kolmogorov (Kolmogorov–Smirnov) test. For a completely specified continuous F0F_0, with empirical distribution function FnF_n, Dn=supx|Fn(x)−F0(x)|.D_n=\sup_x|F_n(x)-F_0(x)|. Reject H0H_0 if Dn>Dn,αD_n>D_{n,\alpha}. The null distribution is exact and distribution-free, and for large nn, nDn\sqrt nD_n has the Kolmogorov limiting distribution (Dn,0.05≈1.36/nD_{n,0.05}\approx1.36/\sqrt n).

Comparison.

χ2\chi^2 Kolmogorov
Data used grouped frequencies (information lost) each observation
Distribution type any (discrete or continuous) continuous
Sample size large only any nn (exact tables)
Null distribution approximate exact, distribution-free
Parameters estimated allowed (reduce df) tables invalid; need modified versions
Arbitrary choices number and width of classes none
One-sided alternatives not available Dn+D_n^+, Dn−D_n^-
Power for continuous data lower generally higher
Other uses contingency tables, categorical data confidence band for FF; two-sample version

In short: for a fully specified continuous distribution, especially with small samples, the Kolmogorov test is better. For discrete or categorical data, or when parameters must be estimated, the χ2\chi^2 test is more convenient.

✓ Answer checked step by step Every point was checked against the standard forms of the two tests.

↑ Back to the question list

Describe the Sign test for testing the location of a probability distribution. What is its parametric counterpart?

1997 · Paper I · Q8c · 20 marks

Solution

Problem. X1,…,XnX_1,\dots,X_n are i.i.d. from a continuous distribution with median MM. Test H0:M=M0H_0:M=M_0.

Procedure.

  1. Replace each observation by the sign of Xi−M0X_i-M_0. Discard any zeros, and reduce nn accordingly.
  2. Let SS = number of ++ signs. Under H0H_0, P(Xi>M0)=12P(X_i>M_0)=\frac12, so S∼B(n,12),S\sim B\Big(n,\frac12\Big), whatever the population distribution.
  3. Reject H0H_0:
    • against M>M0M>M_0: if S≥cS\ge c, with P(S≥c)≤αP(S\ge c)\le\alpha;
    • against M<M0M<M_0: if S≤c′S\le c';
    • against M≠M0M\ne M_0: if S≤c1S\le c_1 or S≥n−c1S\ge n-c_1, each tail ≤α/2\le\alpha/2.
  4. Large nn: Z=S−n/2n/2∼̇N(0,1)Z=\dfrac{S-n/2}{\sqrt n/2}\ \dot\sim\ N(0,1) (with a continuity correction of 12\frac12).

The same test applies to paired data, using the signs of the differences, with H0H_0: median difference =0=0.

Parametric counterpart. The one-sample tt-test (or the zz-test if σ\sigma is known), of H0:μ=μ0H_0:\mu=\mu_0, which assumes normality: t=n(x‾−μ0)s∼tn−1.t=\frac{\sqrt n(\bar x-\mu_0)}s\sim t_{n-1}. For paired data, it is the paired tt-test.

Comparison. The sign test needs no normality, is unaffected by outliers, and is exact for any nn. But it uses only signs, so for normal data its efficiency relative to the tt-test is only 2/π=0.6372/\pi=0.637. For heavy-tailed data (for example, Laplace) it is more efficient than the tt-test.

✓ Answer checked step by step Every point was checked: the null distribution B(n, ½), the one- and two-sided rejection rules, and the comparison with the t-test.

↑ Back to the question list

Describe the Kolmogorov test for goodness of fit. Compare this test with the chi-square test for goodness of fit.

1996 · Paper I · Q8b · 20 marks

Solution

Kolmogorov test. X1,…,XnX_1,\dots,X_n is a random sample from a continuous distribution FF. Test H0:F(x)=F0(x) for all x(F0 completely specified)H_0:F(x)=F_0(x)\ \text{ for all }x\qquad(F_0\text{ completely specified}) against F≠F0F\ne F_0.

  1. Order the sample and form the empirical distribution function Fn(x)=1n#{Xi≤x}F_n(x)=\frac1n\#\{X_i\le x\}.
  2. Compute Dn=supx|Fn(x)−F0(x)|=maximax{in−F0(x(i)),F0(x(i))−i−1n}.D_n=\sup_x|F_n(x)-F_0(x)|=\max_i\max\Big\{\frac in-F_0(x_{(i)}),\ F_0(x_{(i)})-\frac{i-1}n\Big\}.
  3. Reject H0H_0 if Dn>Dn,αD_n>D_{n,\alpha} (Kolmogorov–Smirnov table). For large nn, Dn,0.05≈1.36/nD_{n,0.05}\approx1.36/\sqrt n.

The distribution of DnD_n under H0H_0 does not depend on F0F_0 (probability integral transform). Kolmogorov showed that limn→∞P(nDn≤λ)=1−2∑k=1∞(−1)k−1e−2k2λ2.\lim_{n\to\infty}P(\sqrt nD_n\le\lambda)=1-2\sum_{k=1}^\infty(-1)^{k-1}e^{-2k^2\lambda^2}.

Comparison with the χ2\chi^2 test.

  1. Data: Kolmogorov uses each observation; χ2\chi^2 uses grouped counts, losing information.
  2. Sample size: Kolmogorov is exact for any nn; χ2\chi^2 is a large-sample test needing Ei≥5E_i\ge5.
  3. Distribution type: Kolmogorov is for continuous F0F_0 (conservative for discrete); χ2\chi^2 handles discrete and categorical data.
  4. Parameters: χ2\chi^2 allows estimated parameters by reducing the degrees of freedom; the Kolmogorov tables then do not apply.
  5. Arbitrariness: the χ2\chi^2 result depends on the choice of classes; Kolmogorov has no such choice.
  6. Power: for continuous data, the Kolmogorov test is usually more powerful, especially in small samples.
  7. Extras: Kolmogorov gives one-sided versions and a confidence band for FF.

✓ Answer checked step by step Every point was checked against the standard form of the Kolmogorov test and its comparison with the χ² test.

↑ Back to the question list

Obtain a 100(1−α)% confidence interval for the population median based on the sign test.

1996 · Paper I · Q8c · 20 marks

Solution

Set-up. X1,…,XnX_1,\dots,X_n from a continuous distribution with median MM, ordered as X(1)<…<X(n)X_{(1)}<\dots<X_{(n)}. Let B∼B(n,12)B\sim B(n,\frac12).

Key fact. MM lies between X(r)X_{(r)} and X(n−r+1)X_{(n-r+1)} unless fewer than rr observations fall below MM, or fewer than rr fall above it. The number below MM is B∼B(n,12)B\sim B(n,\frac12). So P(X(r)<M<X(n−r+1))=P(r≤B≤n−r)=1−2∑k=0r−1(nk)(12)n.P\big(X_{(r)}<M<X_{(n-r+1)}\big)=P(r\le B\le n-r)=1-2\sum_{k=0}^{r-1}\binom nk\Big(\frac12\Big)^n . This is the set of M0M_0 values that the two-sided sign test would accept.

Confidence interval. Choose rr as the largest integer with ∑k=0r−1(nk)(12)n≤α2.\sum_{k=0}^{r-1}\binom nk\Big(\frac12\Big)^n\le\frac\alpha2 . Then (X(r),X(n−r+1))\big(X_{(r)},\ X_{(n-r+1)}\big) is a confidence interval for the population median with confidence coefficient at least 1−α1-\alpha. It is distribution-free. (Because BB is discrete, the exact level is usually a little above 1−α1-\alpha.)

Large nn. Use r≈n2−zα/2n2r\approx\frac n2-z_{\alpha/2}\frac{\sqrt n}2, rounded down.

Example (n=10n=10, α=0.05\alpha=0.05): P(B≤1)=111024=0.011≤0.025P(B\le1)=\frac{11}{1024}=0.011\le0.025, but P(B≤2)=0.055>0.025P(B\le2)=0.055>0.025. So r=2r=2, and (X(2),X(9))(X_{(2)},X_{(9)}) is a 97.9% interval for the median.

✓ Proof checked step by step Every step was checked: inverting the two-sided sign test gives order-statistic limits with binomial coverage. We also checked n = 10 by simulation (coverage 0.979 for the 2nd and 9th order statistics).

↑ Back to the question list

What is the one-sample problem concerning the location of a probability distribution? State the classical normal theory test for this problem. Describe a non-parametric version of this test and consider both one sided and two-sided alternatives.

1995 · Paper I · Q8a · 35 marks

Solution

The one-sample location problem. Given a random sample X1,…,XnX_1,\dots,X_n from a population with location parameter θ\theta (mean or median), test whether θ\theta equals a specified value θ0\theta_0: H0:θ=θ0againstH1:θ>θ0,θ<θ0, or θ≠θ0.H_0:\theta=\theta_0\quad\text{against}\quad H_1:\theta>\theta_0,\ \ \theta<\theta_0,\ \text{ or }\ \theta\ne\theta_0 . Paired comparisons (before/after) reduce to this problem through the differences.

Classical normal-theory test. Assume Xi∼N(μ,σ2)X_i\sim N(\mu,\sigma^2), σ\sigma unknown. The one-sample tt-test: t=n(X‾−μ0)s∼tn−1 under H0.t=\frac{\sqrt n(\bar X-\mu_0)}s\sim t_{n-1}\ \text{ under }H_0 .

  • H1:μ>μ0H_1:\mu>\mu_0: reject if t>tn−1,αt>t_{n-1,\alpha}.
  • H1:μ<μ0H_1:\mu<\mu_0: reject if t<−tn−1,αt<-t_{n-1,\alpha}.
  • H1:μ≠μ0H_1:\mu\ne\mu_0: reject if |t|>tn−1,α/2|t|>t_{n-1,\alpha/2}. (If σ\sigma is known, use z=n(X‾−μ0)/σz=\sqrt n(\bar X-\mu_0)/\sigma.) It is UMPU under normality, but sensitive to outliers and heavy tails in small samples.

Non-parametric versions.

(a) Sign test (only continuity assumed). SS = number of Xi>θ0X_i>\theta_0, with S∼B(n,12)S\sim B(n,\frac12) under H0H_0 (θ\theta = median).

  • θ>θ0\theta>\theta_0: reject if S≥cαS\ge c_\alpha, where P(S≥cα)≤αP(S\ge c_\alpha)\le\alpha.
  • θ<θ0\theta<\theta_0: reject if S≤n−cαS\le n-c_\alpha.
  • θ≠θ0\theta\ne\theta_0: reject if S≥cα/2S\ge c_{\alpha/2} or S≤n−cα/2S\le n-c_{\alpha/2}.
  • Large nn: Z=(S−n/2)/(n/2)Z=(S-n/2)/(\sqrt n/2).

(b) Wilcoxon signed-rank test (continuity and symmetry about θ\theta). Rank |Xi−θ0||X_i-\theta_0|; let T+T^+ be the sum of ranks of the positive differences. Under H0H_0: E(T+)=n(n+1)4E(T^+)=\frac{n(n+1)}4, V(T+)=n(n+1)(2n+1)24V(T^+)=\frac{n(n+1)(2n+1)}{24}.

  • θ>θ0\theta>\theta_0: reject if T+≥tαT^+\ge t_\alpha.
  • θ<θ0\theta<\theta_0: reject if T+≤n(n+1)2−tαT^+\le\frac{n(n+1)}2-t_\alpha.
  • θ≠θ0\theta\ne\theta_0: reject in either tail at α/2\alpha/2.
  • Large nn: Z=T+−n(n+1)/4n(n+1)(2n+1)/24Z=\dfrac{T^+-n(n+1)/4}{\sqrt{n(n+1)(2n+1)/24}}.

Comparison. For normal data, the efficiency relative to the tt-test is 0.955 for the signed-rank test and 0.637 for the sign test. For heavy-tailed data both can beat the tt-test. The signed-rank test is usually the best non-parametric replacement for the one-sample tt-test.

✓ Answer checked step by step Every step was checked: the t-test and the sign and signed-rank tests, with their assumptions and rejection regions in each direction.

↑ Back to the question list

If X(r) and X(s), r<s, are order statistics for a random sample of size n from a continuous distribution, then show that (X(r),X(s)) is a confidence interval for the population quantile of order p, with confidence coefficient Ip(r,n−r+1)−Ip(s,n−s+1), where Ip(v1,v2) is the incomplete beta function.

1995 · Paper I · Q8b · 25 marks

Solution

Set-up. ξp\xi_p is the population quantile of order pp: F(ξp)=pF(\xi_p)=p, with FF continuous.

Coverage. Since X(r)≤X(s)X_{(r)}\le X_{(s)}, {X(r)≤ξp}={X(r)≤ξp≤X(s)}∪{X(s)<ξp},\{X_{(r)}\le\xi_p\}=\{X_{(r)}\le\xi_p\le X_{(s)}\}\ \cup\ \{X_{(s)}<\xi_p\}, and the two events on the right are disjoint. So P(X(r)≤ξp≤X(s))=P(X(r)≤ξp)−P(X(s)<ξp).P\big(X_{(r)}\le\xi_p\le X_{(s)}\big)=P\big(X_{(r)}\le\xi_p\big)-P\big(X_{(s)}<\xi_p\big).

Distribution of an order statistic. X(r)≤ξpX_{(r)}\le\xi_p exactly when at least rr observations are ≤ξp\le\xi_p. Each observation is ≤ξp\le\xi_p with probability pp, independently, so P(X(r)≤ξp)=∑k=rn(nk)pk(1−p)n−k.P\big(X_{(r)}\le\xi_p\big)=\sum_{k=r}^n\binom nkp^k(1-p)^{n-k}.

Link with the incomplete beta function. The standard identity is ∑k=rn(nk)pk(1−p)n−k=n!(r−1)!(n−r)!∫0ptr−1(1−t)n−rdt=Ip(r,n−r+1).\sum_{k=r}^n\binom nkp^k(1-p)^{n-k}=\frac{n!}{(r-1)!(n-r)!}\int_0^pt^{r-1}(1-t)^{n-r}dt=I_p(r,\ n-r+1). (Both sides are the probability that the rr-th smallest of nn uniform variables is at most pp. The right side is the Beta(r,n−r+1)(r,n-r+1) distribution function of U(r)=F(X(r))U_{(r)}=F(X_{(r)}).)

So P(X(r)≤ξp)=Ip(r,n−r+1)P(X_{(r)}\le\xi_p)=I_p(r,n-r+1), and similarly P(X(s)<ξp)=Ip(s,n−s+1)P(X_{(s)}<\xi_p)=I_p(s,n-s+1) (continuity makes << and ≤\le the same).

Result. P(X(r)≤ξp≤X(s))=Ip(r,n−r+1)−Ip(s,n−s+1).P\big(X_{(r)}\le\xi_p\le X_{(s)}\big)=I_p(r,\ n-r+1)-I_p(s,\ n-s+1). So (X(r),X(s))(X_{(r)},X_{(s)}) is a confidence interval for ξp\xi_p with this confidence coefficient, which does not depend on FF. ◼\blacksquare

Example: n=10n=10, p=12p=\frac12, r=2r=2, s=9s=9: I0.5(2,9)−I0.5(9,2)=0.9893−0.0107=0.979I_{0.5}(2,9)-I_{0.5}(9,2)=0.9893-0.0107=0.979.

✓ Proof checked step by step Every step was checked: the event decomposition, the distribution of the r-th order statistic of uniform variables, and the incomplete-beta identity. A simulation (n = 10, p = 0.5, r = 2, s = 9) gave coverage 0.979, matching the formula.

↑ Back to the question list

More on Statistical Inference

Questions: UPSC Civil Services (Main) Examination, Statistics Paper I, 1995–2026. Solutions: Optional Province. Found an error? Tell us.

Spotted an error? Tell us.

We classify every PYQ with care, but mistakes can slip in. If a question is in the wrong topic, has a typo, the wrong year, or is missing, let us know. We review every report and update the page.

Report an Error
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted