5D Library › Autonomic Sympathovagal Balance, Six-Meridian State-Space Models and Multimodal Biomarker Inversion · 中文

Chapter 6. Limits of Measurement: Camera Jitter and the Predictive Value of a Screen

The camera inflates RMSSD

RMSSD measures the differences between neighbouring beat intervals, which is exactly the quantity most inflated by timing error. A camera can place each beat only within its frame grid, plus errors from skin tone, light and motion. If every beat time carries an independent error of standard deviation ee, the error in each difference of neighbouring intervals has variance 6e26e^2, so the RMSSD observed is RMSSD2+6e2\sqrt{\mathrm{RMSSD}^2 + 6e^2}. At 30 frames a second, rounding alone gives 33.3/1233.3/\sqrt{12}, about 9.6 milliseconds.

Calculation

# Chapter 6. p11: What a camera does to RMSSD. A camera places each beat
# only to within its frame grid and its own noise. If every beat time
# carries an independent error of sd e, each interval error is
# e(n+1) - e(n), and each successive difference of intervals carries
# e(n+2) - 2 e(n+1) + e(n), of variance 6 e^2. So
#   RMSSD_seen = sqrt(RMSSD^2 + 6 e^2).
# At 30 frames a second rounding alone gives e = 33.3 / sqrt(12) ms; skin
# tone, light and motion add more. Checked on 20 x 300 beats per case,
# seed 86.
import random
from math import sqrt

def seen(true_rmssd, e, rng, n=300):
    rr = [900.0 + rng.gauss(0, true_rmssd / sqrt(2)) for _ in range(n)]
    t, times = 0.0, []
    for r in rr:
        t += r
        times.append(t + rng.gauss(0, e))
    obs = [b - a for a, b in zip(times, times[1:])]
    return sqrt(sum((b - a) ** 2 for a, b in zip(obs, obs[1:]))
                / (len(obs) - 1))

if __name__ == "__main__":
    rng = random.Random(86)
    print("   true RMSSD   timing sd   formula   simulated  inflation")
    for true in (15.0, 40.0):
        for e in (33.3 / sqrt(12), 15.0, 25.0):
            f = sqrt(true ** 2 + 6 * e * e)
            s = sum(seen(true, e, rng) for _ in range(20)) / 20
            print("   {:10.0f}   {:9.1f}   {:7.1f}   {:9.1f}  {:+8.0%}"
                  .format(true, e, f, s, f / true - 1))
#    true RMSSD   timing sd   formula   simulated  inflation
#            15         9.6      27.9        28.3      +86%
#            15        15.0      39.7        39.4     +165%
#            15        25.0      63.0        63.9     +320%
#            40         9.6      46.4        46.2      +16%
#            40        15.0      54.3        54.0      +36%
#            40        25.0      73.1        72.9      +83%

A person whose true RMSSD is 15 milliseconds (low vagal tone, exactly the person a screen most wants to find) is read at about 28.3 milliseconds under a timing error of 9.6 milliseconds, an inflation of 86%; at a timing error of 25 milliseconds the reading is about 63.9, an inflation of 320%. For a person with a true RMSSD of 40 the inflation is much smaller. In other words, camera error lifts the low-RMSSD readings that most need to be seen into an apparently normal range; the formula and the simulation agree with each other, and this is a systematic bias, not random noise (Shaffer and Ginsberg 2017).

RMSSD observed rises with timing error (p11).

A screen is not a diagnosis

Even when a screen is fairly accurate, the meaning of a positive result depends on how many of the people screened really have a problem. p12 assumes a sensitivity of 0.80 and a specificity of 0.85 (illustrative) and also includes the label accuracy of the three-modality screen of Chapter 5, one minus 0.298.

Calculation

# Chapter 6. p12: A screen is not a diagnosis. Suppose the three-minute
# screen flags "needs a clinical look" with sensitivity 0.80 and
# specificity 0.85 (illustrative). Positive predictive value depends on
# how common the condition is among those screened. Among true positives
# the pattern label is right with probability 1 - 0.298 (p09, three
# modalities), so a flag with the right label is PPV * 0.702.
SENS, SPEC, LABEL = 0.80, 0.85, 1 - 0.298

if __name__ == "__main__":
    print("   prevalence   PPV    NPV    false flags per 1,000"
          "  right label")
    for prev in (0.02, 0.05, 0.10, 0.20, 0.40):
        tp = SENS * prev
        fp = (1 - SPEC) * (1 - prev)
        tn = SPEC * (1 - prev)
        fn = (1 - SENS) * prev
        ppv, npv = tp / (tp + fp), tn / (tn + fn)
        print("   {:10.0%}  {:5.3f}  {:5.3f}  {:21.0f}  {:11.3f}".format(
            prev, ppv, npv, 1000 * fp, ppv * LABEL))
#    prevalence   PPV    NPV    false flags per 1,000  right label
#            2%  0.098  0.995                    147        0.069
#            5%  0.219  0.988                    143        0.154
#           10%  0.372  0.975                    135        0.261
#           20%  0.571  0.944                    120        0.401
#           40%  0.780  0.864                     90        0.548

In a general population with a prevalence of 2%, the positive predictive value is only 0.098: of the people flagged, only one in ten really needs further assessment, and 147 in every thousand are flagged wrongly; the share both flagged and given the right pattern label is only 0.069. Only when prevalence reaches 40% (for example among people already referred to a specialist) does the positive predictive value reach 0.780. The same tool means quite different things in different populations (Buderer 1996).

Disclosure

Medical statement: this book is about the mathematics of measurement and inference; it is not medical advice and not a diagnostic tool. None of the screening schemes it mentions has been clinically validated. For any physical or emotional difficulty, please seek help from a qualified health professional.

Summary

Camera timing error inflates low RMSSD the most, hiding exactly the people a screen most wants to find; and in a general population, even an accurate screen gives mostly false positives. Any promotion of a “three-minute phone test” as a diagnosis ignores both limits.

References

Buderer, Nancy M. Fisher. 1996. “Statistical Methodology: I. Incorporating the Prevalence of Disease into the Sample Size Calculation for Sensitivity and Specificity.” Academic Emergency Medicine 3 (9): 895 to 900.
Shaffer, Fred, and J. P. Ginsberg. 2017. “An Overview of Heart Rate Variability Metrics and Norms.” Frontiers in Public Health 5: 258.

Fan, Y. (2026). Autonomic Sympathovagal Balance, Six-Meridian State-Space Models and Multimodal Biomarker Inversion: Heart-Rate Variability Spectral Decomposition, Thermoregulatory Phase Drift and Bayesian Syndrome Classification [自主神经交感迷走平衡、六经辨证状态空间与多模态标志物反演] (Version 1.0.0). 5D Library. https://doi.org/10.5281/zenodo.24090227 · Licensed under Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0).