Distribution Explorer
The learner moves parameter sliders and drags interval ends, quantiles, observed statistics or thresholds on a pmf or pdf. They see probability as shaded area or highlighted bars, linked to the cdf, survival or hazard panels, with live moment readouts, tail-bound comparisons, p-values and rejection regions.
Used in: Introduction to Probability Theory, Introduction to Statistics
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| title | string | "<Family> distribution" | Title bar text. |
| family | string | "normal" | Named family (canonical name; aliases such as 't', 'chi2', 'exp' are also accepted). Ignored when atoms, pdf, pieces or components are given. |
| params | object | family defaults | Family parameters, e.g. {"n": 20, "p": 0.3}. Canonical names: normal mean/sd, uniform a/b, exponential rate, gamma shape/rate, beta alpha/beta, chi-squared df, student-t df, f df1/df2, lognormal mu/sigma (log scale), weibull shape/scale, pareto alpha/xm, bernoulli p, binomial n/p, geometric p (+start 0 or 1), negative-binomial r/p, poisson lambda, hypergeometric N/K/n, discrete-uniform a/b. Common aliases (mu, sigma, lambda, nu) are accepted. |
| components | {family, params, weight}[] | none | Finite mixture of named families with mixing weights (normalised). |
| atoms | {x, p, label?}[] | none | Point masses. Alone they define a discrete law; with pdf or pieces they are the atoms of a mixed-type law. label replaces the tick text (non-numeric outcomes). |
| string | none | Custom density in x, e.g. "2*x" or "y = 0.006*exp(-0.01*x)" (+ - * / ^, exp, log, sqrt, abs, pi, e). Needs support. | |
| pieces | {expr, from, to}[] | none | Piecewise custom density: expr in x on [from, to). |
| support | [number, number] | none | Interval on which a custom pdf lives (finite). |
| normalization | string | "auto" | Custom atoms/pdf: 'auto' rescales silently to total 1; 'check' shows the raw values with a validity verdict (sum or integral = 1, all >= 0); 'solve' treats them as g and shows T and c = 1/T with a button to apply c. |
| editable | boolean | false | Atoms can be dragged up and down to change their weights (with a Normalize button). |
| sliders | boolean | {name, min, max, step?}[] | true | Family parameter sliders. false hides them; a list shows only those parameters (canonical names) with the given ranges. |
| presets | (string | {label?, family?, params?})[] | none | Buttons that set the family and/or parameters, e.g. [{"label": "α = β = 0.5", "params": {"alpha": 0.5, "beta": 0.5}}] or ["exponential", "uniform"]. |
| sampleMean | number | none | Show the exact law of the mean of n iid draws (normal, bernoulli, binomial, poisson, exponential, gamma, chi-squared) with an n slider; the initial n. |
| affine | {a, b} | none | Show Y = aX + b with sliders for a and b; the original law is dashed. |
| truncate | [number | null, number | null] | none | Show the law of X given a <= X <= b (draggable ends; null = open end). |
| censor | number | none | Show X = min(Y, c): right-censoring at a draggable c, which turns the upper tail into a point mass. |
| age | number | none | Residual life: show the law of X - t given X > t, with an age slider and the original law dashed (memorylessness). |
| interval | boolean | [number | null, number | null] | shown when no other question is set | Shaded interval with draggable ends; its probability is read out (null = infinite end, so [null, x] gives F(x)). true = a default interval, false = none. |
| symmetric | boolean | false | Interval kept symmetric about the mean, one handle sets the half-width. |
| intervalPresets | number[] | [] | Buttons that set the interval to mean ± k sd for each k (empirical rule: [1, 2, 3]). |
| endpointToggles | boolean | false | Toggles to include or exclude each endpoint (matters only at point masses). |
| densityRatio | boolean | false | Interval [x0, x0 + h] with a width slider; reads out P, P/h and f(x0), so P -> 0 while P/h -> f(x0). |
| showComplement | boolean | false | Also shade and read out the complement 1 - P. |
| quantile | number | none | Quantile level in (0, 1) with a slider and a draggable x: the area to the left (or right, see quantileTail) is the level. |
| quantileTail | string | "lower" | 'lower': x_p with P(X <= x_p) = p. 'upper': critical value x with P(X > x) = level. |
| observed | number | none | Observed test statistic t (draggable); the p-value region for the chosen alternative is shaded. |
| alpha | number | none | Significance level (slider); shades the rejection region and reads out critical values (and the decision when observed is set). |
| alternative | string | "greater" | Initial alternative for observed / alpha: 'greater', 'less' or 'two-sided' (equal-tail doubling). The learner can switch it. |
| bound | string | none | Tail bound to compare with the true tail: 'markov' P(X >= a) <= E[X]/a, 'markov-moment' P(|X| >= a) <= E|X|^r/a^r, 'chebyshev' P(|X - μ| >= kσ) <= 1/k², 'cantelli' P(X - μ >= kσ) <= 1/(1 + k²). Adds a panel of both against the threshold. |
| compareBound | string | none | A second bound drawn dashed in the bound panel (same values as bound). |
| threshold | number | per bound | Initial threshold: a (markov forms, in x units) or k (chebyshev/cantelli, in standard deviations). |
| thresholdIn | string | "sd" | Chebyshev/Cantelli threshold units: 'sd' (k) or 'x' (a distance ε in x units, so the bound is σ²/ε², useful with sampleMean). |
| boundOrder | number | 2 | Moment order r for 'markov-moment' (slider 0.5 to 4). |
| showCdf | boolean | false | Linked cdf panel (jumps with closed and open dots at atoms) marking the interval, quantile or observed value. |
| showSurvival | boolean | false | Survival panel S(x) = P(X > x). |
| showHazard | boolean | false | Hazard panel h = f/S (discrete: p(k)/P(X >= k)) and a trend readout. |
| showTailSum | boolean | false | Shade the area under S(x) from 0 (or the bars P(X >= k)) and read it out next to E[X]. |
| logAxes | boolean | false | Survival panel on log-log axes (a Pareto tail becomes a line). |
| showMeanSd | boolean | false | Mean line, mean ± sd bar, and E[X], Var(X), σ readouts ('does not exist' / ∞ when they do not). |
| showMedian | boolean | false | Median line and readout. |
| showMode | boolean | false | Mode line and readout ('not unique' when flat). |
| showSkewness | boolean | false | Skewness readout. |
| showKurtosis | boolean | false | Excess kurtosis readout. |
| showFulcrum | boolean | false | Draggable pivot under the distribution with a tilting beam; it balances exactly at the mean (net moment E[X - c] = 0). |
| showVariance | boolean | false | Variance readout; for small discrete laws a table of (x - μ)² p(x). |
| showSecondMoment | boolean | false | E[X²] and E[X²] - (E[X])² readouts (and an x² p(x) column). |
| showZAxis | boolean | false | z = (x - μ)/σ labels along the top and z readouts. |
| showComponents | boolean | false | Mixtures: draw each weighted component density dashed. |
| compare | string | {family, params} | none | A second law drawn dashed (e.g. the standard normal against a t); quantiles, p-values and critical values are also read out under it. |
| xRange | [number, number] | auto | Fixed x window. |
| variable | string | "X" | TeX name of the random variable in labels, e.g. "T", "Z", "\\hat p". |
| controls | string[] | all controls shown | Ids of the hideable controls to show (see the controls registry); core ones always show. Absent = everything. Fitted per page by tooling, not by hand. |