Distribution Approximation Overlay

The learner overlays an exact law (binomial, Poisson, hypergeometric, t, Cauchy, ...) with its approximating law, moves the parameters (optionally holding np or K/N fixed) and drags an event's endpoints. They see the exact and approximate probabilities with and without the continuity correction, their errors, the largest cdf gap, total variation, an optional Berry-Esseen / Stein-Chen bound, critical values and log-scale tails.

Used in: Introduction to Probability Theory

Props

PropTypeDefaultDescription
titlestring"<Exact> vs <Approx> approximation"Title bar text.
exactobject | string{"family": "binomial", "params": {"n": 40, "p": 0.3}}The exact law, any distribution spec: {family, params} (binomial n/p, poisson lambda, hypergeometric N/K/n, student-t df, cauchy location/scale, normal mean/sd, ...) or a string such as "Binomial(40, 0.3)".
approxobject | string"normal" (moment-matched)The approximating law. A bare family name is tied automatically: normal matches the exact mean and sd, poisson uses lambda = mean, binomial of a hypergeometric uses n and p = K/N. Or give {family, tie: "mean = n*p, var = n*p*(1-p)"} (symbols: exact params, mean, var, sd) or fixed params.
slidersstring | (string | {name, min?, max?, step?, initial?, label?})[] | booleanall exact paramsExact-law parameters the learner can move (e.g. "n", ["n", "p"], [{"name": "N", "min": 20, "max": 2000}]). false hides the sliders. Wide positive ranges use a log slider.
holdFixedstringnoneKeep a parameter combination fixed while a slider moves, e.g. "n*p = 3" (p follows n) or "K/N" (K follows N, at its initial ratio).
viewstring"pmf"Initial view: 'pmf' (mass/density overlay), 'cdf' (distribution functions plus the error F - G), 'tails' (P(X > x) on a log scale).
viewsstring[]["pmf", "cdf", "tails"]Views offered in the view switch (one entry hides the switch).
eventstringnone ("X <= 10" in the bare render)Event whose probability is compared: "X <= c", "X < c", "X >= c", "X > c", "X = k", "a <= X <= b", "|X| > c", "|X| <= c" (a symbol such as c picks a default). Endpoints are draggable.
eventEditablebooleantrueShow the event-type picker.
continuityCorrectionbooleantrueInitial state of the continuity-correction toggle (shown when a lattice exact law is approximated by a continuous law). Both corrected and uncorrected values are always listed.
showErrorsbooleantrueShow the error column |approx - exact|.
showDistancebooleantrueShow sup |F - G| (and the corrected lattice error, and total variation when meaningful).
boundstringnoneTheoretical bound to compare: 'berry-esseen' (binomial or Poisson exact, C = 0.4748, vs sup |F - G|), 'stein-chen' or 'le-cam' (binomial exact vs Poisson, vs total variation), or an expression in the exact params (C available).
boundMetricstring"kolmogorov"Distance an expression bound is compared with: 'kolmogorov' (sup |F - G|) or 'tv'.
criticalAlphanumbernoneUpper-tail area alpha in (0, 0.5): marks both laws' upper critical values, the exact tail beyond the approximate one and, for symmetric laws, the exact coverage of +/- the approximate critical value.
showMomentsbooleanfalseShow mean, sd, variance ratio (finite population correction for hypergeometric) and skewness.
showRuleOfThumbbooleantrueShow the rule-of-thumb line (np and n(1-p) >= 5, lambda >= 10, sampling fraction n/N) when it applies.
xRange[number, number]autoOverride the plot's x window.
exactLabelstring"Exact"Legend / table name of the exact law.
approxLabelstring"Approx."Legend / table name of the approximation.
controlsstring[]all controls shownIds of the hideable controls to show (see the controls registry): the CDF and Tails views (view.cdf, view.tails), the continuity-correction toggle with its corrected rows and shading (toggle.continuity-correction), and the sup |F - G| and total-variation rows (readout.kolmogorov, readout.total-variation). The view the props open on always stays. Core controls always show; absent = everything. Fitted per page by component_scopes.py, not by hand.