6.5 Practice Problems

Problem 6.1. A random sample of size ten is drawn from a continuous population: \[0.621,\ 0.503,\ 0.203,\ 0.477,\ 0.710,\ 0.581,\ 0.329,\ 0.480,\ 0.554,\ 0.382 .\] Test the hypothesis that the sample came from the Uniform\([0,1]\) distribution. Obtain \(F_0\), \(\widehat {F}_n\), \(D^{+}\), \(D^{-}\) and \(D\); give the critical value at \(\alpha = 0.05\) and state the conclusion.

Show solution

Solution. Hypotheses. \(H_0 : F = F_0\) where \(F_0\) is the Uniform\([0,1]\) cdf, against \(H_1 : F \neq F_0\). Note \(F_0\) is fully specified in advance, with no parameter estimated from the data — which is what makes the tabulated critical values applicable.

The theoretical cdf. For the uniform distribution on \([0,1]\), \(F_0(x) = x\) on that interval. The arithmetic is therefore unusually transparent: the theoretical value at each point is the observation.

Order the sample and tabulate.

\(i\) \(x_{(i)}\) \(F_0 = x_{(i)}\) \(\dfrac {i}{n}\) \(\dfrac {i}{n}-F_0\) \(F_0 - \dfrac {i-1}{n}\)
1 0.203 0.203 0.1 \(-0.103\) \(0.203\)
2 0.329 0.329 0.2 \(-0.129\) \(0.229\)
3 0.382 0.382 0.3 \(-0.082\) \(0.182\)
4 0.477 0.477 0.4 \(-0.077\) \(0.177\)
5 0.480 0.480 0.5 \(\ \ 0.020\) \(0.080\)
6 0.503 0.503 0.6 \(\ \ 0.097\) \(0.003\)
7 0.554 0.554 0.7 \(\ \ 0.146\) \(-0.046\)
8 0.581 0.581 0.8 \(\ \ 0.219\) \(-0.119\)
9 0.621 0.621 0.9 \(\ \ 0.279\) \(-0.179\)
10 0.710 0.710 1.0 \(\ \ \mathbf {0.290}\) \(-0.190\)

The statistics. \[D^{+} = \max _i\left \{\dfrac {i}{n}-F_0\left (x_{(i)}\right )\right \} = 0.290 \quad (\text {at } i = 10),\] \[D^{-} = \max _i\left \{F_0\left (x_{(i)}\right )-\dfrac {i-1}{n}\right \} = 0.229 \quad (\text {at } i = 2),\] \[D = \max \left (D^{+}, D^{-}\right ) = 0.290 .\]

 ^
x000010000FFD.........0n02570246805050(x= )0 =.29x0
Figure 5: The Kolmogorov–Smirnov statistic is the largest vertical gap between the empirical distribution function \(\widehat {F}_n\) (blue steps) and the hypothesised \(F_0\) (orange line). For the sample of Problem 1 the largest gap is \(D=0.290\), reached just below the largest observation.

Critical value and decision. For \(n = 10\) at \(\alpha = 0.05\) the two-sided critical value is \(D_{0.05,10} = 0.409\). Since \[0.290 < 0.409,\] we do not reject \(H_0\): the sample is consistent with Uniform\([0,1]\).

Why both \(D^{+}\) and \(D^{-}\) are needed. The empirical distribution function is a step function, so at each observation it jumps from \(\frac {i-1}{n}\) to \(\frac {i}{n}\). The largest gap between \(\widehat {F}_n\) and \(F_0\) may occur immediately after a jump, which \(D^{+}\) measures, or immediately before one, which \(D^{-}\) measures. Taking only one of them would understate the distance — here \(D^{+}\) happens to win, but the maximum deviation of the two occurs at opposite ends of the sample, \(i = 10\) and \(i = 2\).

Questions on this section

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