Skip to contents

sampleEntropy returns the sample entropy of a time-series signal see also https://en.wikipedia.org/wiki/Sample_entropy

Usage

sampleEntropy(data, m, r, maxStarts = 1000L, nThreads = 1L)

Arguments

data

Numeric vector

m

Integer. The pattern (embedding) length: Larger m captures finer structure but sharply reduces the number of matches, so it requires longer data and increases variance. Common choices are m = 2 or 3 for physiological time series.

r

Scaling parameter for the filtering factor. The filtering factor is r x standard deviation of the signal

maxStarts

Integer specifying the maximum number of signal start positions to evaluate (default 1000). If the time series has more possible starts, an evenly spaced subset of size maxStarts is used. Use -1 to include all possible starts.

nThreads

Integer giving the number of parallel OpenMP threads to use for calculation.

Value

The Sample Entropy value of the time-series signal

Details

This function calculates the Sample Entropy of a time-series vector given as argument. Sample Entropy is used to assess the complexity of physiological time-series signals. This C++ implementation is a modified version of: https://gist.github.com/schochastics/e3684645763e93cbc2ed7d1b70ee5fe6

Examples

ts <- runif(100, 0, 1)
sampleEntropy(ts, m = 2L, r = 0.2)
#> [1] 1.974081