apopt.comCBE 493R Data-Driven Athletics

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.

  1. 1Gather (used)
  2. 2Statistics (used)
  3. 3Visualize (used)
  4. 4Cleanse (used)
  5. 5Features (used)
  6. 6Balance
  7. 7Scale
  8. 8Split
  9. 9Deploy
  1. Ask
  2. Collect (this week)
  3. Check (this week)
  4. Interpret (this week)
  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-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

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

PythonSix hours of beats

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.

PythonKeep, pair, and RMSSD for the whole night

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.

PythonRMSSD per window, and the night's median

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

PythonRMSSD and heart rate through the night

Show the expected result without runningTwo panels against hours of sleep. Top, RMSSD per five-minute window in milliseconds, between about 30 and 100 ms with the median as a dashed line. Bottom, heart rate per window, mostly 43 to 52 beats a minute, with one window near 68.

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

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

  1. Why use a successive difference only when both of its beats were kept?

  2. Five RR intervals: 812, 790, 835, 801, 822 ms. What is RMSSD, in ms?

    ms

0 of 2 answered · 0 right the first time

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.