Sample Entropy

Simulation
Introduced by
Richman & Moorman
Year
2000
Type
Nonlinear entropy measure
Family
Nonlinear dynamics

What does it do?

Sample Entropy (SampEn) is a nonlinear measure of the complexity and regularity of a univariate time series.

Introduced by Richman and Moorman in 2000 as a modification of Approximate Entropy (ApEn), it compares how often patterns of length m that are similar within a tolerance r remain similar when extended by one data point, and reports the negative logarithm of the ratio of these match rates. Higher values indicate a more irregular series, and lower values indicate more regularity or self-similarity.

The intuition behind the method

Imagine reading a long sequence of letters and asking: if two short phrases look alike, how often does the next letter also match? If the next character almost always matches, the sequence is very predictable and has low entropy. If it rarely matches, the sequence is unpredictable and complex, and entropy is high. Sample Entropy counts such matching extensions, excluding self-matches to avoid bias, then converts the ratio into a single complexity score.

History

Richman and Moorman (2000) introduced Sample Entropy to address inconsistent results from Approximate Entropy, which Pincus had introduced as a complexity measure applicable to short, noisy biological series. They compared the two measures on random number sets with known probabilistic character, and evaluated the cross-measures on cardiovascular data sets. They reported that SampEn agreed more closely with theory over a broad range of conditions. They also described cross-sample entropy for comparing two distinct time series.

When to use it

Sample Entropy suits univariate, continuous-valued time series in which regularity or complexity is the quantity of interest, such as physiological recordings. It needs a reasonably long series. The length required for stable estimates depends on m, r and the signal, so check stability on your own data, for example by recomputing the value on truncated segments or across different series lengths, before relying on a result. The embedding dimension m and tolerance r strongly affect the result. Values of m = 1 or 2 and r = 0.1 to 0.25 times the standard deviation are commonly used conventions, not values that are optimal for every dataset. Fix m and r before comparing groups or recordings, and test how sensitive the result is across a plausible range of both. Do not use it for very short series, categorical or symbolic data, or when you need to see how complexity changes across scales. In those cases, consider the alternatives Approximate Entropy, Permutation Entropy, or Multiscale Entropy.

Limitations and considerations

  • The result depends on the embedding dimension m and tolerance r, and there is no universal default for either
  • Estimates can become unreliable for short series, because the match counts A and B may be too small to support a stable ratio
  • Counting all pairs of templates requires pairwise comparisons, so computation time grows rapidly with series length
  • The output is one aggregate value, so it does not show when or at which time scale the complexity changes

Source conditions do not replace independent scientific review or validation by an analysis engine.

Strengths

  • Excludes self-matches from the template count, which distinguishes it from ApEn, whose count includes them
  • In the original comparison on random series with known probabilistic character, SampEn agreed with theory more closely than ApEn over a broad range of conditions
  • Yields a single scalar that summarizes the overall regularity of a series, which is convenient for comparing recordings
  • Has a cross-sample variant (cross-SampEn) that measures the similarity of two distinct series, as the original paper also evaluated

Applications

  • Analysis of cardiovascular time series, the data type used for the cross-entropy evaluation in the original paper
  • Cross-sample entropy comparison of two simultaneously recorded cardiovascular series, as examined in the original paper
  • Comparison of regularity between physiological recordings from different groups or conditions, provided that m and r are held fixed
  • Other biological or physiological signals of comparable length and sampling, where the same parameter and length considerations apply

How it works

How it works

1

The series of length N is divided into N-m overlapping template vectors of length m. Each template x_m(i) contains m consecutive data points starting at position i. These templates represent local patterns in the signal and are the units compared in the next steps.

Formula
\mathbf{x}_m(i) = \{u(i), u(i+1), \ldots, u(i+m-1)\}, \quad i = 1, 2, \ldots, N-m
2

For each template x_m(i), the algorithm counts the other templates x_m(j), with j different from i, that lie within a distance tolerance r. Self-matches are excluded. Here d[·,·] denotes the distance between two templates; the exact metric should be checked against the original paper before implementation. The count is divided by N-m-1, the number of possible partners after excluding the template itself, and then averaged over the N-m templates. The result, A^m(r), estimates how often two length-m patterns are similar. The tolerance r is usually set as a fraction of the signal's standard deviation.

Formula
A^m(r) = \frac{1}{N-m} \sum_{i=1}^{N-m} \frac{\#\{j \neq i : d[\mathbf{x}_m(i), \mathbf{x}_m(j)] \leq r\}}{N-m-1}
3

The same matching is repeated for templates of length m+1, giving B^m(r). This measures how often pairs of length-m patterns that matched in the previous step still match when extended by one point. The comparison between A^m(r) and B^m(r) is what makes the measure sensitive to the persistence of local structure.

Formula
B^m(r) = \frac{1}{N-m} \sum_{i=1}^{N-m} \frac{\#\{j \neq i : d[\mathbf{x}_{m+1}(i), \mathbf{x}_{m+1}(j)] \leq r\}}{N-m-1}
4

Sample Entropy is the negative natural logarithm of the ratio B^m(r) / A^m(r), which approximates the conditional probability that a match of length m also matches at length m+1. A value of zero means every length-m match also extends to length m+1, which indicates high regularity. Larger positive values indicate less regular, more complex series. The ratio must be non-zero for the logarithm to be finite, which is why match-free cases are problematic.

Formula
\text{SampEn}(m, r, N) = -\ln\left(\frac{B^m(r)}{A^m(r)}\right)

Common pitfalls

  • If r is too small, few or no templates match, B or A becomes zero, and SampEn is undefined or infinite; if r is very large, nearly all pairs match, B/A approaches 1, and SampEn approaches zero, so the value stops carrying information about the signal
  • SampEn values are only comparable across studies when m and r are identical, so the chosen parameters should be reported with every result
  • Non-stationary series, such as signals with trends or drifting amplitude, can produce misleading complexity estimates unless they are detrended or otherwise preprocessed first
  • Because the output is a logarithm of a ratio, match-free windows or recordings must be handled explicitly before averaging or statistical testing, since they cannot be assigned a finite value

Frequently asked questions

How do I choose m and r for Sample Entropy?

Common starting points are m = 2 and r between 0.1 and 0.25 times the standard deviation of the series. These are conventions rather than values that are optimal for every dataset. Report how SampEn varies across a plausible range of m and r for your data, and use the same values across all groups you compare.

What is the difference between Sample Entropy and Approximate Entropy?

ApEn counts self-matches, comparing each template with itself, whereas SampEn excludes self-matches in its count, as the formula shows. The original paper reported that ApEn statistics gave inconsistent results, while SampEn agreed more closely with theory in its tests.

Can Sample Entropy be applied to short time series?

SampEn can become unreliable for very short series because the probability estimates depend on finding enough template matches. Check how stable your estimate is by varying the series length on your own data. For short series, Permutation Entropy is one alternative named on this page. When no pairs match at length m+1, the ratio is undefined and SampEn cannot be computed.

Related methods

Sources

  1. Richman, J. S., & Moorman, J. R. (2000). Physiological time-series analysis using approximate entropy and sample entropy. American Journal of Physiology, 278(6), H2039–H2049.

    Open DOI reference