Statistics · Solutions
Nonparametric Methods
Work this sheet on paper, showing every step — the method is what is being tested, and the solutions are written so you can check your route rather than just your answer. Name every result you use (“by the null moments of ”, “by exchangeability”, “by the probability integral transform”) and say what its hypotheses are; a rank test that is used where its assumptions fail earns nothing. Every number on this sheet can be found exactly by hand, as a fraction or a surd, so no calculator is needed; where a normal critical value is required it is given. Full worked solutions are on a separate page; each question also has its own reveal, so you can check one answer without seeing the rest.
- 1.Computation
A sample of four observations is to be tested against a fully specified continuous distribution function . Evaluated at the ordered observations , the hypothesised distribution function takes the values
- (a)Compute the Kolmogorov-Smirnov statistic , stating at which observation, and from which side of the jump, the supremum is attained.
- (b)Suppose instead that , the other three values being unchanged. Recompute . Which gap is now the largest, and what does this say about checking only one side of each jump?
- (c)Without any further calculation, explain why the null distribution of would be the same whether were a normal, an exponential or a logistic distribution function, and name the transformation that shows it.
Solution
(a) Both gaps at every jump. The empirical distribution function is a staircase that equals just before and just after it. Since is continuous, the largest vertical distance between the two functions occurs at one of these eight values.
The “after” gaps are
The “before” gaps are
The largest of the eight is , so , attained just after the fourth observation: the staircase has reached while is still at .
(b) Move the last point. Only the two gaps at change. After the jump, ; before it, . The other six gaps are as in (a), the largest of them being (twice). So now
attained just before the fourth observation. In (a) the maximum came from the after-side of the last jump; here it comes from the before-side of the same jump, and a computation that checked only the after-gaps would have reported instead of . The supremum of is always at a jump, but it can be on either side, so both must be checked at every observation.
(c) Distribution-free. By the probability integral transform, if has continuous distribution function then is Uniform. Since is non-decreasing, the empirical distribution function of the transformed values , evaluated at , equals ; hence
where is the empirical distribution function of four uniforms. Nothing about the particular survives the substitution, so the null distribution of is the same for every continuous — which is why a single table of critical values serves every goodness-of-fit problem of this type. Notice that the data in (a) were given to you already in the form : those four numbers are exactly the transformed sample .
- 2.Computation
Ten patients were randomised, five to a treatment and five to a control, and each was classified as improved or not:
Write for the top-left count, so that the observed table has .
- (a)Compute the four expected counts under independence and explain why the chi-square test of independence should not be used here.
- (b)With both margins fixed, list every value can take, and compute the hypergeometric probability of each possible table. Check that your probabilities sum to .
- (c)Give the one-sided -value of Fisher's exact test against the alternative that treatment improves the outcome, and the two-sided -value obtained by summing the probabilities of all tables at least as unlikely as the observed one.
- (d)Compute the chi-square statistic anyway (the critical value of is ) and compare its verdict with the exact two-sided . Which of the two limitations of the chi-square test does the comparison illustrate?
Solution
(a) Expected counts. Under independence , so
All four are below . The distribution for is asymptotic and needs expected counts of roughly or more; with the statistic takes only a handful of distinct values, and the continuous approximation cannot be trusted. Fisher's exact test is the right tool.
(b) The possible tables. The row totals are and and the column totals are and . Since the improved column has total and each row has only patients, and , so . By the hypergeometric formula with , and ,
The numerators are
and , so the probabilities sum to . ✓ The observed table has probability .
(c) The -values. “Treatment improves the outcome” means large . The observed is the largest possible value, so the only table at least as extreme is the observed one:
For the two-sided test, the tables with probability at most are and (the mirror image, in which the control group does all the improving). So
(d) The approximation, for comparison. With the observed counts and expected counts ,
which is well beyond and corresponds to a -value near . The exact two-sided is — nearly five times larger. This is the small expected counts limitation: with a discrete, skewed statistic the approximation rejects too often, exactly as the rule of thumb warns. (The other limitation, arbitrariness of binning, does not arise because the data are genuinely categorical.) Note what not to do: there is nothing here to pool, and pooling would change the hypothesis anyway.
- 3.Computation
Two unrelated studies. Use and .
Study I. A table on subjects gives a chi-square statistic of .
Study II. Two hundred people were asked the same yes/no question before and after a campaign. Seven changed from no to yes, one changed from yes to no, and the remaining gave the same answer both times.
- (a)For Study I, test independence at and compute Cramér's . Then find and for a table with the identical pattern of proportions but , and say in one sentence what the comparison shows.
- (b)For Study II, carry out McNemar's test at . Then compute the exact two-sided -value by treating the changers as a Binomial count, and reconcile the two verdicts.
- (c)Explain why the unchanged subjects in Study II carry no information about whether the campaign shifted opinion, and say what a chi-square test of independence on the before-by-after table would be testing instead.
Solution
(a) Study I. Degrees of freedom , and , so independence is rejected at the level (the -value is far below ). For the strength, , so
For a fixed pattern of association is proportional to , so at the statistic is , which is below : not significant. But
exactly as before. The statistic measures evidence and tracks the sample size; measures strength and does not — and is a weak association whether or not is large enough to make it significant.
(b) Study II. With and ,
so McNemar's test rejects at the level.
Exactly: under each changer is equally likely to change in either direction, so conditional on changers, . The one-sided tail is
and doubling gives the two-sided — not significant at .
The verdicts differ because is an asymptotic approximation to a statistic that, with only discordant pairs, takes very few values; the expected count of each kind of change is only , below the working threshold of . The exact binomial calculation is the one to trust. The chi-square version is the same statistic with a continuous distribution stretched over nine possible outcomes, and it rejects too readily, as approximations to discrete counts do.
(c) Why the concordant pairs drop out. The question is whether the marginal proportion of yes answers moved. A subject who answered the same way twice contributes one yes (or one no) to both margins and therefore cannot move the difference between them, whichever way the campaign worked. Under the null the only random quantity is the direction of each change, and that is what the test conditions on — the same logic as pairing in the paired -test, where within-pair differences discard between-subject variation.
A chi-square test of independence on the before-by-after table would ask a different question: whether a person's before answer is associated with their after answer. With of unchanged it would reject overwhelmingly, reporting only that people tend to agree with themselves — which says nothing about whether the campaign shifted opinion.
- 4.Computation
Eight subjects were measured before and after a treatment. The after-minus-before differences are
Use where a normal approximation is asked for.
- (a)Carry out the sign test of : median difference is zero, giving the exact one-sided and two-sided -values. State the only assumption the test needs.
- (b)Compute the Wilcoxon signed-rank statistic , its null mean and variance, and the standardised value; decide at the two-sided level. Show without a calculator that your decision does not depend on the rounding of the square root.
- (c)Find the exact two-sided -value of the signed-rank test by counting sign patterns, and explain why the two tests disagree on these data.
Solution
(a) Sign test. Seven differences are positive and one is negative, no ties. Under the number of positives is , which needs only that each difference is positive with probability — no symmetry, no shape. Then
so the two-sided -value is . Not significant at the level.
(b) Signed-rank test. Order the absolute differences and rank them:
The only negative difference is , with rank , so and, since the ranks sum to ,
By the null moments of the signed-rank statistic with ,
So . Since , the standard deviation lies between and , hence
and every value in that range exceeds . Reject at the level; , two-sided .
(c) Exact . Under the null (differences symmetric about ) each of the sign patterns is equally likely. means , which happens for exactly two patterns: no negatives () or the rank- difference alone negative (). So
in close agreement with the normal approximation.
The two tests disagree because the sign test sees only that of differences are positive, and with that pattern is simply not rare enough (). The signed-rank test also sees that the one negative difference is the smallest in magnitude while the positives include all the large ones. That extra information is what pushes the evidence past the line — and it is bought with the extra assumption of symmetry, which the sign test does not need.
- 5.Proof
Let be paired differences with no ties and none equal to zero, and let be the Wilcoxon signed-rank statistic. You may quote and .
- (a)Write for suitable indicator variables and prove that under the null hypothesis that the differences are symmetric about zero, and . Say precisely where symmetry is used and which step would fail without it.
- (b)Prove that under the same null, has exactly the same distribution as , and deduce that for every .
- (c)Using (b), find the smallest attainable one-sided and two-sided -values for a sample of pairs, and hence the smallest for which a two-sided signed-rank test can ever reject at .
Solution
(a) The moments. Rank the absolute differences from to and let if the difference holding absolute rank is positive, otherwise. Then , the sum of the ranks of the positive differences, is .
Under symmetry about zero, each difference is equally likely to be positive or negative, and its sign is independent of its magnitude: symmetry says the conditional distribution of the sign given is still a fair coin. Hence the signs are independent of the ranking, and the are independent Bernoulli variables. This is the step that needs symmetry. Under a skewed null with median zero the signs are still fair coins, but they are no longer independent of the magnitudes — large would be more often positive, say — so the attached to large ranks would not be Bernoulli, and neither formula would hold.
By linearity,
By independence the variance of the sum is the sum of the variances, and , so
Linearity did not need independence; the variance step did.
(b) Symmetry of the null distribution. The ranks of the negative differences are those with , so
Under the null the vector consists of independent fair coins, and so does : the two vectors have the same joint distribution, namely uniform over the sign patterns. Since is the function of the first vector and is the same function of the second, and have the same distribution. Therefore, for any ,
The null distribution is symmetric about , which is why one tail of a table suffices.
(c) The floor. With the ranks sum to and there are equally likely sign patterns. The most extreme value arises from exactly one pattern (all positive), so the smallest one-sided -value is . By (b) the lower tail has the same probability, so the smallest two-sided -value is , which exceeds : no two-sided signed-rank test on five pairs can reject at the level, whatever the data.
In general the smallest two-sided is , and requires , that is : with six pairs the extreme pattern gives . (One-sided, suffices, so is enough.) A rank test cannot be more decisive than the number of sign patterns allows, and with tiny samples that ceiling binds before any question about power arises.
- 6.Critique
Two independent samples of sizes and are ranked together, and the rank sum of the first sample is . A student writes the following. Use .
Step 1. The Mann-Whitney statistic is the rank sum, so .
Step 2. and , so .
Step 3. Since we do not reject, and therefore the two populations have the same median.
Take ; this is the number of pairs in which the first-sample observation exceeds the second-sample observation .
- (a)Show that does count the pairs described, by considering the -th smallest first-sample observation and its rank in the combined ordering.
- (b)Identify every error in the student's argument — there are three, and they are of different kinds — and say which result or hypothesis each one abuses.
- (c)Redo the test correctly. Show without a calculator whether exceeds , and state the conclusion in a form that is actually justified by the test.
Solution
(a) The identity. Let the first-sample observations in increasing order have combined ranks . The -th smallest first-sample value has first-sample values below it, so the remaining observations below it all belong to the second sample: is the number of it exceeds. Summing over ,
Its range is to , and alone ranges from upward, which is exactly why the offset matters.
(b) Three errors.
Step 1 confuses with . By the definition of the Mann-Whitney statistic, , not . The null moments and are moments of ; feeding them compares a statistic with the wrong centre. (Note that is only above its minimum of : the first sample holds nearly all the lowest ranks, which is the opposite of “no evidence”.)
Step 3 turns non-rejection into acceptance. Failing to reject means the data are compatible with ; it never establishes it. With and the test has modest power, so a non-significant result would be weak evidence of anything.
Step 3 also misstates the hypothesis. The Mann-Whitney null is that the two distributions are identical, and the alternative is a stochastic ordering, . A conclusion about medians is valid only under the extra assumption that the two distributions differ by a pure shift and are otherwise the same shape — an assumption the student never stated.
(c) The correct test. With ,
Compare squares: if and only if . The left side is . On the right, and , so the right side is below . Since , comfortably; in fact gives , so and the two-sided is about .
Reject at the level. The justified conclusion: the two samples are unlikely to come from the same distribution, and the direction is that first-sample values tend to be smaller — only of the pairs have the first-sample value on top. Any statement about medians requires adding, and stating, the shift assumption.
- 7.Computation
Five students sit two examinations. Ranked by the first examination they are students ; their ranks on the second examination, listed in the same order, are . The raw second-examination scores were .
- (a)Compute Spearman's from the computing formula, giving the answer as an exact fraction.
- (b)List every pair of students as concordant or discordant and compute Kendall's . Compare it with .
- (c)The score is a data-entry error; the true value was . Determine, with reasons, what happens to and when it is corrected, and explain what happens to Pearson's computed on the raw scores. Which single feature of the rank definitions is responsible for the difference?
Solution
(a) Spearman. With and , the rank differences are
There are no ties, so the computing formula applies with :
(b) Kendall. Listing the second-exam ranks in first-exam order, , a pair with is concordant when the second rank increases too. The pairs:
So , and
As usual for the same data; here exactly, the rough rule of thumb landing on the nose. The interpretation of is direct: a randomly chosen pair of students is ordered the same way by both exams with probability and the opposite way with probability , and is the difference.
(c) Correcting the error. With the true score the second-exam values are . Since is still the largest, student still has rank and every other rank is unchanged: the rank vector is exactly as before. Every is unchanged, so still; every pair is concordant or discordant exactly as before, so still. A rank depends only on order, and correcting to preserves the order of the five scores. The same is true of any strictly increasing transformation of the scores — squaring them, taking logarithms — which is why rank correlation detects any monotone relationship and not merely a linear one.
Pearson's is built from products of deviations, , and with that single term dominates while dominates . In the limit of an ever larger , tends to the correlation between and the indicator of student : the -deviations are , the indicator's deviations from its mean are , the cross-products sum to , and with and the limit is . So is being reported by one observation, and correcting that observation to moves appreciably, while a second error putting it at would move it again. The rank statistics bound the influence of any one observation — the erroneous score can never contribute more than a rank difference of — and that robustness is a different property from being assumption-free.
- 8.Proof
Let and be the ranks of two variables on the same observations, with no ties, and let . You may quote and , but not the identity in (a).
- (a)Prove that .
- (b)Starting from the definition of as Pearson's correlation of the two rank vectors, derive the computing formula . Say where the absence of ties is used.
- (c)Prove that if the second ranking is the exact reverse of the first, for every , then . Deduce that for any two rankings, and check both statements by hand for .
Solution
(a) The sum of squared deviations of . Expand the square and use the two quoted sums:
The last two terms combine to . Factor out and put everything over :
(b) The computing formula. Because there are no ties, each rank vector is a permutation of . So both have the same mean and, by (a), the same sum of squared deviations,
(With ties, averaged ranks would spoil both of these — the means would still agree but the sums of squares would be smaller, and the formula would need a correction.)
Now write , which is legitimate because the two means are equal, and expand:
Hence , and Pearson's correlation of the ranks is
(c) Reversed rankings. If then
so, since the are a permutation of , part (a) gives
and the computing formula returns .
For the bound: is a Pearson correlation, so by the Cauchy–Schwarz inequality for any two rankings. Substituting the computing formula, rearranges to , with equality exactly when — which the reversed ranking attains. (Equivalently: reversing the order minimises , the rearrangement inequality in rank form.)
Check, . The bound is . Reversing to gives and , so . ✓ The other five permutations give , all below , so the bound is attained only by the reversal. ✓
- 9.Sketch
Two groups give and . A permutation test is to be run on , one-sided against . Write for the sum of the two values assigned to the first group.
- (a)Show that , and deduce that rejecting for large is the same as rejecting for small . Why is the better statistic to tabulate?
- (b)List all relabellings with their values of , verify that the average of the ten values equals times the pooled mean, and draw the permutation null distribution of as a bar chart, marking the observed value and shading the rejection region that the observed data define.
- (c)Read the one-sided -value off your chart. Then say what is the two-sided -value under the rule “at least as far from as the observed value”, and explain from the chart why this distribution, unlike the equal-sizes case, is not symmetric.
Solution
(a) Reduce to the group sum. The pooled total is . If the first group's two values sum to , the second group's three values sum to , so
This is a strictly decreasing function of , so “ at least as large as observed” is exactly “ at least as small as observed”, and the two tests have identical -values. Tabulating is better because it takes integer values, and because the argument shows that any statistic that is a monotone function of the first group's sum — a difference of totals, of means, a -statistic with pooled variance — yields the same test.
(b) The ten relabellings. Choosing which two of go to the first group:
The observed labelling is , so , the smallest value in the list. The ten values sum to , so their average is ; the pooled mean is and . ✓ (Under exchangeability each of the two first-group slots holds a randomly chosen pooled value, so pooled mean.)
The chart. Horizontal axis from to with integer ticks; vertical axis “number of relabellings” from to . Draw a bar of height at each of and a bar of height at : nine bars, total height . Mark the bar at as the observed value — it stands alone at the far left. The rejection region defined by the data is , which is just that one bar, so shade it. Draw a vertical dashed line at ; it falls between the bars at and .
(c) Reading off. Exactly one of the ten equally likely relabellings has , so
This is also the smallest -value the design can produce: with and nothing can reach , however cleanly the groups separate.
For the two-sided rule, the observed distance is , so a relabelling counts if or . From the chart that is and , two of ten: .
Why no symmetry. In the chapter's equal-sizes example every relabelling has a mirror image obtained by swapping the two groups, which negates , so the null distribution is symmetric about . Here the groups have sizes and , and swapping them is not a relabelling of the same design, so nothing forces symmetry. The chart shows it: the bars to the left of sit at distances while those to the right sit at , and the value stretches the right tail. Exactness does not need symmetry — the proof that the permutation test has the stated level uses only that the ten relabellings are equally likely — but reading a two-sided -value from an asymmetric distribution does require saying which rule is being used.
- 10.Critique
Two arguments follow. Each contains exactly one fatal step. For each argument, name the step, explain why it fails, and give the corrected procedure.
Argument A. “Five observations come from a Uniform population. Step 1. The maximum likelihood estimate of is the sample maximum, . Step 2. The sampling distribution of the maximum is awkward, so bootstrap it: draw resamples of size with replacement, compute the maximum of each, and take the and quantiles of the resample maxima as a confidence interval for . Step 3. Since the interval comes from resampling, it makes no assumption about the population.”
Argument B. “Ten paired differences are . Step 1. The differences are strongly right-skewed, so the paired -test is unreliable. Step 2. Rank tests are distribution-free, so the Wilcoxon signed-rank test is valid whatever the shape of the differences. Step 3. Apply it to test whether the median difference is zero.”
- (a)For Argument A, compute exactly the probability that a resample's maximum equals the observed maximum , and use it to describe the shape of the bootstrap distribution of the maximum. What does that shape do to the upper end of the percentile interval, and why is that fatal for a parameter that is certainly at least ?
- (b)For Argument B, say what the Wilcoxon null actually assumes beyond a zero median, and show concretely on these ten differences why the test is not what its user thinks it is. What should be used instead, and what does “distribution-free” actually promise?
Solution
(a) Argument A: Step 2 is the fatal one. Step 1 is correct, and Step 3 is only wrong as a consequence of Step 2.
The resample maximum is at most the observed maximum, because a resample contains only observed values. It equals unless all five draws miss the largest observation, and each draw misses it with probability independently, so
So the bootstrap distribution of the maximum puts about two-thirds of its mass on the single point and the rest at , , or — a distribution that lives entirely at or below the estimate. Its quantile is therefore itself (indeed every quantile above the point is ), so the percentile interval has the form .
That is fatal because with certainty — the population cannot produce a value larger than — and with probability one. An interval whose upper endpoint is contains with probability zero, not . The bootstrap fails here because the statistic depends on an extreme order statistic, and the empirical distribution is a poor stand-in for the population exactly at its boundary. (As grows the defect does not go away: .)
Correction. The sampling distribution of the maximum is not awkward at all: for a Uniform sample of size , for . Use that exact distribution to build the interval, as the estimation of for the uniform is done in closed form; the bootstrap is the wrong tool for a boundary parameter. Step 3's claim of “no assumption” is also empty: the argument already assumed a uniform population to justify the maximum in Step 1.
(b) Argument B: Step 2 is the fatal one. Step 1 is a fair observation, and Step 3 merely acts on Step 2.
The null hypothesis of the Wilcoxon signed-rank test is that the differences are symmetric about zero, not merely that their median is zero. The null distribution of — , , and the uniform distribution over the sign patterns — is derived by writing with the signs independent fair coins independent of the magnitudes. Symmetry is what delivers that independence.
On these data the assumption is visibly false. Ranking the absolute values gives ; the two negatives hold ranks and , so and , against a null mean of and null standard deviation — about standard deviations up, a “significant” result. But look at where the evidence comes from: the three largest magnitudes, , carry ranks and contribute of the on their own, while the small differences are split almost evenly in sign. Under a right-skewed population with median zero that pattern is typical, not evidence: the long right tail supplies large magnitudes far more often than the short left tail does, so the signs attached to the largest ranks are not fair coins, exceeds under the null, and the test rejects a true null far more often than . The user would be “detecting” a shift whose existence the test had assumed away.
Correction. With skewed differences, use the sign test: positives out of , and under the null that the median difference is zero , with no further assumption — that null needs only . Then , two-sided about : not significant, which is the honest reading of eight positives in ten.
“Distribution-free” promises only that the null distribution of the statistic can be computed without knowing the population — for the sign test under any continuous distribution with median zero, for the signed-rank test under any distribution symmetric about zero. It does not mean assumption-free, and the assumption a rank test does make is exactly what fixes which null distribution one is entitled to use.
- 11.Proof
Two independent samples have sizes and , and the null hypothesis is that both come from the same continuous distribution. Let and let be any statistic computed from the labelled data; assume takes distinct values across the relabellings. The permutation -value is the proportion of relabellings with at least as large as the observed .
- (a)Prove that under the null, for every . Conclude that the test has level at most , with equality exactly when is an integer, and say precisely what “the permutation test is exact” means in the light of this. Point to the one place the null hypothesis is used.
- (b)Show that the smallest attainable one-sided -value is . For equal group sizes , find the smallest for which a one-sided permutation test can reject at , and the smallest for which a two-sided test (with doubled) can.
- (c)Take and with . Show that the one-sided -value is exactly , and then show that the same -value is obtained if every observation is first replaced by its rank, or if is replaced by the Mann-Whitney of the second sample. What does this say about the relationship between rank tests and permutation tests?
Solution
(a) Exactness. Under the null the pooled observations are independent draws from one distribution, so their joint distribution is unchanged by any permutation of the labels: the observations are exchangeable. This is the only place the null hypothesis enters. Condition on the multiset of pooled values. Given that multiset, each of the ways of choosing which values carry the first label has the same conditional probability , so the observed labelling is a uniform draw from the relabellings, and is a uniform draw from the distinct values that takes.
If , the -th largest value, then exactly relabellings have and . Hence is uniform on , and
This is the conditional probability given the multiset; since it does not depend on the multiset, it is the unconditional probability too. Equality holds precisely when is an integer.
So “exact” means: the rejection probability under the null is known exactly, for every sample size, with no approximation — it is , and it equals whenever is one of the attainable levels . It does not mean that every is attainable, and it says nothing about power. Nothing about the form of was used, which is why any statistic may be permuted.
(b) The floor. The smallest occurs when is the largest of the values, giving ; no relabelling can have smaller, since the observed one always counts. For , runs for
One-sided at requires , i.e. : gives and fails, gives and succeeds, with exactly. So is the smallest, and only the single most extreme relabelling rejects.
Two-sided with doubled requires , i.e. : fails and gives , . So is the smallest.
(c) The example. The pooled values are and . Since where is the first group's sum, is largest when is smallest, and the observed labelling has the smallest possible sum . It is the unique relabelling with , so , exactly the floor from (b).
Replacing values by ranks. The values are their own ranks, so nothing changes and . More generally, replacing observations by ranks is a strictly increasing transformation, and under it the ordering of relabellings by any statistic that is monotone in the group sum is preserved whenever, as here, the observed group holds the smallest values — that relabelling is the unique extreme one before and after ranking.
Replacing by . With the rank sum of the second sample, , which equals , the maximum possible: every exceeds every . Across relabellings is a strictly increasing function of the second group's rank sum, hence a strictly decreasing function of , so it orders the relabellings exactly as does, and again exactly one relabelling is at least as extreme: .
The lesson. The Mann-Whitney test is a permutation test — the permutation test whose statistic is the rank sum, applied to the ranks. Its tabulated null distribution is precisely the permutation distribution of over the relabellings, which is why it is the same for every continuous population: ranking has already removed the data's values, so the enumeration can be done once. A permutation test on the raw values keeps the magnitudes and can use any statistic, at the price of redoing the enumeration for each data set. Both are exact for the same reason, exchangeability under the null; they differ in what they throw away, and hence in power against particular alternatives.
- 12.Computation
A sample of three values, , is to be bootstrapped. Rather than simulate, enumerate: treat a resample as three independent draws, each uniform on , and compute the bootstrap distribution exactly.
- (a)How many ordered resamples are there, and how many distinct resamples if order is ignored? What is the probability that a resample contains all three distinct values?
- (b)Find the exact bootstrap distribution of the resample median — the probability that it equals , and — and check that the three probabilities sum to one.
- (c)Compute the bootstrap mean of the median and the bootstrap standard error of the median, both exactly.
- (d)Give the percentile interval for the median and explain what it reveals about bootstrapping a median from three observations. Then show, without enumerating, that the bootstrap standard error of the mean is exactly , and say why that statistic behaves better.
Solution
(a) Counting. Each of the three positions takes one of three values, so there are equally likely ordered resamples. Ignoring order, a resample is a multiset of size from types, of which there are — but these are not equally likely. A resample contains all three distinct values in of the orderings, so the probability is ; the other of resamples repeat at least one observation, which is what makes sampling with replacement produce any variation at all.
(b) The median. The resample median is the middle value of the three draws.
The median is exactly when at least two of the three draws are : two of them, , or all three, . So , and by the same count .
The median is in the remaining cases — at least two s ( again) or all three values distinct (, from (a)), which are disjoint — giving .
Check: . ✓
(c) Moments of the bootstrap median. Writing for the resample median,
Hence
and the bootstrap standard error of the median is
Note that the bootstrap mean is above the observed median : the resampling distribution has inherited the right skew of the data, since a resample that picks up the twice moves the median much further than one that picks up the twice.
(d) The percentile interval. The bootstrap distribution has only three atoms. Its cumulative probabilities are and . The quantile is the smallest value with cumulative probability at least , which is ; the quantile is the smallest value with cumulative probability at least , which is . The percentile interval is — the entire range of the data. Indeed every percentile interval wider than the middle is : the distribution is far too coarse to yield anything else. The bootstrap has not manufactured information three observations do not contain; a resample median is always one of the observed values, so with tiny the bootstrap distribution of the median is a handful of points and its quantiles are crude.
The mean, without enumeration. A resample mean is the average of three independent draws from the empirical distribution, which puts mass on each of . That distribution has mean and variance
so the variance of the average of three independent draws is and
This is just with the divisor- standard deviation — the bootstrap reproduces the textbook formula because the mean is linear in the data. The mean behaves better as a bootstrap target because it varies continuously with the resample: the resamples give many distinct means spread smoothly over the range, whereas the median jumps between three values. The same reasoning is why a trimmed mean bootstraps more smoothly than a median at small .