/-- Check the outlier example: the median stays at `5`, the mean moves from `38/7` to `110/7`.
Hint: everything here is a finite computation — `decide +kernel` can do it. Then try your own
data: what happens to the median and the mean if the outlier is `800`? -/
theorem outlier_example :
medianSorted [3, 4, 5, 5, 6, 7, 8] = 5 ∧ mean [3, 4, 5, 5, 6, 7, 8] = 38 / 7 ∧
medianSorted [3, 4, 5, 5, 6, 7, 80] = 5 ∧ mean [3, 4, 5, 5, 6, 7, 80] = 110 / 7 := by
sorryShow the compiled solution
/-- A worked example, computed by Lean. Minutes to walk to school for seven students: the
median is `5` and the mean is `38/7 ≈ 5.4`. Replace the largest value `8` by an outlier `80`:
the median is still `5`, but the mean jumps to `110/7 ≈ 15.7`. -/
theorem outlier_example :
medianSorted [3, 4, 5, 5, 6, 7, 8] = 5 ∧ mean [3, 4, 5, 5, 6, 7, 8] = 38 / 7 ∧
medianSorted [3, 4, 5, 5, 6, 7, 80] = 5 ∧ mean [3, 4, 5, 5, 6, 7, 80] = 110 / 7 := by
decide +kernelAxioms used: propext, Classical.choice, Quot.soundformal/Lumenary/StatisticsIntro.leanTry it in the Lean web editor