Heart Rate Variability Features
HeartRateLab extracts 53 HRV features across 4 analysis domains from inter-beat-interval (IBI) time series data.
Every feature has a full "Pokédex" entry in the HRV Variable Zoo: definition, equation, normative distribution, resource cost, seminal citation, and per-field application evidence (clinical, sports & peak-performance, contemplative practice), all referenced against the HRV knowledge base.
Feature Domains
1. Time Domain (20 features)
Statistics of the NN/RR intervals and their successive differences, the classic, cheapest, most-reported HRV panel:
mean: Mean inter-beat intervalsdnn: Standard deviation of NN intervalsmedian: Median inter-beat intervalmax: Maximum inter-beat intervalmin: Minimum inter-beat intervalmean_hr: Mean heart rate (BPM)std_hr: Standard deviation of heart ratemax_hr: Maximum heart ratemin_hr: Minimum heart ratemedian_hr: Median heart rate (BPM)range_hr: Range (max − min) of instantaneous heart ratesdsd: Standard deviation of successive differencesrange: Range of inter-beat intervalsrmssd: Root mean square of successive differencessdann: Standard deviation of 5-min average NN intervalspnn50: Proportion of successive differences > 50 mspnn20: Proportion of successive differences > 20 mscvsd: Coefficient of variation of successive differencescvnni: Coefficient of variation of NN intervals (SDNN / mean)rRR: Median relative RR interval distance
2. Frequency Domain (12 features)
Power in the ULF/VLF/LF/HF bands of the RR power spectrum, plus band ratios and peak frequencies:
ulf: Ultra-low frequency power (0–0.003 Hz)vlf: Very low frequency power (0.003–0.04 Hz)lf: Low frequency power (0.04–0.15 Hz)hf: High frequency power (0.15–0.4 Hz)tp: Total power (0.003–0.4 Hz)lf_peak: Peak frequency in the LF bandhf_peak: Peak frequency in the HF bandlf_hf_ratio: LF/HF power ratiolf_relative: LF power as proportion of total powerhf_relative: HF power as proportion of total powerlf_percentage: LF power as percentage of total powerhf_percentage: HF power as percentage of total power
3. Geometric (8 features)
Shape descriptors of the Poincaré / Lorenz return map and the RR histogram, robust to occasional artifacts:
sd1: Poincaré plot short-term variabilitysd2: Poincaré plot long-term variabilitysd2_sd1: Ratio of SD2 to SD1 (cardiac sympathetic index)sd1_sd2_area: Poincaré plot ellipse areacvi: Cardiac vagal indexccsi: Corrected cardiac sympathetic indextriangular_index: HRV triangular indextinn: Triangular interpolation of the NN interval histogram
4. Nonlinear (13 features)
Entropy, complexity, and fractal-scaling measures probing the nonlinear structure of cardiac control (need adequate record length):
apen: Approximate entropysampen: Sample entropyhurst: Hurst exponentrenyi0: Rényi entropy of order 0renyi1: Rényi entropy of order 1 (Shannon)renyi2: Rényi entropy of order 2shan_en: Shannon entropy of the IBI histogramsvd_en: Singular value decomposition entropyfuzzyen: Fuzzy entropyspec_en: Spectral entropyperm_en: Permutation entropymse: Multiscale entropy complexity indexdfa2: Detrended fluctuation analysis long-term scaling exponent (α₂)
The short-term DFA exponent α₁ is available as the dfa1 representation (HeartRateLab.Features.function_registry["dfa1"](m)), a building block rather than a registry feature, so it does not appear in extract_feature_set output.
Feature Extraction
Basic Usage
extract_feature_set returns a one-row DataFrame with one column per feature. The features keyword selects a preset set (:default, :fast, :all, :nonlinear) or an explicit vector of feature names:
using HeartRateLab
# Load data
ibis = read_txt("data.txt")
# Default set (time, frequency, geometric: excludes nonlinear and ulf)
features = extract_feature_set(ibis)
# All 53 features (adds the expensive nonlinear set)
features_all = extract_feature_set(ibis; features=:all)
# Only the nonlinear features
features_nl = extract_feature_set(ibis; features=:nonlinear)
# Custom subset by name
features_custom = extract_feature_set(ibis; features=["mean", "sdnn", "rmssd", "lf", "hf"])Signal Length Requirements
Different features require minimum signal lengths:
# Check valid features for a given signal length
valid = valid_features(length(ibis))
# Features table
# Signal length 10: 14 features
# Signal length 50: 30 features
# Signal length 100: 41 features
# Signal length 128: 53 features (all)Feature Preprocessing
Features are automatically computed with preprocessing:
# Preprocessing steps (automatic)
# 1. Replace outliers with NaN
# 2. Interpolate missing values
# 3. Compute features from clean IBI series
# 4. Return NaN for invalid features
# Note: ensure input IBIs are in milliseconds