Quantile Plot Explorer
A Q-Q (or P-P) plot of a sample against normal, exponential or uniform quantiles with a reference line: the learner switches samples and reference laws, draws fresh samples to see chance wiggle, drags points, and reads the plot correlation and Shapiro-Wilk W; a grid mode shows several shapes side by side with hidden answers.
Used in: Introduction to Statistics
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| title | string | "<Reference> Q-Q plot" | Card title. |
| truth | string | {family, params} | {truth, label, location, scale, tag} | "normal" | Law the sample is drawn from. A named shape (normal, right-skewed, left-skewed, heavy-tailed, light-tailed, bimodal, normal-mixture, exponential, uniform, t3, gamma-shape-3, lognormal, u-shaped, discrete, outlier) or any distribution spec the sampling core accepts ("Exp(rate=2)", "t3", {family: "gamma", params: {shape: 2}}). The object form adds a picker/panel label, an affine change x = location + scale * draw, and a tag (e.g. "NOT NORMAL") written inside its panel. |
| truths | (truth)[] | [truth] | Samples the learner can switch between (Sample dropdown), or the panels of the grid layout. Each entry has the same forms as `truth`. |
| data | number[] | null | Fixed data to plot (at least 2 values). Shown first as the sample "Data" (name it with dataLabel); `truths` may add drawn comparison samples. |
| dataLabel | string | "Data" | Name of the fixed data in the picker / panel title (plain text). |
| n | number | 30 | Size of each drawn sample (3-500). Ignored for fixed data. |
| seed | number | string | 7 | Seed of the random samples; New sample draws the next stream. |
| reference | string | "normal" | Reference law whose quantiles go on the x-axis: normal (Phi^{-1}(p)), exponential (-ln(1-p)) or uniform (p), each standardized. |
| references | string[] | ["normal","exponential","uniform"] | References the learner may switch between (toggle shown when 2 or more). ["normal"] hides the toggle. |
| plot | string | "qq" | qq: ordered data x_(i) against reference quantiles; pp: fitted cdf at x_(i) against p_i (reference line y = x). |
| line | string | "quartile" | Reference line on a Q-Q plot: quartile (R's qqline, through the data and reference quartiles), fit (least squares), origin (least squares through 0, e.g. exponential), identity (y = x) or none. origin falls back to fit when the reference is not exponential. |
| plottingPosition | string | "(i-0.5)/n" | Plotting positions p_i: (i-0.5)/n, i/(n+1), (i-0.375)/(n+0.25) (Blom) or ppoints (R's qqnorm: a = 3/8 for n <= 10, else 1/2). |
| layout | string | "single" | single: one sample with picker, readouts and table; grid: every truth as a small panel side by side (the learner can switch with the One/All toggle). |
| columns | number | 3 | Grid columns from wide screens (2 or 3); 1 on phones. |
| hideLabels | boolean | false | Grid: hide each panel's label and tag behind a Reveal button so learners judge the shapes first. |
| parameters | {name, min, max, initial, step?}[] | [] | Location / scale sliders (names mu|location and sigma|scale) applied to the drawn sample, x = mu + sigma * draw; the true line mu + sigma q is drawn dashed and the axes stay fixed. |
| showBand | boolean | false | Start with the pointwise 95% band (from the Beta(i, n-i+1) law of the i-th order statistic, scaled by the reference line) switched on. |
| showTable | boolean | false | Start with the table of i, x_(i), p_i and the reference quantile shown (n <= 100). |
| showCorrelation | boolean | true | Show the plot correlation r of the points (q_i, x_(i)). |
| showW | boolean | false | Show the Shapiro-Wilk W and its p-value (Royston's approximation, as R and scipy). |
| logToggle | boolean | false | Offer a Take logs switch (positive data only) to plot ln x. |
| log | boolean | false | Start with logs taken (ln x; positive data only). Shows the Take logs switch. |
| editable | boolean | false | Single Q-Q plot with n <= 40: each point can be dragged up or down to change that observation (make an outlier, bend a tail). |
| showNSlider | boolean | true | Show the sample-size slider for drawn samples. |
| xLabel | string | "Theoretical quantiles" | x-axis title ($...$ TeX allowed). |
| yLabel | string | "Sample quantiles" | y-axis title ($...$ TeX allowed). |
| controls | string[] | all controls shown | Registry ids of the hideable readouts, toggles and legend words to show (see `controls` in this file); core ones always show. Absent = everything. Fitted per page by component_scopes.py, not by hand; e.g. the plot correlation r stays hidden before correlation is taught, and a fit line is called "fitted line" before least squares. |
PreviousNext