Continuity correction 2026-10-14
A continuity correction shifts a discrete probability boundary by half a lattice spacing before using a continuous normal approximation. For an upper-tail event on a unit lattice, the approximation is . Lower tails use the boundary . The correction is used in approximate Wilcoxon signed-rank tests and Wilcoxon rank sum tests; tied ranks also require the appropriate variance adjustment.
Past exam of the mathematics course of the University of Cambridge 2001 iii Paper 32 5 ii Solution Created 2026-10-03 Updated 2026-10-14
Use the usual two mutually independent samples, and rank their pooled observations increasingly. Continuity gives no ties with probability one. Let be the pooled rank of and define the Wilcoxon rank sum test statisticThe last identity counts the ranks contributed by the other sample after subtracting the within- ranks.
When , the observations are stochastically smaller, so reject for small , equivalently small . For instance,The inequality follows from and for continuous . A common-uniform quantile coupling also makes this direction transparent: , and is nondecreasing in each .
Under the common-distribution null hypothesis, the pooled observations are exchangeable. Every selection of ranks for the labels has probability . Thus the exact null law isChoose a lower-tail critical value with probability at most the desired size, optionally randomizing at its boundary to attain the size exactly. This law is independent of the unknown common distribution. Common increasing transformations leave the pooled ranks of observations unchanged, so the statistic is a function of the maximal invariant from part (i). Although a rank sum is not itself maximal, it is an invariant test statistic. These facts justify the test within nonparametric statistics.
Sampling ranks without replacement givesso with the same variance. For with , the normal approximation for a rank sum statesEquivalently replace by . The large-sample one-sided test rejects when this standardized statistic is below the lower normal distribution quantile. This is the two-sample rank-sum test, rather than the paired Wilcoxon signed-rank test.
Past exam of the mathematics course of the University of Cambridge 2003 iii Paper 41 5 ii Solution Created 2026-10-03 Updated 2026-10-14
For the Wilcoxon signed-rank test, assume independent observations from a continuous distribution symmetric about the specified . Form , rank the absolute differences , and add the ranks of positive differences:Under the continuous null there are no zeros or tied absolute values with positive probability. Symmetry makes the signs independent fair signs conditional on the magnitudes, so the exact null distribution is that of for independent . In particularThe coefficients of this polynomial give exact tail probabilities, or they can be computed by recursively adding a rank with probability one half. A two-sided test rejects for unusually small , equivalently for extreme on either side of its center. Choose symmetric tail cutoffs with total null probability at most ; discrete boundary randomization can attain size exactly . An exact conservative two-sided p-value is . For a positive-location alternative use the upper tail, and for a negative-location alternative use the lower tail.
For large samples, centering and scaling by the displayed mean and standard deviation gives an asymptotic standard normal statistic. This follows from the independent weighted Bernoulli representation, because the largest squared weight is negligible relative to the sum of squared weights. A continuity correction improves the normal tail approximation. With observed zero differences, omit them in the usual convention; tied absolute differences receive average ranks, and the conditional null variance is then one quarter of the sum of squared assigned ranks, not automatically the no-tie formula.
Symmetry is essential: having median alone need not make the signs independent of the magnitudes, and so does not justify these exact critical values. The test is particularly useful for location shifts in symmetric families. It is a valid test of the stated symmetry null, but is not an omnibus procedure guaranteed to detect every asymmetric alternative.
Past exam of the mathematics course of the University of Cambridge 2005 iii Paper 42 5 Solution Created 2026-10-03 Updated 2026-10-14
Let . Under the symmetric continuous null hypothesis, positive and negative signs have probability and zeros have probability zero. For the sign test, take and reject for small values: under the null. Choose with ; randomization at the next value attains exact size if desired. The lower tail is appropriate for .
For the Wilcoxon signed-rank test, rank increasingly and put . Continuous observations have no absolute-value ties almost surely. Conditional on the absolute values, the signs are independent fair signs because symmetry makes the sign independent of magnitude. Hence has the distribution of for independent Bernoulli random variables with parameter . Again reject in the lower tail, using this exact subset-sum distribution or a normal approximation. Independence gives the requested null moments:For a symmetric kernel of fixed order , a one-sample U-statistic is . State the U-statistic central limit theorem: if , , and , then . The nondegeneracy condition is important.
For , its order-two U-statistic satisfies the exact Wilcoxon signed-rank statistic identityTo prove it, in an unordered pair the sign of the sum is the sign of whichever observation has larger absolute value. Counting the pairs for which a positive observation is larger contributes its rank minus one; its own positive-sign indicator supplies the remaining one.
Write for the distribution function of under the null. Symmetry gives andThe probability integral transform makes uniform on , so . Therefore . The centred is and is negligible on the scale of . Combining the exact decomposition and its mean givesThe lower-tail approximate level- rejection rule compares this standardized statistic with ; a half-unit continuity correction can refine discrete-tail calculations.
Past exam of the mathematics course of the University of Cambridge 2007 iii Paper 43 4 Solution Created 2026-10-03 Updated 2026-10-14
The experimental unit for comparing the treatments is the pot: its two plants form a pair. Let be cross-fertilised minus self-fertilised height in pot , for . The paired Wilcoxon signed-rank test assumes independent differences with a continuous distribution symmetric about a location . Its null is , with the one-sided formulation , against . Under this location model it asks whether cross-fertilisation produces a positive shift within a pot. The location is a median, and also a mean if it exists; a hypothesis merely about a median without symmetry does not justify the signed-rank null distribution.
Test 1 uses this paired test and its exact distribution. Form the fifteen differences, omit any zero differences, rank their absolute values, and sum the statistical ranks belonging to positive differences. That positive-rank sum is the reported . Tied absolute differences receive average statistical ranks. Under the symmetric zero-location null, conditional on their magnitudes, the signs are independent fair signs. The exact upper-tail probability is obtained from all sign allocations to the observed statistical ranks: with fifteen nonzero differences there are equiprobable allocations. For untied absolute differences the rank weights are ; ties would require the corresponding conditional rank weights. The reported probability of a positive-rank sum at least as large as observed is . No normal approximation is used.
Test 2 makes exactly the same paired comparison and has the same null and alternative hypotheses.
exact=F replaces the exact distribution by a normal approximation with a continuity correction. Under an untied null the positive-rank sum hasMore generally, conditional on the nonzero absolute statistical ranks , its variance is . The upper-tail correction places the boundary half a lattice unit below the observed statistic. Standardizing gives the reported , and its approximate -value is . Thus the slight difference from Test 1 reflects approximation, not a different scientific question.Test 3 omits
paired=T, so it is the unpaired Wilcoxon rank sum test. Its usual distribution-free null is that two independent samples have the same continuous distribution. In a common-shape location model this is a zero location difference, against a positive cross-minus-self shift. More generally “greater” directs the test towards the cross distribution being shifted upwards; it does not turn the test into a general comparison of means or medians for arbitrary unequal shapes.To form its statistic, pool the thirty heights, rank them together with averaged statistical ranks for ties, and add the cross-group statistical ranks to get . Equivalently use . Under independent untied samples,If the pooled ties have sizes and , the variance becomesSubtract the null mean and the upper-tail continuity correction, then divide by this null standard deviation. This procedure gives the reported rank-sum . Its approximate one-sided probability is . This describes how the statistic and probability are obtained without reconstructing the unprinted heights.
For the statistician, use the paired analysis, preferably the exact Test 1 for these fifteen pairs. The independent units are the pots, while the two heights within a pot share growing conditions and cannot be treated as independent samples. Test 2 is a reasonable approximation to the same paired test and agrees closely. Test 3 discards the matching and uses a null variance that assumes independence between the samples, so its smaller -value is not a reason to prefer it. The appropriate paired result gives evidence at , but not at , that cross-fertilised plants have a positive height shift relative to their paired self-fertilised plants, subject to the symmetry assumption for differences.
Past exam of the mathematics course of the University of Cambridge 2009 iii Paper 38 4 Solution Created 2026-10-03 Updated 2026-10-14
For the one-sided Wilcoxon rank sum test, suppose and are independent samples, iid within each sample, with continuous distributions. The null hypothesis is a common distribution. For a lower-tail alternative, the distribution is stochastically smaller. In the common-shape location model , this is against ; in that model it also compares medians. Without a location-family assumption, equality or inequality of medians alone is not the defining rank-sum hypothesis.
Rank all observations from smallest to largest and form . Reject for small . Under , the labels are exchangeable, so every subset of of the ranks is equally probable. The exact null distribution of a rank sum is thereforeEnumerate these subsets, or use the coefficient of in . An efficient recursion adds rank either to the selected sample or not: , starting with . The lower-tail P-value is . A nonrandomized level- test chooses a lower-tail rejection region whose null probability is at most .
The shifted Mann–Whitney U test statistic is . It counts pairs with , so the same lower-tail test uses small . The distinction is important for these S-Plus outputs: the printed values are raw rank sums, not the shifted statistic used by some other software.
For the one-sided Wilcoxon signed-rank test, the pairs are independent between individuals but their two measurements may be dependent. Let , and assume the differences are iid, continuous and symmetric about a common location . Test against . Rank the absolute differences and useUnder the null, conditional on their absolute values, the signs are independent fair signs. Every subset of ranks therefore has probability of being the positive-sign subset, giving the exact null distribution of . Reject for small and calculate the lower-tail probability. Its null mean and variance are and . The symmetry assumption is essential: zero median by itself does not give this law. With zeros or ties, omit zero differences in the usual signed-rank version and use average ranks for ties, adjusting the distribution accordingly. The paired test is not appropriate for the independent RHR samples here.
For the experienced participants, let denote RHR1 running time and denote RHR2 running time. The null hypothesis is identical running-time distributions; under the location interpretation it is zero RHR1-minus-RHR2 shift. The one-sided alternative is a negative shift, so RHR1 participants tend to run faster. With , the printed statistic isAt , reject the null in favour of faster RHR1 running times. The sample medians and minutes agree with that direction; their difference is descriptive, not the rank-sum test statistic.
For the new participants the same independent-sample Wilcoxon rank sum test compares eight RHR1 times against nine RHR2 times, again with a lower-tail alternative. HereThe exact null distribution of a rank sum gives this probability. It does not reject at , although it is just below . The data suggest the same direction but are less decisive; this is not evidence that the two new-participant distributions are equal.
The final command pools the experienced and new RHR1 samples into observations, and the corresponding RHR2 samples into . It repeats the lower-tail rank-sum comparison on these two pooled groups.
exact=F requests a normal approximation for a rank sum with a continuity correction. Without ties,The lower-tail statistic is , with the usual tie-adjusted variance if ties occur. The supplied output iswhere is the standard normal distribution function. Thus the pooled test rejects at . The unreported pooled ranks must be formed afresh: the within-cohort raw rank sums cannot simply be added because pooling introduces cross-cohort comparisons.Taken together, there is evidence that participants classified as RHR1 have shorter running times among the experienced men and in the pooled sample. The smaller new-participant samples give weaker evidence in the same direction. A significant result in one cohort and a nonsignificant result in another does not itself prove that their RHR effects differ. Pooling also assumes a meaningful pooled comparison; if programme duration changes the distributions, a cohort-adjusted analysis would be more informative. These observational comparisons do not establish that the fitness programme caused the differences, and none of the three tests directly compares experienced participants with new participants.
Rank of an observation 2026-10-14
The rank of an observation records where that observation lies among the order statistics of a statistical sample. When all values are distinct, and . For , the ranks of observations in original order are : the first observation is fourth smallest, while the fourth observation is third smallest.
Ties require a convention. A tied block occupying sorted positions can assign each member the average rank of an observation , the minimum position , or the maximum position ; an explicit rule can also break ties into distinct positions. R's official documentation describes these choices and uses average ranks by default. [ref]
https://stat.ethz.ch/R-manual/R-devel/library/base/html/rank.html. R base documentation: sample ranks and tie methods
.For example, has order statistics . The two observations occupy positions and ; average ranks of observations are , whereas minimum-position ranks are . A fractional average rank is a summary of tied positions, rather than an index of one order statistic. Without omissions, distinct ranks and average ranks sum to , since averaging each tied block preserves its sum; minimum-position ranks need not.
Wilcoxon signed-rank tests rank the absolute nonzero paired differences, while Wilcoxon rank sum tests rank the pooled observations from two samples; these are different rankings.