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

Fitted nulls and parametric bootstrap

Derive the exponential rate fit and scale-invariant discrepancy.

Loading your saved responses…

Try

A device records independent waiting times. You want to examine the family of exponential distributions, but the rate is unknown. If you estimate that rate from the same observations used in a goodness-of-fit statistic, should a reference sample be compared with the original fitted rate, or with its own fitted rate?

Use the small synthetic sample x=(1,3) in time units. This is an arithmetic example, not enough evidence to validate a physical waiting-time model. For rate λ>0 the exponential density is λ exp(−λx) for x≥0, with CDF Fλ(x)=1−exp(−λx). The rate has inverse-time units. The model assumes independent, identically distributed, uncensored, continuously measured observations. A fitted scale does not remove dependence, truncation or rounding.

Review likelihood and boundaries and resampling limitations. Here we derive a special exact calibration argument. We will not call every parametric bootstrap exact.

Predict

Write S=Σᵢxᵢ and let n be the sample size. For S>0, predict how the fitted rate changes if the same measurements are expressed in units twice as large numerically, so every xᵢ is replaced by 2xᵢ. What happens to the fitted probabilities Fλ̂(xᵢ)?

Our statistic is the two-sided ECDF discrepancy Dfit=sup over real z of |Fₙ(z)−Fλ̂(z)|. Fₙ is the right-continuous empirical CDF, assigning mass 1/n to each observation. For ordered data x₍₁₎≤⋯≤x₍ₙ₎ and a continuous reference CDF, compute both sides of each empirical jump:

D⁺=maxᵢ(i/n−Fλ̂(x₍ᵢ₎)), D⁻=maxᵢ(Fλ̂(x₍ᵢ₎)−(i−1)/n), Dfit=max(D⁺,D⁻).

Tied observations can still be entered in this algebraic formula: the first and last ranks of a tied block supply its two sides. But an algebraically computable statistic does not automatically justify continuous-data calibration for rounded observations.

Experiment

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.

In the live experiment, select Exponential rate fitted to observations and enter 1, 3. Compare the displayed rate and both gaps with the worked table below. Then enter 2, 6 and predict the unchanged discrepancy. Before pressing Simulate null reference, choose and record a seed and replicate count; inspect both the refitted reference and the deliberately wrong frozen-rate comparison. These finite seeded results approximate the ideal random-draw argument below. Reset restores a specified-uniform example, so select fitted exponential again for this activity.

Fit x=(1,3), then repeat the calculation for 2x=(2,6). Calculate the two one-sided gaps independently before using the table; CDF values and gaps below are rounded numerical values.

Rank ix₍ᵢ₎F₀.₅(x₍ᵢ₎)i/2−FF−(i−1)/2
110.39346934030.10653065970.3934693403
230.77686983990.22313016010.2768698399

The fitted rate is 1/2 and Dfit=1−exp(−1/2)≈0.3934693403. For (2,6), the fitted rate is 1/4 and every fitted CDF value is unchanged. The estimated rate changed, but the shape discrepancy did not.

Now use y=(1/2,3/2) as a transparent possible reference record. This is a worked record, not a randomly generated simulation result. Its own fitted rate is 1, giving the same Dfit as x. If instead you freeze the original rate 1/2, the reference CDF values become approximately 0.2211992169 and 0.5276334473. The frozen statistic is exp(−3/4)≈0.4723665527. You have computed a different statistic on the reference record.

Apply the same fitting rule to observed and reference recordsThe observed record goes through rate fitting and discrepancy calculation. Each reference record also goes through its own rate fit and discrepancy calculation. Their statistics are compared only after both have used the same rule.Observed xReference yᵇFit λ̂(x)Refit λ̂(yᵇ)Compute Dfit(x)Compute Dfit(yᵇ)Compare the fitted statistics
Text equivalent: observed x → fit its rate → Dfit(x); each reference yᵇ → fit its own rate → Dfit(yᵇ); then compare. Simulations are reference calculations, not new device observations.

Understand

Derive the fit and its boundary

For n≥1 nonnegative observations, the likelihood as a function of λ>0 is L(λ)=λⁿ exp(−λS). For S>0 its logarithm has derivative n/λ−S and second derivative −n/λ²<0. It increases before λ̂=n/S and decreases after it; equivalently it tends to minus infinity at both ends. Thus λ̂ is the unique global maximum. If S=0, all observations are zero and L(λ)=λⁿ grows without bound. There is no finite maximizing rate. An empty sample supplies no such estimator either.

Exact zero observations and exact ties have probability zero under this continuous model. A numerical calculation with some zeros and S>0 may be defined, but reported zeros/ties can signal rounding, censoring or a different mechanism. Do not silently replace S=0 by a small positive number or interpret a rate of infinity as an ordinary fit.

Prove the fitted statistic is a scale pivot

For c>0, λ̂(cx)=λ̂(x)/c. Hence λ̂(cx)·cxᵢ=λ̂(x)xᵢ, so every fitted CDF value and both jump-gap lists are unchanged. More generally Fₙ,cx(cz)=Fₙ,x(z); taking the supremum over all z proves Dfit(cx)=Dfit(x).

If Xᵢ are iid exponential with true rate λ, set Zᵢ=λXᵢ. Then P(Zᵢ≤z)=1−exp(−z), and the Zᵢ remain independent. Scale invariance gives Dfit(X)=Dfit(Z), so its finite-sample null distribution depends on n but not on λ. The statistic is pivotal for this particular fitted family. This does not mean λ̂ is unbiased, or that λ has been learned without uncertainty. It means scale has been removed from this distributional discrepancy.

To simulate a parametric reference at the fitted rate, generate independent Zᵇ from the unit-rate exponential model and put Yᵇ=Zᵇ/λ̂(X). Refit every Yᵇ. Then Dfit(Yᵇ)=Dfit(Zᵇ), an exact identity for every record with positive sum. Thus reference statistics generated this way have the same parameter-free law as the observed statistic, even though the displayed reference times use the data-dependent rate. They are also independent of the observed statistic under independent ideal random draws, because the data-dependent scale cancels completely. Simulating directly at rate 1 and refitting gives the same reference law.

Refitting and Monte Carlo calibration are separate requirements

For a fixed, predeclared count B of independent reference records of size n, let E count their fitted statistics greater than or equal to the observed one. The rank-based value (1+E)/(B+1) is superuniform under the ideal null: exchangeability gives a uniform rank when there are no ties, while counting all tied values as exceedances moves a tied rank toward the conservative end. This includes statistic ties even when sample observations are continuous; for example n=1 below has a degenerate fitted statistic. The formula is not an exact numerical evaluation of the population tail probability. It defines a finite Monte Carlo test with a discrete resolution; seeded software supplies reproducibility, not a mathematical proof of independent ideal randomness.

With B=199 and E=19, the value is 20/200=0.10. With E=0 it is 1/200=0.005, not zero. More replicates can reduce Monte Carlo variability and improve resolution, but cannot repair an incorrect observation model. Keep sample size, fitting rule, tail direction, replicate count, seed and exposure in the record; do not silently stop simulation when a desired significance result appears.

If you freeze λ̂(X) when evaluating Yᵇ, you instead compare Fₙ,Yᵇ with a specified CDF. Under the scaling above that reference statistic becomes sup |Fₙ,Zᵇ−F₁|, not Dfit(Zᵇ). Its distribution is different. The fitting performed on the observed sample is missing from the reference pipeline.

An exact small counterexample makes this visible. For n=1 and x>0, λ̂=1/x and the fitted CDF at x is 1−exp(−1). Thus Dfit=max(exp(−1),1−exp(−1))=1−exp(−1), always. Every correctly refitted reference ties it, so the conservative Monte Carlo value is 1. Under the frozen reference, U=F₁(Z) is uniform and the statistic is max(U,1−U), which varies. Its tail at 1−exp(−1) is 2exp(−1), not 1. No assumption about asymptotic sample size repairs this pipeline mismatch.

What is special, and what is not proved

For a general fitted family, parametric bootstrap generation at θ̂ followed by refitting may approximate the fitted statistic’s law. Its validity needs an appropriate consistency and regularity theorem for the estimator, model and statistic; boundaries, nonidentifiability and nonsmooth features can defeat it. Refitting is necessary to reproduce the procedure, but is not a universal exactness theorem. Here the algebraic scale pivot is the additional exact argument.

If times are rounded, simulate the declared measurement process and refit using its appropriate likelihood before claiming a calibration result. The continuous-data pivot cannot simply be transferred to arbitrary rounding: a fixed rounding width does not scale with the data. Neither rounding tied observations apart nor ignoring them justifies the original reference law. A failure to reject also does not prove that independent exponential waiting times generated the observations.

Apply

Use the changed sample (1,2,3). Derive its fitted rate and both gap lists. Then rescale it by 3 and explain what must remain unchanged. For a hypothetical run with B=99 and E=4, report the Monte Carlo value and its interpretation. Finally decide what you would report for the observed record (0,0,0).

Check the changed calculations and limits

The fitted rate is 1/2. The CDF values are approximately 0.3934693403, 0.6321205588, 0.7768698399. D⁺ is the maximum of −0.0601360070, 0.0345461078, 0.2231301601; D⁻ is the maximum of 0.3934693403, 0.2987872255, 0.1102031732. Thus Dfit≈0.3934693403. Negative individual gaps are allowed; the two-sided maximum is the statistic. The rescaled sample (3,6,9) has rate 1/6 and unchanged probabilities. The hypothetical Monte Carlo value is 5/100=0.05, a public calculation under the declared simulation contract, not a newly observed result or a proof of the model. The all-zero record has no finite MLE; report the failure and inspect the measurement mechanism rather than simulate a fabricated finite rate.

Continue

Write a reproducible diagnostic record separating observed data, fitted parameters, discrepancy, reference procedure and conclusion. Explain why “simulate under the fitted rate” is incomplete without “refit every replicate,” and why the exact scale argument here is stronger than generic bootstrap reassurance. Return to statistical models when the observation mechanism is unclear, and to resampling limitations before transferring this recipe to another family. Distributional shape evidence, parameter uncertainty and held-out predictive performance are distinct questions.

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 iid exponential observations x₁,…,xₙ with rate λ>0, derive the MLE and prove its global optimality when n≥1 and S=Σxᵢ>0. Treat S=0, an empty record, negative observations and a change of time units explicitly. Does scale invariance imply unbiased rate estimation?

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 Dfit be the ECDF supremum discrepancy from the exponential CDF with rate fitted on that same record. Prove its null law is independent of the true rate, including why reference statistics generated at the observed fitted rate and then refitted are independent of the observed statistic under ideal independent simulation. State where a generic parametric bootstrap would require more theory.

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.

Use the synthetic sample (1,2,5), without ties. Compute its fitted rate and both ECDF jump-gap lists, identifying the maximizing side/rank. Repeat by reasoning for (4,8,20). If one reference record is (1,1,2), compare its refitted discrepancy with its discrepancy evaluated at the original fitted rate. Treat the reference ties as a declared worked calculation, not evidence of an exact continuous random draw.

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 n=1 and any observed x>0, derive the exact fitted discrepancy. Contrast correctly refitted reference records with a frozen-rate reference. Prove the frozen reference tail at the observed statistic is 2/e. Does the fact that each observation has a continuous distribution imply the fitted statistic has no ties?

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.

Before simulation, fix n, a two-sided Dfit statistic, B=499 independent unit-rate exponential reference records with refitting, and an upper-tail >= rule. Suppose E=11 reference statistics exceed or tie the observed statistic. Report the rank-based value, its null justification, minimum possible value and limitations. What changes if a run is stopped as soon as its displayed value drops below .05?

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 clock rounds iid exponential times to the nearest integer, reporting zeros and repeated values. A colleague fits n/Σx and refits continuous exponential reference samples, calling the test exact by scale invariance. Audit this argument. Compare it with a separate continuous scale-family proposal X=θZ, θ>0, using an estimator θ̂ satisfying θ̂(cx)=cθ̂(x) and a statistic invariant under positive scaling. State sufficient conditions for the same exact pivot argument and what is not established merely by writing “parametric bootstrap.”

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.