Draggable Sample Summary
A small sample as draggable dots on a number line with live readouts (mean, median, sd, IQR, trimmed mean, ...) and an optional linked boxplot with fences and flagged outliers. The learner drags one point far and sees the mean and sd move while the median and IQR stay; shift and scale sliders test whether a statistic is equivariant.
Used in: Introduction to Statistics
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| points | number[] | [3, 5, 6, 7, 9] | The sample, one draggable dot per value (up to 60). Ignored when `datasets` is given. |
| datasets | number[][] | (none) | Several samples (up to 6) drawn as labelled rows on one common axis, each draggable; use with view 'boxplot' for side-by-side boxplots. |
| labels | string[] | A, B, C, ... | Row names for `datasets` (or a name for the single sample); $...$ TeX allowed. |
| view | string | dots | Starting view: 'dots' (number line with location markers) or 'boxplot' (adds the boxplot, 1.5 IQR fences and flagged points). The learner can switch. |
| statistics | string[] | dots: [mean, median, sd, iqr]; boxplot: [five-number, iqr, fences, outliers] | Readout rows, in order. Names: n, mean, median, midrange, trimmed-mean-P (P% from each end, e.g. trimmed-mean-20; plain trimmed-mean = 10%), min, max, q1, q3, range, iqr, variance, sd (alias standard-deviation), ss (sum of squared deviations), sum, mad, mean-abs-dev, lower-fence, upper-fence, outliers, mean-of-others and sd-bound (both use the selected point). Groups: five-number, quartiles, fences. Formulas in these names are allowed, e.g. 'mean/2' or 'max - 1'. Location statistics (mean, median, midrange, trimmed means) are also drawn as markers. |
| dragIndex | number | (none) | 0-based index (in `points`, or in the first dataset) of the observation that starts selected (ringed); it is the k of mean-of-others and sd-bound (default: the largest value). |
| dragTo | number | (none) | Start with the selected observation (dragIndex, else the largest) already moved to this value; the readout then shows start, now and change. Reset restores `points`. |
| editable | boolean | true | Whether the dots can be dragged. |
| addRemove | boolean | true | Show 'Add point' and 'Remove selected' buttons (only when editable). |
| showSquares | boolean | false | Start with each squared deviation from the mean drawn as a square (single sample; learner can toggle). |
| showTable | boolean | false | Start with the per-observation table x_i, x_i - mean, (x_i - mean)^2 and their sums shown (single sample; learner can toggle). |
| showFences | boolean | true in boxplot view or when fences/outliers are listed | Draw the k IQR fences as dashed lines and colour flagged observations. |
| shiftHandle | boolean | false | Equivariance mode: add a 'shift c' slider and a second row showing x + c, with a table comparing delta(x + c) with delta(x) + c for every statistic (single sample). |
| scaleHandle | boolean | false | Equivariance mode: add a 'scale a' slider (0.25 to 3); with shiftHandle the transform is a x + c. |
| shift | number | 0 | Starting value of the shift c. |
| scale | number | 1 | Starting value of the scale a (> 0). |
| quartileMethod | string | halves | Quartile convention for Q1, Q3, IQR, fences and the boxplot: 'halves' (medians of the lower and upper halves, excluding the median when n is odd; the textbook rule), 'tukey' (hinges), or a quantile type: linear, weibull, hazen, median-unbiased, inverted-cdf, nearest-rank, midpoint. |
| fenceK | number | 1.5 | Fence multiplier k: fences at Q1 - k IQR and Q3 + k IQR (3 for 'far' outliers). |
| range | [number, number] | data extent padded by 25%, rounded | Visible number-line window, also the drag limits. Give room to drag a point far out, e.g. [0, 50]. |
| step | number | 1 for integer data, else 0.1 or 0.01 | Drag snap step and arrow-key step. |
| xLabel | string | $x$ | Axis title ($...$ TeX allowed); '' for none. |
| digits | number | 3 | Decimals in the readouts (0 to 6). |
| title | string | per mode | Title bar text. |
| controls | string[] | all controls shown | Ids of the optional controls to show (see the controls registry); core controls always show. Omit to show everything. Fitted per page by component_scopes.py, not by hand. Explicit showFences / showSquares / showTable props still win. |
PreviousNext