Sample entropy

Sample entropy (SampEn) is a modification of approximate entropy (ApEn), used for assessing the complexity of physiological time-series signals, diagnosing diseased states.[1] SampEn has two advantages over ApEn: data length independence and a relatively trouble-free implementation. Also, there is a small computational difference: In ApEn, the comparison between the template vector (see below) and the rest of the vectors also includes comparison with itself. This guarantees that probabilities are never zero. Consequently, it is always possible to take a logarithm of probabilities. Because template comparisons with itself lower ApEn values, the signals are interpreted to be more regular than they actually are. These self-matches are not included in SampEn.

There is a multiscale version of SampEn as well, suggested by Costa and others.[2]

Definition

Like approximate entropy (ApEn), Sample entropy (SampEn) is a measure of complexity.[1] But it does not include self-similar patterns as ApEn does. For a given embedding dimension , tolerance and number of data points , SampEn is the negative natural logarithm of the probability that if two sets of simultaneous data points of length have distance then two sets of simultaneous data points of length also have distance . And we represent it by (or by including sampling time ).

Now assume we have a time-series data set of length with a constant time interval . We define a template vector of length , such that and the distance function (i≠j) is to be the Chebyshev distance (but it could be any distance function, including Euclidean distance). We define the sample entropy to be

Where

= number of template vector pairs having

= number of template vector pairs having

It is clear from the definition that will always have a value smaller or equal to . Therefore, will be always either be zero or positive value. A smaller value of also indicates more self-similarity in data set or less noise.

Generally we take the value of to be and the value of to be . Where std stands for standard deviation which should be taken over a very large dataset. For instance, the r value of 6 ms is appropriate for sample entropy calculations of heart rate intervals, since this corresponds to for a very large population.

Multiscale SampEn

The definition mentioned above is a special case of multi scale sampEn with ,where is called skipping parameter. In multiscale SampEn template vectors are defined with a certain interval between its elements, specified by the value of . And modified template vector is defined as and sampEn can be written as And we calculate and like before.

Implementation

Sample entropy can be implemented easily in many different programming languages. Below lies a vectorized example written in python. An example written in Matlab can be found here. An example written for R can be found here.

Python

 1 import numpy as np
 2 
 3 
 4 def sampen(L, m, r):
 5     N = len(L)
 6     B = 0.0
 7     A = 0.0
 8     
 9     
10     # Split time series and save all templates of length m
11     xmi = np.array([L[i : i + m] for i in range(N - m)])
12     xmj = np.array([L[i : i + m] for i in range(N - m + 1)])
13 
14     # Save all matches minus the self-match, compute B
15     B = np.sum([np.sum(np.abs(xmii - xmj).max(axis=1) <= r) - 1 for xmii in xmi])
16 
17     # Similar for computing A
18     m += 1
19     xm = np.array([L[i : i + m] for i in range(N - m + 1)])
20 
21     A = np.sum([np.sum(np.abs(xmi - xm).max(axis=1) <= r) - 1 for xmi in xm])
22 
23     # Return SampEn
24     return -np.log(A / B)
gollark: Oops.
gollark: --tel call MatsWidenBacon
gollark: Oops?
gollark: --tel call MatsWidenBacon
gollark: --tell call MatsWidenBacon

References

  1. Richman, JS; Moorman, JR (2000). "Physiological time-series analysis using approximate entropy and sample entropy". American Journal of Physiology. Heart and Circulatory Physiology. 278 (6): H2039–49. doi:10.1152/ajpheart.2000.278.6.H2039. PMID 10843903.
  2. Costa, Madalena; Goldberger, Ary; Peng, C.-K. (2005). "Multiscale entropy analysis of biological signals". Physical Review E. 71 (2): 021906. doi:10.1103/PhysRevE.71.021906. PMID 15783351.
This article is issued from Wikipedia. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.