Course / Tutorials / Week 5 / Q-15
Quick tutorial Q-15 · Week 5 · about 20 min · Core
One night's RMSSD
Apply an artifact rule to a night of chest-strap beat intervals, compute RMSSD in five-minute windows, and report the night as the median of its valid windows.
- 1Gather (used)
- 2Statistics (used)
- 3Visualize (used)
- 4Cleanse (used)
- 5Features (used)
- 6Balance
- 7Scale
- 8Split
- 9Deploy
- Ask
- Collect (this week)
- Check (this week)
- Interpret (this week)
- Coach
- Reassess
Download notebook ·Python file ·Read as Markdown ·Data folder ·Chapter 5 (sections 5.4, 5.5)
Every cell runs in this page; the first run downloads Python (about 30 s). Nothing you load leaves your browser. Helpful first: Q-14 Heart rate from beat intervals.
The decision
One night of sleep, one number for heart rate variability. Which number, computed how, so that it can be compared with the next night?
The raw data
raw/2026-06-28_2343_sleep_rr.csv: one night of the instructor's sleep, one row per beat (t_s seconds from the start, rr_ms the strap's beat interval, hr_bpm the strap's heart rate where reported). The instructor's own Polar H10 recording, night of 28 June 2026, from the course case fileathletes/jh/heart/, published under his name.
Try it
RMSSD, the root mean square of successive differences between beats, is the working measure of heart rate variability (Section 5.5): it follows the fast, vagal part of the beat-to-beat variation. Here you compute it for one whole night of the instructor's sleep, from the beat intervals his chest strap recorded, one row per beat.
Open the night
Type a prediction to enable Run.
Show the expected result without running
17082 beats over 6.01 h RR from 293 to 2383 ms, median 1279 ms outside 300-2000 ms (treated as not physiological): 5
An artifact rule, and the successive differences it allows
The rule: keep a beat if its interval is between 300 and 2000 ms and within 20% of the previous recorded beat. Comparing with the previous recorded beat, not the last one kept, means one bad beat removes only its neighbours, not a long run of good beats after it. A successive difference is then used only when both of its beats were kept, so no difference reaches across a removed beat.
Show the expected result without running
kept 16879 of 17082 beats (98.8%); 16701 successive differences RMSSD over the whole night: 59.6 ms
Five-minute windows, then the median
One number for six hours mixes deep sleep, light sleep and waking. The usual way, and the Heart app's, is RMSSD in each five-minute window, then a summary of the windows. A window counts if it holds at least 120 kept beats and at least 80% of its beats were kept, the same test the Heart app applies.
Type a prediction to enable Run.
Show the expected result without running
72 valid windows of 73, RMSSD from 29.6 to 98.0 ms median RMSSD 58.7 ms (middle half 49.7 to 67.2); ln RMSSD 4.07 lowest 5-minute heart rate 43.4 beats/min
The night as a picture
Show the expected result without running

The median of the windows (58.7 ms) sits a little below the whole-night value (59.6 ms): the whole-night figure averages squared differences, which the most variable windows pull up. RMSSD swings about three-fold within the night, mostly opposite to heart rate: when the heart slows, the beat-to-beat variation grows. The one window near 68 beats a minute, probably a brief waking, has the lowest RMSSD. One five-minute window says little; the median over the night is the number to keep, and only beside other nights measured the same way. The case study CS-6 does that for two nights.
For the athlete: "Last night your heart rate variability was about 59 ms (the middle of the night's five-minute readings); it means something only next to your other nights."
Action card
- Finding
- Last night's RMSSD was 58.7 ms, the median of 72 five-minute windows.
- Evidence
- 98.8% of beats passed the artifact rule; the windows ranged from 29.6 to 98.0 ms.
- How sure
- The night's number is solid; what it means needs other nights measured the same way.
- Action
- Record the same way for at least six more nights before reading anything into it.
- Test again
- Every night or morning, same strap, same rule.
With your own data
Wear the strap overnight (or record five minutes on waking) with the Heart app, export the beat intervals as a two-column file t_s, rr_ms, and run the same cells on it.
Check yourself
Why use a successive difference only when both of its beats were kept?
Five RR intervals: 812, 790, 835, 801, 822 ms. What is RMSSD, in ms?
References
- Data-Driven Athletics, Chapter 5, Artifacts and ectopic beats (Section 5.4) and Heart Rate Variability (Section 5.5).
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.