Skip to contents

Computes sample entropy (SampEn) from RR interval data. Sample entropy measures the regularity or predictability of a time series. Lower values indicate more regular (predictable) signals, while higher values indicate more complex (irregular) signals.

Usage

ecgSampleEntropy(rr, m = 2L, r_factor = 0.2)

Arguments

rr

A data.frame with columns channel, rr_ms, and time_sec, as returned by ecgRRintervals.

m

Embedding dimension (default: 2). Length of template patterns to compare.

r_factor

Tolerance factor (default: 0.2). The tolerance r is computed as r_factor * sd(rr_ms).

Value

A data.frame with one row per channel and the following columns:

channel

Integer channel index.

sample_entropy

Sample entropy value (nats). Lower values indicate more regular signals; higher values indicate more complex signals. NA if the series is too short or constant.

m

Embedding dimension used.

r

Tolerance threshold (ms) computed as r_factor * sd(rr_ms).

References

Richman, J.S. & Moorman, J.R. (2000). "Physiological time-series analysis using approximate entropy and sample entropy." American Journal of Physiology-Heart and Circulatory Physiology, 278(6), H2039–H2049. doi:10.1152/ajpheart.2000.278.6.H2039

See also

ecgHRVnonlinear for the combined nonlinear analysis wrapper, ecgHRVpoincare for Poincare plot descriptors, ecgDFA for detrended fluctuation analysis.

Examples

set.seed(1)
n <- 300
time_sec <- cumsum(rep(0.85, n))
rr_ms <- 850 + 30 * sin(2 * pi * 0.1 * time_sec) + rnorm(n, sd = 15)
rr <- data.frame(channel = 1L, rr_ms = rr_ms, time_sec = time_sec)
ecgSampleEntropy(rr)
#>   channel sample_entropy m        r
#> 1       1       2.139282 2 5.214817