# Autonomic Aging age-by-sex HRV aggregates

These files are a Feelmo-produced aggregate analysis of the public
**Autonomic Aging v1.0.0** dataset. No subject identifiers or subject-level
features are included.

## Files

- `autonomic-aging-age-sex-hrv.csv`: n, median, quartiles, mean, and standard
  deviation for SDNN and RMSSD by broad age band and sex.
- `autonomic-aging-hrv-by-age-sex.svg` / `.png`: chart of the medians and
  interquartile ranges.
- `analysis-manifest.json`: source version, input checksum, analysis window,
  source checksum verification, software versions, QC counts, sensitivity
  analysis, output hashes, and privacy note.
- `build_autonomic_aging_reference.py`: exact analysis script whose SHA-256 is
  recorded in the manifest.

Cells with fewer than 10 records retain only `n`; all distribution values are
suppressed. The source release contains 1,121 records. The current five-minute
pipeline passed all primary QC checks for 1,044 and had usable age and source
`Sex` metadata for 1,021 (394 coded male and 627 coded female). The source
field is binary male/female metadata; it is not a measure of gender identity.

This is an independent automated reanalysis of the **first** five minutes of
each record. It is not a reproduction of the source paper or of the independent
Calderón-Juárez et al. analysis, which visually selected a clean five-minute
segment near the end and retained 1,026 records.

The source paper describes lead II as the analysis lead. This build therefore
fixes the lead before looking at results: `ECG2` (lead II) for the 621 Task
Force Monitor records and `ECG` (lead II) for the 500 MP150/CNAP records. It
does not choose whichever channel gives a preferred HRV result. R peaks come
from NeuroKit's morphology-aware detector and Kubios correction. A record that
otherwise passes is excluded when its detected beat count differs by more than
10% from the Elgendi 2010 detector, or, for the two-lead subset, when lead I and
lead II beat counts differ by more than 10%. This added concordance screen
excluded 35 otherwise passing records and shifted a published median by at
most 3.857 ms.

Sensitivity analyses are reported cell by cell in the manifest:

- using lead I instead of fixed lead II shifted a median by at most 3.795 ms;
- an automated quality-preference channel rule shifted a median by at most
  3.779 ms, but is not the primary analysis because it is data-dependent;
- excluding nine eligible records with more than 5% automatic artifact flags
  shifted a median by at most 1.870 ms;
- excluding all 147 eligible `Barely acceptable` Zhao-quality records shifted
  a median by at most 6.944 ms (the maximum was the 60–69 male RMSSD cell,
  which fell from n=17 to n=13);
- the NeuroKit Pan-Tompkins implementation disagreed with the primary beat
  count by more than 10% or failed to produce a comparison count in 178
  records and shifted a median by as much as 47.468 ms. It frequently
  double-detected T waves and did not localize the R apex precisely enough for
  short-term HRV, so it is disclosed as a sensitivity analysis, not selected as
  the primary detector.

The build manifest verifies all 2,244 files listed in the source release's
SHA-256 manifest and records the analysis script hash, dependency versions,
and hashes of every generated public table and chart. The SVG internal-ID salt
is fixed so repeated builds in the same environment are byte-deterministic.
Image bytes can still differ across operating systems because font files and
font rendering differ. The numeric CSV is therefore the semantic reproducibility
target; image hashes document the exact build artifacts, not universal
cross-platform expected hashes.

## Reproduce the build

From the `feelmo-docs` repository root, point `--data-dir` at an unmodified
PhysioNet Autonomic Aging v1.0.0 release. The command below pins every recorded
scientific dependency and writes experiments outside the public directory:

```bash
uv run --python 3.12 \
  --with numpy==1.26.4 --with pandas==2.2.1 --with scipy==1.12.0 \
  --with wfdb==4.1.2 --with neurokit2==0.2.9 --with joblib==1.5.3 \
  --with matplotlib==3.11.1 --with pyarrow==15.0.2 \
  python docs/.vuepress/public/data/autonomic-aging/build_autonomic_aging_reference.py \
  --data-dir /path/to/autonomic-aging-cardiovascular-1.0.0 \
  --public-dir /tmp/autonomic-aging-rebuild \
  --subject-output /tmp/autonomic-aging-subject-features.parquet \
  --verify-source-checksums --jobs 8
```

The subject-level parquet contains pseudonymous IDs and biometric features and
must remain private. Only aggregate outputs belong in the public directory.

## Attribution and licence

Source database:

> Schumann A, Bär K. *Autonomic Aging: A dataset to quantify changes of
> cardiovascular autonomic function during healthy aging*, version 1.0.0.
> PhysioNet (2021). https://doi.org/10.13026/2hsy-t491

Source paper:

> Schumann A, Bär KJ. *Scientific Data* 9, 95 (2022).
> https://doi.org/10.1038/s41597-022-01202-y

Independent methodological cross-check:

> Calderón-Juárez M, González-Gómez GH, Echeverría JC, Lerma C.
> *Scientific Reports* 13, 13185 (2023).
> https://doi.org/10.1038/s41598-023-40385-1

The source database is distributed under the Open Database License 1.0
(ODbL). These charts and tables are produced works with source attribution.
For the records and official licence, use the PhysioNet source above.

## Important measurement limitation

These distributions come from a standardized five-minute segment of resting
clinical ECG. They are not an Apple Watch reference range. Intermittent
HealthKit SDNN samples differ in sensor, duration, timing, posture, and signal
processing, so the values are not interchangeable.
