apopt.comCBE 493R Data-Driven Athletics

Course / Tutorials / Week 10 / Q-29

Quick tutorial Q-29 · Week 10 · about 15 min · Foundation

Median and spread of ten trials

Read ten results files into one table and describe each metric with a median and a robust spread, and see what one low shot does to the mean.

  1. 1Gather (used)
  2. 2Statistics (used)
  3. 3Visualize (used)
  4. 4Cleanse
  5. 5Features
  6. 6Balance
  7. 7Scale
  8. 8Split
  9. 9Deploy
  1. Ask
  2. Collect (this week)
  3. Check (this week)
  4. Interpret
  5. Coach
  6. Reassess

Every cell runs in this page; the first run downloads Python (about 30 s). Nothing you load leaves your browser. Helpful first: Q-28 Height from flight time, with one frame of error.

The decision

A shooter wants one number for "my release angle" to train against. From ten shots, which summary should it be, and how much spread is normal for this shooter?

The raw data

Try it

One shot is an anecdote; ten shots are a sample (Section 10.6). The raw files are ten results files in the layout the basketball app writes, one per shot, and the made-or-missed log the shooter kept by hand. They are synthetic: Chapter 10 made them with a fixed random seed so that everyone gets the same numbers. They are not measurements of anyone.

PythonRead ten results files into one table

Type a prediction to enable Run.

Show the expected result without running
                   Ball Release Angle  Ball Release Height  Elbow Angle  Knee Flexion  Release Timing vs Apex  made
file                                                                                                               
results_shot01.md                46.3                 1.07        159.0          97.0                   -23.0     1
results_shot02.md                48.8                 1.10        160.0         105.0                   -25.0     1
results_shot03.md                43.0                 1.03        158.0         102.0                   -17.0     0
results_shot04.md                46.2                 1.09        157.0          92.0                   -15.0     1
results_shot05.md                46.5                 1.06        161.0          97.0                   -22.0     1
results_shot06.md                40.8                 1.04        162.0         109.0                     3.0     0
results_shot07.md                48.0                 1.04        157.0         102.0                   -19.0     1
results_shot08.md                47.6                 1.05        160.0         105.0                    -8.0     0
results_shot09.md                47.2                 1.07        160.0         105.0                   -26.0     1
results_shot10.md                46.8                 1.05        160.0          97.0                    -7.0     0

Center and spread, two ways

The mean and standard deviation use every value's size, so one wild value moves them. The median and the interquartile range (IQR, the middle half) or the median absolute deviation (MAD, the median distance from the median) do not. The disc app scales the MAD by 1.4826 (disc/src/lib/metric-registry.ts), which turns it into a robust standard deviation: for normal scatter the raw MAD is only about two thirds of one.

PythonMean and SD against median, IQR and MAD

Show the expected result without running
                          mean    SD  median    IQR   MAD  1.4826 MAD
Ball Release Angle       46.12  2.42   46.65   1.27  0.75        1.11
Ball Release Height       1.06  0.02    1.06   0.03  0.02        0.02
Elbow Angle             159.40  1.65  160.00   1.75  1.00        1.48
Knee Flexion            101.10  5.20  102.00   8.00  4.00        5.93
Release Timing vs Apex  -15.90  9.33  -18.00  13.00  6.00        8.90
release angle without its lowest shot: mean 46.71, median 46.80
PythonTen release angles, with their median and middle half

Show the expected result without runningThe ten release angles as dots along one axis, filled for made shots and open for missed ones, with a solid line at the median, a shaded band for the interquartile range and a dashed line at the mean.

Eight of the ten release angles sit between 46.2° and 48.8°; two missed shots, 40.8° and 43.0°, sit well below. Those two pull the mean (46.12°) below the median (46.65°) and more than double the standard deviation (2.42°) compared with the robust spread (1.4826 × MAD = 1.11°). Drop the lowest shot and the mean jumps by 0.59° while the median moves by 0.15°. That is why the apps build a personal baseline from medians and MADs: one bad shot, or one frame where the ball was lost, should not move the target. The low shots are not errors to delete, though; both were misses, and CS-14 asks whether release angle separates makes from misses.

For the athlete: your release angle is about 46.7°, give or take about 1°; judge the next session's ten shots against that, not against your best shot.

With your own data

Save the text results of ten of your own clips from one app, in one folder, keep a made-or-missed log, and run the first cell on that folder.

Check yourself

  1. Ten values; one is far below the rest. Which summary moves least if you drop it?

  2. A MAD of 0.75° is scaled by 1.4826. What robust standard deviation does that give?

    degrees

0 of 2 answered · 0 right the first time

The same method in another field

Robust summaries are the standard for any repeated measurement with occasional bad readings: ten readings of a gauge, a sensor with dropouts, lab replicates.

Acknowledgements

Synthetic results files from Chapter 10 of Data-Driven Athletics.

References

Built 2026-11-30 with Python packages numpy 2.5.5, pandas 3.1.1, matplotlib 3.11.2. In the browser the same code runs on Pyodide, so the last digit can differ.