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
| Prop | Type | Default | Description |
|---|---|---|---|
| title | string | "Sampling distribution builder" | Title bar text. |
| population | string | {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`. |
| population2 | string | {family, params} | same as population | Second 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. |
| statistic | string | "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. |
| statistics | string[] | [] | 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. |
| statisticOptions | string[] | [] | Statistics the learner can switch between with a dropdown (e.g. different transforms g in the delta method). |
| n | number | [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"}}). |
| gamma | number | 0.5 | Norming exponent for statistic normalized-sum, (S_n - n mu)/n^gamma; a gamma slider (0.25 to 1) is added automatically. |
| k | number | ceil(n/2) | Index of the order statistic (statistic order-statistic; a k slider is added) or the upper index for quantile-interval-covers. |
| j | number | 1 | Lower index for quantile-interval-covers, [X_(j), X_(k)]. |
| quantileLevel | number | 0.5 | Population quantile level p for quantile-interval-covers. |
| level | number | 0.95 | Confidence level for t-interval-covers and z-interval-covers. |
| mu0 | number | population mean | Null mean in the t statistic (studentized-mean, t-squared); a value other than the true mean gives a noncentral t. |
| p0 | number | population p | Null proportion in proportion-z. |
| groups | number | 3 | Number of groups for studentized-range (each of size n). |
| cells | number | 6 | Number of categories for pearson-gof statistics with a Poisson population (0, 1, ..., cells-2 and a final 'cells-1 or more'). |
| cellBoundaries | number[] | [] | Category boundaries for pearson-gof statistics with a normal (or any continuous) population. |
| count | string | {family, params} | {family: "poisson", params: {lambda: 3}} | Law of the random number of terms N for statistic random-sum. |
| correlation | number | 0 | Correlation rho between paired observations for two-sample statistics with two normal populations (paired design; one n). |
| populationSize | number | none (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. |
| withoutReplacement | boolean | true | Initial state of the without-replacement toggle when populationSize is set. |
| overlay | string | {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. |
| scaling | string | "raw" | Display T (raw), T - theta (centered), sqrt(n)(T - theta) (root-n) or n(T - theta) (n), with theta the statistic's estimand. |
| view | string | "histogram" | Initial view: histogram, cdf (empirical cdf against the reference cdf with the maximum gap marked), or scatter (needs two statistics). |
| compareLayout | string | "overlay" | With several statistics: overlay them on one axis, or give each its own panel (separate) when their scales differ. |
| replications | number | 1000 | Samples drawn on load (0 = start empty so the learner builds the distribution by hand). Total capped at 50,000. |
| seed | number | string | 1 | Seed of the random stream; the same seed reproduces the same samples. |
| showPopulation | boolean | true | Show the population panel with the latest sample, its statistic and the parameter. |
| showError | boolean | false | In the population panel, draw the sampling error between the latest statistic and the parameter. |
| interval | [a, b] | boolean | none | Shade 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. |
| seBands | number[] | [] | 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). |
| readouts | string[] | chosen from the mode | Rows to show: latest, mean, sd, theory, bias, mse, skewness, quantiles, coverage, cdf-gap, within-bands, interval, correlation, parameter. |
| target | number | the statistic's estimand | Value used for bias and MSE (on the displayed scale). |
| bins | number | automatic | Number of histogram bins (lattice-valued statistics such as proportions are binned on their lattice automatically). |
| controls | string[] | all controls shown | Ids 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. |