Learn

Learning preferences

Make learning more comfortable. Changes apply immediately.

Enlarges page content, including diagrams and their labels. You can also use your browser’s zoom.

Choose the colours that are easiest for you to distinguish. Applies to lesson diagrams and lab plots. Labels, shapes, hatching and line patterns also distinguish meanings. Source photographs and raw image brightness stay unchanged; mask-only views are available for image overlays.

ExampleComparisonSample link

Saved in this browser on this device. Preferences are separate from progress backups.

Lesson 2 of 4

Specified continuous-null calibration

Prove the continuous probability-integral transform.

Loading your saved responses…

Try

Four independently sampled, exactly recorded proportions are 0.1, 0.3, 0.6 and 0.9. The null hypothesis specifies their entire distribution: each is Uniform[0,1], independently of the others. There is no parameter estimated from these observations. How surprising is their ECDF discrepancy under that precise model?

From the two-sided jump calculation, the right-gap candidates are .15,.20,.15,.10 and the left-gap candidates are .10,.05,.10,.15. Thus D=.20. A value of D is not itself a probability. Calibration compares it with the distribution of D from new samples of the same size under the null. The name one-sample Kolmogorov–Smirnov statistic, or KS statistic, refers here to this supremum distance from a specified CDF.

Predict

Suppose someone generates nine null samples, counts the discrepancies at least as large as the observed one, and divides by nine. If none exceed it, should they report an exact p-value of zero? Predict what changes when the observed record is counted as one of ten exchangeable records.

Also compare two contracts: a CDF fixed before seeing data, and a CDF whose parameters are estimated from those same data. The first is our subject. The second changes the statistic and its reference distribution; replacing an unknown parameter by an estimate does not preserve this proof automatically.

Experiment

For the live calculation, return to the shared discrepancy and calibration lab. Select the specified uniform model, record the sample, seed and replicate count before running, and compare its result with the proof below. Its fitted option belongs to a different procedure, explained in the following lesson.

Use the following schematic statistic record, not claimed output from a random-number generator. Its observed discrepancy is .20. The nine reference discrepancies are .14, .16, .20, .22, .30, .40, .18, .15 and .25. Mark each comparison using “greater than or equal,” including the tie.

RecordObserved123456789
D.20.14.16.20.22.30.40.18.15.25
D ≥ .20?yesnonoyesyesyesyesnonoyes

There are five qualifying reference records. The upper-rank Monte Carlo p-value is (1+5)/(9+1)=.60. The raw reference-tail estimate is 5/9; it answers a different numerical question. Neither number is the analytically evaluated finite-sample KS tail for D=.20. With nine replicates the rank p-value cannot be smaller than .10, even if the observation exceeds all nine.

If the table consists of rounded displays, comparisons must use the retained statistic values, not recomputed ranks from rounded labels. If rounding is deliberately part of the statistic, apply exactly the same rule to observed and reference records. Then the tie argument below applies to that rounded statistic, whose calibration is different from the unrounded one.

Understand

Why a specified continuous null becomes uniform

Let F₀ be a continuous CDF and X have that distribution. For 0<u<1 let q be the supremum of all real x with F₀(x)≤u. CDF limits at infinity make this set nonempty and bounded above. Continuity and monotonicity give F₀(q)=u: a value below u would allow larger x, and a value above u contradicts continuity from values in the set. Moreover F₀(x)≤u exactly for x≤q. Therefore P(F₀(X)≤u)=P(X≤q)=F₀(q)=u. Limits handle u=0 and 1. This proves the probability-integral transform, including a continuous CDF with flat portions. Continuity is essential; for a point mass at 0 the value F₀(X) is always 1, not uniform.

Independent X₁,…,Xₙ give independent Uᵢ=F₀(Xᵢ), because deterministic transformations applied separately preserve independence. The ordered-jump formulas express D entirely through the ordered U values and the ranks i/n. Thus, for every fully specified continuous F₀, its null D distribution is exactly the same as for iid uniforms on [0,1]. This is a distributional theorem, not a claim that a finite simulation gives its exact CDF. Rounding observations or retaining dependence can invalidate the assumed continuous iid model even when the code computes D correctly.

For one observation, D=max(U,1−U). As an independent analytic check, P(D≥d)=2(1−d) for 1/2≤d≤1, with tail 1 below 1/2 and 0 above 1. Thus an observed U=.8 has D=.8 and exact null tail .4. This special calculation is not a formula for larger n.

An exact finite-randomization guarantee under its assumptions

Fix a statistic T and sample size n before the calculation. Let T₀ be the observed statistic and T₁,…,Tᴮ the statistics from B independent ideal null samples, independent of the original sample. Under the null the B+1 statistics are iid, hence exchangeable: permuting their labels does not change their joint law. Independence is sufficient here; the rank proof itself needs exchangeability.

Define M=B+1 and pᴹᶜ=(1+number of j≥1 with Tⱼ≥T₀)/M. For any fixed list of M values, assign to each position i the upper-tail count Rᵢ=number of positions j with Tⱼ≥Tᵢ. For an integer k, at most k positions have Rᵢ≤k. To see this, sort from largest downward and group ties; every member of a tied block receives the block’s last rank. The qualifying positions consist of whole initial blocks ending no later than k.

By exchangeability all positions have the same probability of meeting Rᵢ≤k. Averaging their indicators and using the deterministic bound gives P(R₀≤k)≤k/M. Taking k=floor(Mα) proves

P(pᴹᶜ≤α)≤floor(Mα)/M≤α.

This is a null rejection-probability guarantee over repeated observations and reference sampling, not a guarantee conditional on a particular observed dataset. Ties make the test conservative; no ties give uniform ranks and equality at attainable grid levels. For example, if every statistic equals the same value, pᴹᶜ=1 always. Using strict exceedances would instead give 1/M and could reject an all-equal null almost surely. A separate independent randomized tie-breaking scheme can be valid, but it is not the deterministic rule taught here.

The added 1 and denominator B+1 are substantive. With B=1 and iid continuous null statistics, the naive proportion of references exceeding T₀ is zero with probability 1/2. Rejecting whenever that naive value is at most .05 would have size 1/2. The corrected rank value is at least 1/2 and never rejects at .05.

Three different errors and one reproducible protocol

Conditional on an observed statistic t, the reference exceedance count K is Binomial(B,θ), where θ=P(T≥t) under the specified null. The raw estimator K/B has conditional variance θ(1−θ)/B, at most 1/(4B). That describes Monte Carlo estimation error for the fixed tail θ. It is not the same object as the finite-rank test guarantee, and neither addresses model misspecification.

For an implementation, record the null CDF, n, statistic convention, seed, B and comparison rule. Generate reference samples independently under the declared model, recompute the same statistic for every sample, retain full-precision values, and round only for display. A reproducible pseudorandom generator and finite-precision CDF are implementations of this mathematical experiment, not a proof that their outputs are ideal iid continuous variables. State numerical approximations and generator limitations. If the statistic has a known numerical error bound, uncertain comparisons need an explicit policy rather than silently choosing a favorable side.

Repeating a simulation until its p-value crosses a preferred threshold is not this fixed-B procedure. Larger B improves resolution and tail estimation, but cannot fix biased observation collection, an incorrect null, an omitted parameter fit or dependent observations.

Apply

An analyst chooses B=19 before sampling and obtains no reference discrepancy at least as large as the observed one. Calculate the rank p-value and the raw tail estimate. Can the test reject at α=.01? Then suppose 99 reference records contain four qualifying values. Give the p-value, its resolution, and the largest possible conditional standard deviation of the raw tail estimator.

Check the decisions and their limits

For B=19, pᴹᶜ=1/20=.05, while K/B=0. The fixed-rank rule cannot reject at .01. For B=99 and K=4 it gives 5/100=.05, with grid spacing .01. The raw estimator is 4/99 and its conditional standard deviation is at most 1/(2√99), approximately .0503. This worst-case bound is not a confidence interval and does not say the actual error equals its bound. The model and ideal-randomization assumptions remain necessary.

Continue

Keep the discrepancy computation, reference law and decision rule as separate records. Reuse randomized testing for the distinction between a statistic and a null-error guarantee, and resampling limitations for failures that more replicates cannot repair. The next question is how estimating a parameter from the same sample changes the statistic and why each reference replicate may need its own fit. The present proof must not be relabeled a general fitted-null bootstrap theorem.

Apply · explain · revise

Practice and reasoning

Drafts save locally as you type. Reveal worked solutions when useful; the site remembers that exposure. Automatic matches check the requested answer, while written arguments require review against the rubric.

Prove F(X) is uniform when X has a continuous CDF F, allowing flat parts. Use the rightmost level set for 0<u<1. Explain the iid requirement for a transformed sample and give an atomic counterexample.

Structure your argument and preserve revisions

These optional planning fields save locally. Recording your response saves an immutable copy of the argument and these fields. Older records may contain only first/latest responses; missing intermediate revisions are not reconstructed.

Each field allows 2,000 characters. Keep a specific claim, state where it applies, cite the facts you use, and explain what still needs checking. Blank fields are allowed and are not evidence of mastery.

For exchangeable statistics T0,…,TB, prove the test p=(1+#{j≥1:Tj≥T0})/(B+1) satisfies P(p≤alpha)≤alpha for 0≤alpha≤1, including ties. State when grid equality holds and why this is not conditional validity for each fixed observed dataset.

Structure your argument and preserve revisions

These optional planning fields save locally. Recording your response saves an immutable copy of the argument and these fields. Older records may contain only first/latest responses; missing intermediate revisions are not reconstructed.

Each field allows 2,000 characters. Keep a specific claim, state where it applies, cite the facts you use, and explain what still needs checking. Blank fields are allowed and are not evidence of mastery.

A prespecified calculation has B=39 independent null reference samples; three statistics are strictly larger than the observed statistic and two equal it. Compute the conservative rank p-value, decide at alpha=.10, and find the minimum B permitting any rejection at alpha=.01. State how rounding should enter the comparison contract.

Structure your argument and preserve revisions

These optional planning fields save locally. Recording your response saves an immutable copy of the argument and these fields. Older records may contain only first/latest responses; missing intermediate revisions are not reconstructed.

Each field allows 2,000 characters. Keep a specific claim, state where it applies, cite the facts you use, and explain what still needs checking. Blank fields are allowed and are not evidence of mastery.

With B=1 and iid continuous null statistics T0,T1, compute the null rejection probability of the naive rule that rejects when #{T1≥T0}/1≤.05. Compare the corrected rank rule. Then give an all-ties example showing why strict comparisons fail even with the added 1.

Structure your argument and preserve revisions

These optional planning fields save locally. Recording your response saves an immutable copy of the argument and these fields. Older records may contain only first/latest responses; missing intermediate revisions are not reconstructed.

Each field allows 2,000 characters. Keep a specific claim, state where it applies, cite the facts you use, and explain what still needs checking. Blank fields are allowed and are not evidence of mastery.

Conditional on observed statistic t, derive the mean and variance of K/B where K counts B independent null reference statistics at least t. Explain why K/B and (K+1)/(B+1) have different roles. For the one-observation uniform KS statistic derive its exact upper tail and evaluate at observed x=3/4.

Structure your argument and preserve revisions

These optional planning fields save locally. Recording your response saves an immutable copy of the argument and these fields. Older records may contain only first/latest responses; missing intermediate revisions are not reconstructed.

Each field allows 2,000 characters. Keep a specific claim, state where it applies, cite the facts you use, and explain what still needs checking. Blank fields are allowed and are not evidence of mastery.

Audit three proposed uses of uniform-reference KS calibration: all observations are copies of one continuous draw; observations were rounded to whole units; a normal CDF uses the sample mean and sample SD and reference replicates are compared to that fixed fitted CDF. State what the fixed-null proof does and does not justify, including pseudorandom implementation limitations.

Structure your argument and preserve revisions

These optional planning fields save locally. Recording your response saves an immutable copy of the argument and these fields. Older records may contain only first/latest responses; missing intermediate revisions are not reconstructed.

Each field allows 2,000 characters. Keep a specific claim, state where it applies, cite the facts you use, and explain what still needs checking. Blank fields are allowed and are not evidence of mastery.

Reflect and continue

Before marking this lesson complete, explain one key idea without the worked solution and identify a condition that matters. Marking complete records participation, not independent mastery.