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 1 of 4

Empirical CDFs and QQ evidence

Compute both sides of tied empirical jumps and explain QQ plotting positions.

Loading your saved responses…

Try

Four recorded proportions are 0.10, 0.25, 0.25 and 0.80. Compare their distribution with a fully specified uniform law on [0,1]. A histogram would require choosing bins. Instead ask, at every threshold x, what fraction of observations is at or below x. This gives the empirical cumulative distribution function, abbreviated ECDF.

For n observations x₁,…,xₙ with n≥1, define Fₙ(x)=(number of i with xᵢ≤x)/n. Equivalently it is the average of the indicators 1❴xᵢ≤x❵, each equal to 1 when its condition holds and 0 otherwise. The empirical law puts mass 1/n at each observation, counting repeated observations separately. This is a descriptive construction even without a random-sampling model. An inferential interpretation will additionally need a sampling model.

At x=0.25 the ECDF is 3/4, but immediately to its left it is 1/4. Draw this jump before proceeding. Return to CDFs and atoms if the distinction between F(x) and its left limit F(x−) is unfamiliar.

Predict

The reference CDF F₀(x) is 0 below 0, x on [0,1], and 1 above 1. Predict whether the largest vertical discrepancy occurs before or after the repeated value 0.25. Also predict whether a plot containing only the right endpoints of jumps could miss the largest discrepancy in another sample.

A CDF is right-continuous: Fₙ includes an observation at its exact threshold. A repeated value has one combined jump, not several different thresholds. Here that jump has height 2/4. Ties are legitimate descriptive data; under an exactly observed iid continuous law they have probability zero. Rounding, discrete measurement or dependence can change that model. Do not erase a tie merely to make a continuous-null test applicable.

Experiment

Compare the exact step graph with the reference line. Coordinates use the same probability scale on both axes. At each jump the open circle marks the left limit and the filled circle the actual ECDF value.

Four observations, including a tied pairHorizontal coordinate is x and vertical coordinate is cumulative probability, both from zero to one. The ECDF is zero until .1, .25 until .25, .75 until .8, then one. The uniform reference is the diagonal. At .25 the ECDF .75 exceeds the reference .25 by .5.011threshold xcumulative probabilitygap = 1/2reference F₀(x)=x.10.25.80
Graph coordinates are x ↦ 60+440x and probability y ↦ 290−260y. The jump is not a sloping interpolation between observations.

Sort the observations as x₍₁₎≤⋯≤x₍ₙ₎. Complete the following calculation by hand, especially the two rows sharing x=0.25. Entries that are negative are retained during the calculation; the column maxima are the relevant discrepancies.

ix₍ᵢ₎F₀(x₍ᵢ₎)i/n−F₀(x₍ᵢ₎)F₀(x₍ᵢ₎)−(i−1)/n
11/101/103/201/10
21/41/41/40
31/41/41/2−1/4
44/54/51/51/20

The live experiment below starts with a different, untied sample: .1,.3,.6,.9. First use its specified Uniform[0,1] mode and predict D=.2. Then enter the worked tied sample .1,.25,.25,.8 and inspect both sides of its jumps. Keep the continuous-model warning separate from the exact descriptive discrepancy. The simulation controls are explained in the next lesson; no simulation is required to verify the table.

Live experiment: discrepancy and calibration

Predict which side of the empirical jump gives the largest gap. Then compare a specified model with a model fitted to the same observations. Inputs and simulations are temporary; record your evidence in the lesson response.

D⁺ = 0.2; D⁻ = 0.15; D = 0.2.

Empirical jump limits against model probability, both axes zero to one011Model CDF F(x), probability scaleJump top: ≤ xBottom: < x
Probability-scale jump diagram: vertical segments join empirical left and right limits at each observed value. The diagonal is agreement. This is a gap diagram, not a connected ECDF against raw time; the table gives raw values and QQ coordinates.
Inspect ordered ranks, gap calculations and QQ coordinates
Rank ixᵢF(xᵢ)i/n−FF−(i−1)/nQQ positionModel quantile
10.10.10.150.10.1250.125
20.30.30.20.050.3750.375
30.60.60.150.10.6250.625
40.90.90.10.150.8750.875

Positions are (i−½)/n. Within a tied block, only the first lower rank and last upper rank are actual ECDF jump limits; intermediate ranks still produce the correct maximum formula.

The reference assumes independent observations from the stated continuous null. The rank-test proof assumes genuinely independent null draws; this reproducible xorshift32 simulation and floating-point CDF arithmetic approximate that ideal. It is not an exact KS distribution evaluator or evidence that the null is true. Choosing a model after inspecting results requires a new validation plan. Simulations stop on cancellation, hiding, leaving this panel or navigation.

The positive-direction maximum is D⁺=1/2; the negative-direction maximum is D⁻=1/10. The largest absolute discrepancy is D=1/2. This is an exact descriptive result, not yet a p-value.

Understand

Why both sides of every jump suffice

For a continuous reference CDF F₀ define D⁺=sup over real x of (Fₙ(x)−F₀(x)), D⁻=sup over real x of (F₀(x)−Fₙ(x)), and D=max(D⁺,D⁻). The supremum means the least upper bound; a left-limit gap need not be attained at the jump itself.

Between consecutive distinct observations Fₙ is constant and F₀ is nondecreasing. Consequently Fₙ−F₀ is largest at the left endpoint, just after its jump, while F₀−Fₙ is largest in the limit just before the next jump. The exterior intervals are handled by F₀ tending to 0 and 1. Continuity gives the same reference value on both sides of each observation. If a tied block occupies positions a through b, its left ECDF value is (a−1)/n and its right value is b/n. Thus its two candidates are b/n−F₀(x) and F₀(x)−(a−1)/n.

Equivalently, keeping every ordered row gives

D⁺=max over i of (i/n−F₀(x₍ᵢ₎)),

D⁻=max over i of (F₀(x₍ᵢ₎)−(i−1)/n).

Within each tied block the last row maximizes the first expression and the first row maximizes the second. Intermediate artificial ranks do not alter either maximum. Both maxima are nonnegative: the last row supplies 1−F₀(x₍ₙ₎)≥0 and the first supplies F₀(x₍₁₎)≥0. This proves the formula, including ties and observations outside a bounded reference support. If F₀ has jumps, its own left limits also matter: these formulas must not be imported unchanged.

What a QQ plot asks instead

A quantile–quantile plot compares ordered observations with reference quantiles. Choose and disclose plotting probabilities pᵢ=(i−1/2)/n and put the point (Q₀(pᵢ),x₍ᵢ₎) in the plot, where Q₀(p)=inf❴x:F₀(x)≥p❵. Horizontal coordinates are theoretical quantiles; vertical coordinates are observations, in matching units. For our uniform example the points are (1/8,1/10), (3/8,1/4), (5/8,1/4), (7/8,4/5).

A specified-model identity line is a comparison, not a line fitted to force agreement. A location/scale line estimated after seeing data changes the question. Plotting positions are a declared convention; another convention changes finite-sample points. No p-value or rejection threshold follows merely from seeing a nearly straight plot. Use it to locate possible departures and propose further checks.

Pointwise evidence is not automatically uniform

Under iid sampling with true CDF F, each Fₙ(x) is an average of Bernoulli variables with mean F(x) at a fixed x. Its variance is F(x)(1−F(x))/n≤1/(4n), so Chebyshev proves convergence in probability at that x. Checking finitely many thresholds allows a union bound. Neither argument, without another step, controls the supremum over all real thresholds at once. Uniform empirical convergence is a separate theorem; no general uniform theorem or exact KS reference distribution is being assumed from a finite plot.

Apply

Use observations 1,4,4,9 and the specified Uniform[0,10] law. Compute both jump gaps and all QQ coordinates using the same plotting-position convention. Then try observations 0.7,0.8,0.9 against Uniform[0,1]: does looking only after jumps now underestimate D?

Review the changed calculations

The first transformed values are .1,.4,.4,.9. The D⁺ candidates are .15,.10,.35,.10; D⁻ candidates are .10,.15,−.10,.15. Hence D⁺=.35, D⁻=.15 and D=.35. QQ coordinates are (1.25,1), (3.75,4), (6.25,4), (8.75,9). For the second sample, D⁺=1/10 but D⁻=7/10, approached immediately before the first observation. A right-jump-only calculation would miss the dominant gap.

Continue

Retain the sorted sample, tie blocks, reference CDF, both gap columns and plotting convention. Separately record why the observations could or could not follow the proposed sampling model. Continue to fixed-null KS and calibration for the statistical reference calculation. Describing a discrepancy and calibrating its sampling distribution are different proof obligations.

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.

For observations −1,0,0,2 and reference Uniform[−2,3], construct the full ECDF, including left limits at its jumps. Compute both supremum gaps by an ordered table. Explain whether this descriptive calculation alone validates continuous-null inference.

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 arbitrary n≥1 observations, including ties, and continuous reference CDF F, prove the two ordered-rank formulas for sup(Fn−F) and sup(F−Fn). Account for exterior intervals and explain which rows of each tied block matter.

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 observations 2,5,5,8 and a specified Uniform[0,10] reference, construct QQ coordinates using pi=(i−1/2)/4. Compute D separately. Explain why fitting a line through QQ points is not automatically a test of the specified reference.

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 observations 3/5,4/5 against Uniform[0,1], compare the maximum absolute gap evaluated only at observed points with the true supremum. Then show the continuous-reference formula fails for one observation at 0 when the reference itself is a unit point mass at 0.

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 iid data with true CDF F, prove a probability bound for max over m fixed thresholds of |Fn−F|≥epsilon. Explain why replacing m by infinitely many real thresholds is not a proof of uniform ECDF convergence. Give a general function counterexample to pointwise convergence implying uniform convergence.

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.

Let H be a strictly increasing continuous bijection R→R. Transform observations yi=H(xi) and the reference to G(y)=F(H inverse(y)). Prove the supremum discrepancy is unchanged. Contrast this with fitting an unknown transformation from the same data, and verify the claim for changing units H(x)=3x+2.

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.