A stable population, an unstable summary?
Drag the orange handle horizontally, or use the contaminant velocity slider. Horizontal bars show dispersion, not confidence intervals.
Drag a contaminating velocity through a stable stellar sample. Which summaries move with it?
Drag the orange handle horizontally, or use the contaminant velocity slider. Horizontal bars show dispersion, not confidence intervals.
A finite-sample contamination-response curve, not the asymptotic influence function. The dashed marker is the current velocity.
The clean population is Normal(0,1) in illustrative velocity units. The first chosen number of observations are replaced, not supplemented, by values at the contaminant velocity plus fixed Normal(0,0.12) offsets. Moving them preserves the remaining observations and every offset.
The median is the central order statistic, or the average of the two central values for even n. Sample SD uses the n−1 denominator. nMAD = median(|x − median(x)|) / Φ−1(0.75), with Φ−1(0.75) ≈ 0.67448975. This scaling is Gaussian-consistent, not a claim that nMAD equals the SD of every distribution or is unbiased in small samples.
The bars show mean ± one sample SD and median ± one nMAD. They describe location and dispersion, not confidence intervals, standard errors or uncertainty on the mean/median.
The HTML port adds a trimmed-mean control and a response plot to the original R lesson. For trim fraction t, it sorts the observations, removes floor(nt) values from each end, and averages the rest, matching R's mean(x, trim=t). A 10% trim is per tail, not 10% total. The blue marker is a location only; it has no implied error bar.
The lower curves move the same replacement cluster over the full velocity range while fixing the clean values and offsets. For c replacements, the sample mean has slope c/n. Median and trimmed-mean response can flatten for an isolated extreme, but enough contamination still moves them. These curves are finite-sample diagnostics, not formal influence functions or robustness guarantees.
Mean and median answer different questions for an asymmetric population. A contaminant-resistant estimate may describe a central population well, but discarding a genuine secondary population can remove scientifically important information. This example does not identify which real observations are “bad”.
The browser caches 120 clean values, ten replacement offsets and vertical jitter for each seed. Increasing n reveals a longer prefix; seed changes and New realisation generate a new cache. The browser RNG is not R's RNG, so individual draws differ for the same seed.