2.7 Practice Problems
Problem 2.1. A traffic warden records how long sixteen cars remained illegally parked after their meter expired, in minutes: \[10,\ 42,\ 29,\ 11,\ 63,\ 145,\ 11,\ 8,\ 23,\ 17,\ 5,\ 20,\ 15,\ 36,\ 32,\ 15 .\] Obtain an appropriate \(95\%\) confidence interval for the median overstay time, and state what assumptions justify the method used.
Show solution
Solution. Order the data: \[5,\ 8,\ 10,\ \mathbf {11},\ 11,\ 15,\ 15,\ 17,\ 20,\ 23,\ 29,\ 32,\ \mathbf {36},\ 42,\ 63,\ 145 .\] A distribution-free interval for the median is \(\left (X_{(k)},\ X_{(n+1-k)}\right )\), whose coverage is \[1 - 2\,P\!\left (\text {Bin}\!\left (n,\tfrac 12\right ) \leq k-1\right ).\] With \(n = 16\): \[\begin {array}{c|c|c} k & \text {interval} & \text {coverage}\\\hline 3 & (10,\ 42) & 0.9958\\ 4 & (11,\ 36) & 0.9787\\ 5 & (11,\ 32) & 0.9232 \end {array}\] Take the largest \(k\) whose coverage still reaches \(95\%\), namely \(k = 4\): \[\boxed {\left (X_{(4)},\ X_{(13)}\right ) = (11,\ 36) \text { minutes, with actual confidence } 97.87\% .}\]
Assumptions. Only that the sixteen observations are independent and come from a continuous distribution. Nothing is assumed about its shape — which is the point, since the value \(145\) is a severe outlier and would wreck any interval built on the mean and standard deviation.
Note on the confidence level. The attainable levels are discrete, so \(95\%\) cannot be hit exactly; one reports the interval and its true coverage rather than pretending it is \(95\%\). The next interval down, \((11,32)\), covers only \(92.3\%\) and is not a \(95\%\) interval at all.
Problem 2.2. Eleven people with sleep problems have a median sleeping time of \(2\) hours per night before treatment. A drug is administered; if it has any effect it will increase sleeping time, though some doctors doubt it does anything. After treatment the hours slept are \[3.1,\ 1.8,\ 2.7,\ 2.4,\ 2.9,\ 0.2,\ 3.7,\ 5.1,\ 8,\ 2.1,\ 2 .\] Are the doctors’ doubts justified?
Show solution
Solution. Hypotheses. \(H_0 : \theta = 2\) against the one-sided \(H_1 : \theta > 2\), the direction fixed in advance by the pharmacology and not by the data.
Signs. Comparing each value with \(2\): \[+,\ -,\ +,\ +,\ +,\ -,\ +,\ +,\ +,\ +,\ 0 .\] The observation of exactly \(2\) gives no sign and is discarded, leaving \[n' = 10,\qquad N_{+} = 8,\qquad N_{-} = 2 .\]
Exact test. Under \(H_0\), \(N_{+} \sim B\!\left (10,\tfrac 12\right )\), so \[P\left (N_{+} \geq 8\right ) = \dfrac {\binom {10}{8}+\binom {10}{9}+\binom {10}{10}}{2^{10}} = \dfrac {45+10+1}{1024} = \dfrac {56}{1024} = 0.0547 .\]
Decision. Since \(0.0547 > 0.05\) we do not reject \(H_0\) at the \(5\%\) level. On this evidence the doctors’ doubts are not overturned.
But only just. Eight of ten moving the right way is suggestive, and the \(P\)-value misses the conventional threshold by \(0.0047\). The honest report is the \(P\)-value itself, not a verdict: a trial of even modest additional size would settle the question, and dismissing the drug on this result would be as wrong as adopting it.
Problem 2.3. A realtor claims the median sale price of houses sold in a certain month is \(\$134{,}500\). In a random sample of \(85\) sales, \(30\) houses sold for less than that figure and \(51\) for more. Test the claim at the \(10\%\) significance level.
Show solution
Solution. The sample size is not \(85\). Only \(30 + 51 = 81\) houses are recorded above or below the claimed median, so \(4\) sold at exactly \(\$134{,}500\). Those give no sign and are discarded: \[n' = 81,\qquad N_{-} = 30,\qquad N_{+} = 51 .\]
Hypotheses. \(H_0 : \theta = 134{,}500\) against \(H_1 : \theta \neq 134{,}500\), two-sided, at \(\alpha = 0.10\).
Large-sample statistic. With \(R = \min (N_{+},N_{-}) = 30\), \[Z = \dfrac {n' - 2R - 1}{\sqrt {n'}} = \dfrac {81 - 60 - 1}{\sqrt {81}} = \dfrac {20}{9} = 2.2222 ,\] giving a two-sided \(P\)-value of \[2\left [1 - \Phi (2.2222)\right ] = 0.0263 .\] (The exact binomial two-sided value is \(0.0257\), so the approximation is good at this size.)
Decision. Since \(0.0263 < 0.10\) we reject \(H_0\): the data do not support the realtor’s claim, and the evidence points to a median above \(\$134{,}500\).
The trap. Using \(n = 85\) instead of \(n' = 81\) gives \(Z = 2.6032\) — a different and wrong answer. Ties with the hypothesised median must be removed and the sample size reduced to match; keeping \(85\) in the denominator while having dropped the four observations from the counts is inconsistent.
Questions on this section
Stuck on something here? Ask below and it stays attached to this topic.