Sampling Distribution Builder

The learner draws random samples from a population (one at a time or in batches), sees each sample and its statistic, and watches the sampling distribution of that statistic build up against an exact or approximating law; sliders for n and other parameters show how centre, spread and shape change, and several estimators can be compared side by side (bias, SD, MSE).

Used in: Introduction to Probability Theory, Introduction to Statistics

Props

PropTypeDefaultDescription
titlestring"Sampling distribution builder"Title bar text.
populationstring | {family, params}{family: "exponential", params: {mean: 1}}Population law, any form the sampling core parses ("N(50, 144)", "bernoulli p=0.3", {family: "poisson", params: {lambda: 2}}, {family: "bivariate-normal", params: {rho: 0.8}} for correlation statistics). Parameter values may be expressions in slider names from `parameters`.
population2string | {family, params}same as populationSecond population for two-sample statistics (difference-of-means, difference-of-proportions, variance-ratio, scaled-variance-ratio).
populationOptions(string | {family, params, label?})[][]Populations the learner can switch between with a dropdown (overrides population). An optional `label` names an option.
statisticstring"mean"Statistic computed from each sample (see enums). Common aliases (total, sample-sd, t, kth-order-statistic, variance-divisor-n, mle-rate, r) are accepted.
statisticsstring[][]Up to 4 statistics computed on the SAME samples and shown together: competing estimators (bias, SD, MSE table) or, with view "scatter", the joint behaviour of the first two. Overrides statistic.
statisticOptionsstring[][]Statistics the learner can switch between with a dropdown (e.g. different transforms g in the delta method).
nnumber | [n1, n2]10 (5 per group for studentized-range)Sample size; for two-sample statistics [n1, n2] gives each sample its own size and slider. For studentized-range it is the size of each group.
nRange[min, max] | false[minimum, max(50, 4n)]Range of the sample-size slider; false hides the slider (n stays fixed).
parameters{name, min, max, step?, initial, label?}[][]Extra sliders. Names n, gamma, k, j, rho, level, mu0, p0 and quantileLevel drive those props; any other name is a symbol that population, population2, count and overlay parameter expressions can use (e.g. {family: "poisson", params: {lambda: "lambda"}}).
gammanumber0.5Norming exponent for statistic normalized-sum, (S_n - n mu)/n^gamma; a gamma slider (0.25 to 1) is added automatically.
knumberceil(n/2)Index of the order statistic (statistic order-statistic; a k slider is added) or the upper index for quantile-interval-covers.
jnumber1Lower index for quantile-interval-covers, [X_(j), X_(k)].
quantileLevelnumber0.5Population quantile level p for quantile-interval-covers.
levelnumber0.95Confidence level for t-interval-covers and z-interval-covers.
mu0numberpopulation meanNull mean in the t statistic (studentized-mean, t-squared); a value other than the true mean gives a noncentral t.
p0numberpopulation pNull proportion in proportion-z.
groupsnumber3Number of groups for studentized-range (each of size n).
cellsnumber6Number of categories for pearson-gof statistics with a Poisson population (0, 1, ..., cells-2 and a final 'cells-1 or more').
cellBoundariesnumber[][]Category boundaries for pearson-gof statistics with a normal (or any continuous) population.
countstring | {family, params}{family: "poisson", params: {lambda: 3}}Law of the random number of terms N for statistic random-sum.
correlationnumber0Correlation rho between paired observations for two-sample statistics with two normal populations (paired design; one n).
populationSizenumbernone (infinite population)Make the population a finite list of N units (drawn once from population, rescaled to its mean and sd); samples are then drawn without replacement and a toggle switches to with replacement.
withoutReplacementbooleantrueInitial state of the without-replacement toggle when populationSize is set.
overlaystring | {family, params, scale?, shift?, label?} | array"auto"Reference law(s) over the simulated statistic: "auto" (exact if known, else large-sample), "exact", "approx" (large-sample law, e.g. chi-squared for goodness of fit), "normal" (normal with the statistic's theoretical mean and SE), "none", or an explicit distribution whose params may use n, n1, n2, k and slider names (e.g. {family: "chi-squared", params: {df: "n - 1"}}). Up to 3; explicit laws are on the displayed scale.
scalingstring"raw"Display T (raw), T - theta (centered), sqrt(n)(T - theta) (root-n) or n(T - theta) (n), with theta the statistic's estimand.
viewstring"histogram"Initial view: histogram, cdf (empirical cdf against the reference cdf with the maximum gap marked), or scatter (needs two statistics).
compareLayoutstring"overlay"With several statistics: overlay them on one axis, or give each its own panel (separate) when their scales differ.
replicationsnumber1000Samples drawn on load (0 = start empty so the learner builds the distribution by hand). Total capped at 50,000.
seednumber | string1Seed of the random stream; the same seed reproduces the same samples.
showPopulationbooleantrueShow the population panel with the latest sample, its statistic and the parameter.
showErrorbooleanfalseIn the population panel, draw the sampling error between the latest statistic and the parameter.
interval[a, b] | booleannoneShade an interval with draggable ends and compare the simulated P(a <= T <= b) with the reference law; true starts at the theoretical mean +/- 1 SE.
seBandsnumber[][]Shade the theoretical mean +/- k standard errors for each k and report the share of samples inside, e.g. [1, 2].
markers{x, label?}[][]Fixed reference lines on the sampling axis (critical values, a tabulated quantile).
readoutsstring[]chosen from the modeRows to show: latest, mean, sd, theory, bias, mse, skewness, quantiles, coverage, cdf-gap, within-bands, interval, correlation, parameter.
targetnumberthe statistic's estimandValue used for bias and MSE (on the displayed scale).
binsnumberautomaticNumber of histogram bins (lattice-valued statistics such as proportions are binned on their lattice automatically).
controlsstring[]all controls shownIds of the hideable controls and text blocks to show (see the controls registry, e.g. law.overlay, view.cdf, readout.sd, readout.theory, panel.se-bands). Core controls always show. Page building fills this from the subject's topic scope.