← Tepna preprints

Three independent detectors, one tachogram: RR-, ECG- and optical rMSSD agree in bias, but the optical arm carries several-fold wider limits of agreement

Michal Planicka  ·  corresponding author — Tepna Project

PulseDex · ECGDex · PpgDex nodes, Tepna physiological-signal suite

Draft v2 · July 2026 · generator synth-gen 2.1 / cohort-gen 2.0 · Analysis tool: qrs-equiv-analysis.html · Detectors: real pulsedex-dsp.js · ecgdex-dsp.js · ppgdex-dsp.js · FULL lane · 100% local, reproducible

Revision note (2026-10-27, re-cut on current code): re-run at the paper’s 240 patients on commit 39cfafdc4, after 86 commits to the *-dsp.js detectors since the 2026-09-22 re-cut, 71 of them fixes — 18 of them to ppgdex-dsp.js (driver tools/analysis-rerun.mjs --paper-scale). 220 valid windows, reproducing the published count exactly. The electrical pair reproduces; the optical arm has drifted FURTHER since September. ECGDex−PulseDex bias −0.011 ms at r 0.9998, unchanged. The optical arm measures bias +3.298 ms (+8.15 %), 95% LoA −9.32 … +15.92 ms, r 0.8057, PAT-jitter SD 6.435 ms — against +7.8 % / r 0.82 / 6.3 ms measured on 2026-09-17 and ≈+1 % / r 0.92 / ≈4.0 ms published below. Three measurements, one direction: the optical bias is growing. Table 1 and the body text are now REPLACED with the measured values rather than annotated, because the September figures have now been reproduced twice; the published 2026-07-07 row is retained under the table. ⚠ Figure 1 is still NOT regenerated — an externally assembled composite whose layout parameters are recorded nowhere — so its optical panels no longer reproduce; treat them as the 2026-07-07 rendering. ⚠ The title’s “agree in bias” clause now holds for the ELECTRICAL pair only; a title change on a published preprint is the owner’s call and is not made here.

Revision note (2026-09-17, cohort-gen 2.0 + A/B): re-run at 240 patients (220 valid windows, reproducing the published count exactly). The electrical equivalence claim reproduces; the optical figures do not. ECGDex−PulseDex bias −0.011 ms at r 0.9998, against a published −0.02 ms / 0.9999 — unchanged. But the optical arm now measures bias +7.8 % at r 0.82, against the ≈+1 % / 0.92 reported below, and the pulse-arrival-time excess is 6.3 ms against ≈4.0. ⚠ That drift is NOT the generator. Re-running the same tool against cohort-gen 1.9 — the generator this paper was published on — gives optical bias 7.46 % at r 0.839 and a PAT excess of 5.84 ms. So the move from ≈1 % to ≈7.5 % happened between publication and now at a FIXED generator; 1.9→2.0 contributes only a further +0.3 pp of bias and −0.02 of r. What changed in the measurement pipeline is not established here and is not guessed at. ⚠ Figure 1 was NOT regenerated: it is an externally assembled composite of three canvases whose layout parameters are recorded nowhere, so its optical panels still show the ≈+1 % figures this note supersedes. ⚠ The claim that the optical bias “collapses to ≈+1 %” in the note below is therefore RETRACTED as a current measurement; it is retained as the v2.1-texture finding it was.

Revision note (earlier): re-run on the broadband RR texture (synth-gen 2.1). The earlier draft's headline optical divergence (bias +32%, r 0.57) did not survive the realistic texture: with richer true beat-to-beat variability, the fixed pulse-arrival-time jitter adds a far smaller relative offset. The optical bias collapses to ≈+1% and the correlation rises to 0.92; the surviving optical signature is wider limits of agreement, not a bias.

Abstract

Background. The suite derives the same time-domain HRV metric, rMSSD, from three different inputs — recorded RR intervals (PulseDex), the raw ECG (ECGDex, Pan–Tompkins), and the optical pulse (PpgDex). Whether those numbers are interchangeable determines whether they can be pooled, substituted, or fused. Methods. On the FULL-lane waveform harness, one ~9-minute apnea-cluster window per synthetic patient (240 patients, 220 valid windows) was scored for rMSSD by all three production detectors on the same co-generated beats: PulseDex reads the ground-truth RR (the reference), ECGDex re-derives it from the raw int16 ECG at 130 Hz, and PpgDex from the 176 Hz optical pulse. We report pairwise Bland–Altman agreement. Results. ECGDex and PulseDex were statistically interchangeable: bias −0.02 ms (−0.04%), 95% limits of agreement −0.4…+0.3 ms, Pearson r 0.9999 [re-measured 2026-10-27: −0.011 ms, LoA −0.37…+0.35, r 0.9998 — reproduces] — two detectors sharing no code, signal, or sampling rate recover the identical tachogram, the 130 Hz + QRS-detection floor adding only ≈0.18 ms SD. PpgDex was biased high and several-fold noisier: bias +3.30 ms (+8.1%), limits −9.3…+15.9 ms (≈35× wider than the electrical floor), r 0.81 [re-measured 2026-10-27; the +0.3 ms / ≈22× / r 0.93 first published here is superseded, and the 2026-09-17 re-cut’s +7.8% / r 0.82 has drifted further]. The optical-only dispersion — the quadrature excess over the electrical floor — was ≈6.4 ms, i.e. essentially all of the PPG disagreement is pulse-arrival-time jitter, which inflates the scatter of the optical estimate and, on current code, also shifts its centre. Conclusion. RR- and ECG-derived rMSSD are interchangeable and may be pooled or cross-validated; optical rMSSD is neither: it runs ≈8% high with limits of agreement ≈35× wider, so an individual optical reading is both offset and materially less precise — it should be down-weighted (not equally averaged) in fusion, its offset reported rather than assumed away, and its per-window uncertainty carried through. Synthetic ground truth: this certifies cross-detector agreement and quantifies each modality's intrinsic dispersion — it is not a real-patient equivalence study.

Keywords: heart-rate variability · rMSSD · pulse-rate variability · photoplethysmography · QRS detection · Bland–Altman · pulse-arrival-time · method comparison · sensor fusion

0. Layman overview (delete before submission)

The app calculates the same heart-rhythm score (“rMSSD”) from three different sources: a recorded list of heartbeat intervals, a raw ECG trace, and the optical (blood-flow) pulse. The question: are those three numbers the same number, so they can be mixed and matched?

Answer: the ECG and the interval-list agree almost perfectly — different code, different signal, yet essentially identical results, so they're interchangeable. The optical pulse was reported to land on the same average number — within about 1% — but that figure is SUPERSEDED: re-measured on 2026-10-27 the optical score runs about 8% high (+3.30 ms), and it has moved further in the same direction at each of the last three re-cuts. It is also much shakier reading to reading: the time it takes blood to reach your arm wobbles beat to beat, which spreads its score out — its beat-to-beat error band is roughly 35 times wider than the ECG’s. An earlier draft reported that a more realistically textured simulated rhythm stopped the optical score reading too high; on current code it reads high again, and why is not established here. The takeaway for the software: the optical heart-rhythm number is usable as an HRV estimate, but because a single reading is noisier, give it less weight when combining sensors and carry its wider uncertainty through. (Simulation with shared, known beats — it proves which detectors agree and why, not exact human magnitudes.)

1. Introduction

rMSSD — the root mean square of successive RR differences — is the suite's workhorse short-term HRV metric, and three nodes compute it from three different front ends: PulseDex from a recorded RR series, ECGDex from the raw electrocardiogram, and PpgDex from the wrist/finger optical pulse. Downstream code routinely treats these as one number: pooling them across a cohort, substituting whichever is available, or fusing them into a single autonomic estimate. That is only valid if the three agree. Two of them recover beats electrically or from the interval stream; the third recovers them from a peripheral pressure wave whose timing, relative to the heartbeat, varies beat to beat (pulse-arrival-time, a function of blood pressure and vascular tone). rMSSD is by construction maximally sensitive to exactly that beat-to-beat timing jitter, so the optical estimate may not be interchangeable with the electrical ones even when both detectors are working perfectly.

We test interchangeability directly. Because all three detectors here score the same underlying beats, any disagreement is attributable to the front end — sampling rate, detector behaviour, or (for the optical arm) pulse-arrival-time jitter — rather than to different recordings. Bland–Altman quantifies the bias and the limits of agreement for each pair, and contrasting the optical pair against the electrical pair isolates the pulse-arrival-time component.

2. Methods

2.1 Shared-beat design

The FULL lane renders, per patient, one ~9-minute window centred on an apnea cluster, in each modality's native raw form, from one shared master event timeline — so the RR beat train is identical across modalities. PulseDex is given the window's ground-truth RR (artifact-cleaned) and serves as the reference. ECGDex re-derives beats from a raw int16 µV ECG at 130 Hz with its production Pan–Tompkins pipeline; the renderer places each R-peak at its true beat time, so detected R-to-R intervals equal the true RR up to 130 Hz quantization. PpgDex re-derives beats from the 176 Hz optical pulse with its production foot/peak detector. No detector parameters were altered; timestamps follow the suite Clock Contract. Each detector is loaded in its own realm (PulseDex in the shipped single-node harness; ECGDex and PpgDex in a FULL-lane worker) so the plain-global DSP files never share scope.

2.2 Agreement statistics

For each detector pair we compute Bland–Altman agreement on the per-window rMSSD: the mean difference (bias), its standard deviation, the 95% limits of agreement (bias ± 1.96 SD), the percentage bias relative to the reference mean, and the Pearson correlation. The optical-only dispersion is the quadrature excess of the PPG−Pulse standard deviation over the ECG−Pulse standard deviation, √(SD²₍PPG−Pulse₎ − SD²₍ECG−Pulse₎), which removes the sampling-plus-detection floor common to both and leaves the pulse-arrival-time component. The run reported here covers 240 sampled patients (220 valid windows with all three rMSSD values).

3. Results

Table 1. Pairwise rMSSD agreement (Bland–Altman; 220 shared-beat windows; real detectors, synthetic ground truth). Re-measured 2026-10-27 on commit 39cfafdc4; the published 2026-07-07 optical values are kept in the footer row.
PairnBias (ms)Bias (%)SD (ms)95% LoA (ms)Pearson r
ECGDex − PulseDex220−0.011−0.03%0.18−0.37 … +0.350.9998
PpgDex − PulseDex220+3.298+8.15%6.44−9.32 … +15.920.806
PpgDex − ECGDex220+3.310+8.18%6.45−9.33 … +15.950.804
Published 2026-07-07 optical values were +0.29 ms | +0.71% | SD 3.96 | −7.48 … +8.06 | r 0.925 (both optical rows), and the electrical row read −0.02 | −0.04% | −0.37 … +0.34 | r 0.9999 — see the 2026-10-27 revision note. PAT-jitter SD: 6.435 ms measured, ≈4.0 ms published.

3.1 RR and ECG are interchangeable

ECGDex and PulseDex agreed almost exactly: a bias of −0.02 ms (−0.04% of the reference mean), 95% limits of agreement of just −0.4 to +0.3 ms, and a Pearson correlation of 0.9999. These are two detectors that share no source code, no input signal (raw ECG vs an RR list), and no sampling model, yet they recover the identical tachogram; the 130 Hz sampling and the Pan–Tompkins detection together inject only ≈0.18 ms of beat-to-beat dispersion. RR- and ECG-derived rMSSD are, for practical purposes, the same number — they can be pooled across the two nodes and used to cross-validate one another.

Agreement scatter vs PulseDex; Bland–Altman PPG−Pulse; Bland–Altman ECG−Pulse
Figure 1. Three-way rMSSD agreement on shared beats (live output of qrs-equiv-analysis.html, synth-gen 2.1 / cohort-gen 1.9). Top: each detector's rMSSD vs the PulseDex reference — ECGDex (blue) lies on the identity line, PpgDex (amber) is drawn scattering symmetrically about it; as re-measured 2026-10-27 it sits systematically above the line again (+3.30 ms), so this panel does not reproduce either. Middle: Bland–Altman PpgDex − PulseDex — as rendered, bias +0.3 ms centred on zero with wide limits (−7.5…+8.1 ms). This panel NO LONGER REPRODUCES: the same tool on commit 39cfafdc4 measures +3.30 ms with limits −9.3…+15.9 ms (2026-10-27). The figure is an externally assembled composite with no recorded layout, so it was not regenerated. Bottom: Bland–Altman ECGDex − PulseDex on a much finer axis — a tight cluster on zero (±0.4 ms), the sampling-plus-detection floor. The ≈22× difference in limit width between the two panels is the optical-only dispersion. Dark theme is the tool's native rendering.

3.2 The optical pulse runs high and is several-fold noisier

PpgDex no longer agrees with the electrical detectors in the mean (it stands in the same relation to either arm, since those two agree with each other): a bias of +3.30 ms (+8.1%) and a correlation of 0.81, both re-measured 2026-10-27. Scatter separates it further: its 95% limits of agreement were −9.3 to +15.9 ms, roughly thirty-five times wider than the ECG–RR limits. The optical-only dispersion, after removing the sampling-plus-detection floor in quadrature, was ≈6.4 ms: essentially the entire PPG disagreement is pulse-arrival-time jitter. Beat-to-beat variation in how long the pulse takes to reach the periphery adds real per-beat timing noise to the optical inter-beat series that is absent from the electrical one; it widens the optical rMSSD distribution and shifts its centre upward. The “unbiased, variance-only” reading this section carried until 2026-09-17 is withdrawn as a current measurement; the three dated optical biases (≈+1%, +7.8%, +8.15%) are each retained as the measurement they were.

Change from the earlier draft. On the previous single-relaxor RR texture the true beat-to-beat variability was small, so the fixed pulse-arrival-time jitter dominated the optical rMSSD and inflated it by ≈+32% (r 0.57). Under the realistic broadband texture (synth-gen 2.1) the true successive-difference variance is much larger, so the same PAT jitter adds a far smaller relative quantity: in quadrature, √(true² + PAT²) − true shrinks as the true term grows. The “optical bias collapses to ≈+1%” conclusion is RETRACTED as a current measurement by the revision note above and is not restated: the mechanism argued here predicts a collapse that the re-run does not find, and the note records the drift as NOT the generator, while the absolute PAT-jitter dispersion has itself grown (≈4.0 ms published, ≈6.4 ms re-measured 2026-10-27) and persists as wider limits of agreement. The robust conclusion is unchanged in kind — the optical arm carries an extra PAT-jitter dispersion the electrical arm does not — but on current code its practical severity is both an offset (≈+8%) and a precision penalty.

4. Discussion

The practical rule is asymmetric. RR- and ECG-derived rMSSD are interchangeable: a fusion layer can treat them as one measurement, pool them, or use either to validate the other (the 0.9999 agreement is, in effect, a cross-node regression test for the HRV pipeline). Optical rMSSD is offset and weakly correlated on current code (bias ≈+8%, r 0.81, re-measured 2026-10-27), so it is usable as a trend estimate rather than as a substitute: it is not equivalent in centre or in precision, and its limits of agreement are ≈35× wider, so a single optical reading carries materially more uncertainty. In fusion it should therefore be down-weighted relative to an available electrical arm (weighted by its wider variance, not averaged in as an equal), and its per-window uncertainty propagated rather than discarded; and because the label matters, it should still be reported as pulse-rate variability. The earlier finding that the optical arm also mildly over-detects and loses beats under apnea (companion preprint, qrs-yield.html) adds a second, yield-driven error term on top of the PAT-jitter dispersion, so the electrical arm remains the clean HRV reference.

Limitations. This is synthetic ground truth. The pulse-arrival-time jitter that drives the PPG dispersion is the magnitude built into the generator's optical model, so the exact PAT-jitter SD (≈6.4 ms re-measured 2026-10-27, ≈4.0 ms as published) and hence the ≈35× limit-width ratio are not measured human figures — the robust results are the near-perfect RR–ECG equivalence and the qualitative optical penalty, which on current code is both a bias and a variance term. The disappearance of the earlier +32% optical bias is itself a demonstration that a bias which looks like a fixed property of the sensor can in fact be an artifact of how much true beat-to-beat variability the reference carries. A residual optical over-detection (precision ≈98.8% re-measured 2026-10-27, ≈92% as published; companion preprint) contributes a small part of the PPG dispersion alongside PAT jitter. One ~9-minute window per patient bounds runtime but limits per-window precision. A real equivalence study needs simultaneous chest-ECG and finger/wrist-PPG with a shared clock under a range of autonomic states; this harness certifies the cross-detector pipeline and motivates that measurement rather than replacing it.

5. Reproducibility

6. Sample size & statistical power

Like its companion, this is a FULL-lane waveform pilot — raw ECG + optical rendered and scored per patient — so runtime, not statistics, is the constraint and 100k-scale is impractical. The agreement estimates (bias, limits of agreement, Pearson r) are per-window comparisons; their precision improves as ~1/√N_windows. Because the RR–ECG agreement is near-perfect and the optical precision penalty (its several-fold wider limits) is large, both conclusions are unmistakable at modest N.

Table 2. Sample-size guidance for this FULL-lane pilot (patients → ~1 shared-beat window each).
TierPatientsWhat it buys
Minimum (acceptable)~30Both verdicts clear: RR–ECG limits of agreement <±1 ms, optical bias ≈+8% with ≈35× wider limits. Pearson r stable to ≈±0.03.
Recommended~100–240Bland–Altman limits and r to ≈±0.01; clean three-panel agreement figure. This run used 240 (220 valid shared-beat windows).
This run240220 windows with all three rMSSD values; RR–ECG r = 0.9999, optical r = 0.81 (2026-10-27).
Diminishing returns> ~200The two limits-of-agreement bands are already separated by ~35×; more single windows only add FULL-lane hours. Greater value comes from varying autonomic state / window length than from more patients.

Practical reading: ~30 patients to settle interchangeability, ~60–100 for tight published limits of agreement; beyond ~200 the FULL-lane cost dominates — vary autonomic state and window length rather than adding patients.

References

  1. Project documentation: CLAUDE.md (Clock Contract, evidence-grade system), COHORT-VALIDATION-README.md, PAPERS-AND-FIXES-BRIEF.md, Tepna suite.
  2. Bland JM, Altman DG. Statistical methods for assessing agreement between two methods of clinical measurement (full citation to be added at submission).
  3. Standard references on pulse-rate variability vs heart-rate variability and pulse-arrival-time / pulse-transit-time variability — to be added at submission.
  4. Companion preprints: qrs-yield.html (modality-asymmetric beat-yield), cgm-hrv-coupling.html (cross-node coherence), Tepna working preprint series.
T © 2026 Michal Planicka ·Tepna v1.0.0 ·Apache-2.0 ·◈ Asheville, NC ·not a medical device
v2.23.0