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

PropTypeDefaultDescription
pointsnumber[][3, 5, 6, 7, 9]The sample, one draggable dot per value (up to 60). Ignored when `datasets` is given.
datasetsnumber[][](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.
labelsstring[]A, B, C, ...Row names for `datasets` (or a name for the single sample); $...$ TeX allowed.
viewstringdotsStarting view: 'dots' (number line with location markers) or 'boxplot' (adds the boxplot, 1.5 IQR fences and flagged points). The learner can switch.
statisticsstring[]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.
dragIndexnumber(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).
dragTonumber(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`.
editablebooleantrueWhether the dots can be dragged.
addRemovebooleantrueShow 'Add point' and 'Remove selected' buttons (only when editable).
showSquaresbooleanfalseStart with each squared deviation from the mean drawn as a square (single sample; learner can toggle).
showTablebooleanfalseStart with the per-observation table x_i, x_i - mean, (x_i - mean)^2 and their sums shown (single sample; learner can toggle).
showFencesbooleantrue in boxplot view or when fences/outliers are listedDraw the k IQR fences as dashed lines and colour flagged observations.
shiftHandlebooleanfalseEquivariance 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).
scaleHandlebooleanfalseEquivariance mode: add a 'scale a' slider (0.25 to 3); with shiftHandle the transform is a x + c.
shiftnumber0Starting value of the shift c.
scalenumber1Starting value of the scale a (> 0).
quartileMethodstringhalvesQuartile 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.
fenceKnumber1.5Fence multiplier k: fences at Q1 - k IQR and Q3 + k IQR (3 for 'far' outliers).
range[number, number]data extent padded by 25%, roundedVisible number-line window, also the drag limits. Give room to drag a point far out, e.g. [0, 50].
stepnumber1 for integer data, else 0.1 or 0.01Drag snap step and arrow-key step.
xLabelstring$x$Axis title ($...$ TeX allowed); '' for none.
digitsnumber3Decimals in the readouts (0 to 6).
titlestringper modeTitle bar text.
controlsstring[]all controls shownIds 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.