Approximate Entropy (ApEn)

The new PhysioNet website is available at: https://physionet.org. We welcome your feedback.
George B. Moody

This description originally appeared in slightly modified form, and without the example, in Ho, Moody, Peng, et al. [4].

$ApEn$ is a ``regularity statistic'' that quantifies the unpredictability of fluctuations in a time series such as an instantaneous heart rate time series, $HR(i)$. Intuitively, one may reason that the presence of repetitive patterns of fluctuation in a time series renders it more predictable than a time series in which such patterns are absent. $ApEn$ reflects the likelihood that ``similar'' patterns of observations will not be followed by additional ``similar'' observations. A time series containing many repetitive patterns has a relatively small $ApEn$; a less predictable (i.e., more complex) process has a higher $ApEn$.

The algorithm for computing $ApEn$ has been published elsewhere [1-4]. Here, we provide a brief summary of the calculations, as applied to a time series of heart rate measurements, $HR(i)$. Given a sequence $S_N$, consisting of $N$ instantaneous heart rate measurements $HR(1)$, $HR(2)$, $\cdots$, $HR(N)$, we must choose values for two input parameters, $m$ and $r$, to compute the approximate entropy, $ApEn({S_N},m,r)$, of the sequence. The second of these parameters, $m$, specifies the pattern length, and the third, $r$, defines the criterion of similarity. We denote a subsequence (or pattern) of $m$ heart rate measurements, beginning at measurement $i$ within $S_N$, by the vector $p_m(i)$. Two patterns, $p_m(i)$ and $p_m(j)$, are similar if the difference between any pair of corresponding measurements in the patterns is less than $r$, i.e., if


\begin{displaymath}
\vert HR(i+k)-HR(j+k)\vert < r\mathrm{~for~} 0 \leq k < m
\end{displaymath}

Now consider the set $P_m$ of all patterns of length $m$ [i.e., $p_m(1),
p_m(2), \cdots, p_m(N-m+1)$], within $S_N$. We may now define


\begin{displaymath}
C_{im}(r) = \frac{n_{im}(r)}{N-m+1}
\end{displaymath}

where $n_{im}(r)$ is the number of patterns in $P_m$ that are similar to $p_m(i)$ (given the similarity criterion $r$). The quantity $C_{im}(r)$ is the fraction of patterns of length $m$ that resemble the pattern of the same length that begins at interval $i$. We can calculate $C_{im}(r)$ for each pattern in $P_m$, and we define $C_m(r)$ as the mean of these $C_{im}(r)$ values. The quantity $C_m(r)$ expresses the prevalence of repetitive patterns of length $m$ in $S_N$. Finally, we define the approximate entropy of $S_N$, for patterns of length $m$ and similarity criterion $r$, as


\begin{displaymath}
ApEn({S_N},m,r)=\ln \left[ \frac{C_m(r)}{C_{m+1}(r)} \right]
\end{displaymath}

i.e., as the natural logarithm of the relative prevalence of repetitive patterns of length $m$ compared with those of length $m + 1$.

Thus, if we find similar patterns in a heart rate time series, $ApEn$ estimates the logarithmic likelihood that the next intervals after each of the patterns will differ (i.e., that the similarity of the patterns is mere coincidence and lacks predictive value). Smaller values of $ApEn$ imply a greater likelihood that similar patterns of measurements will be followed by additional similar measurements. If the time series is highly irregular, the occurrence of similar patterns will not be predictive for the following measurements, and $ApEn$ will be relatively large.

It should be noted that $ApEn$ has significant weaknesses, notably its strong dependence on sequence length and its poor self-consistency (i.e., the observation that $ApEn$ for one data set is larger than $ApEn$ for another for a given choice of $m$ and $r$ should, but does not, hold true for other choices of $m$ and $r$). For an excellent review of the shortcomings of $ApEn$ and the strengths of alternative statistics, see reference [5].


Example:

Example time series

An example may help to clarify the process of calculating $ApEn$. Suppose that $N = 50$, and that the sequence $S_N$ consists of 50 samples of the function illustrated above:


\begin{displaymath}
S_N = \left\{ 61, 62, 63, 64, 65, 61, 62, 63, 64, 65, 61, ... , 65 \right\}
\end{displaymath}

(i.e., the sequence is periodic with a period of 5). Let's choose $m = 5$ (this choice simplifies the calculations for this example, but similar results would be obtained for other nearby values of $m$) and $r = 2$ (again, the value of $r$ can be varied somewhat without affecting the result). This gives us:


\begin{displaymath}
\begin{array}{c}
p_5(1) = \left\{ 61, 62, 63, 64, 65 \right\...
...\} \\
p_5(3) = \left\{ 63, 64, 65, 61, 62 \right\}
\end{array}\end{displaymath}

and so on. The first question to be answered is: how many of the $p_5(i)$ are similar to $p_5(1)$? Since we have chosen $r = 2$ as the similarity criterion, this means that each of the 5 components of $p_5(i)$ must be within $\pm 2$ units of the corresponding component of $p_1(i)$. Thus, for example, $p_5(2)$ is not similar to $p_5(1)$, since their last components (61 and 65) differ by more than 2 units. The conditions for similarity to $p_5(1)$ will be satisfied only by $p_5(6)$, $p_5(11)$, $p_5(16)$, $p_5(21)$, ..., $p_5(46)$, as well as by $p_5(1)$ itself [i.e., for 10 of the $p_5(i)$], so we have


\begin{displaymath}
n_{1,5}(2) = 10
\end{displaymath}

Since the total number of $p_5(i)$ is $N - m + 1 = 50 - 5 + 1 = 46$,


\begin{displaymath}
C_{1,5}(2) = \frac{10}{46}
\end{displaymath}

We can now repeat the above steps to determine how many of the $p_5(i)$ are similar to $p_5(2)$, $p_5(3)$, etc. By the same reasoning, $p_5(2)$ is similar to $p_5(7)$, $p_5(12)$, $p_5(17)$, ..., $p_5(41)$, so that


\begin{displaymath}
n_{2,5}(2) = 9
\end{displaymath}

and in general


\begin{displaymath}
n_{i,5}(2) = \left\{ \begin{array}{rl}
10 & \mbox{if i = 1 modulo 5} \\
9 & \mbox{otherwise}
\end{array} \right.
\end{displaymath}

(This last statement is true only for the particular example we are considering, since we have specified a sequence with a period of 5, and we have chosen m = 5 as well.)

Hence $C_{i,5}(2)$ is either $\frac{10}{46}$ or $\frac{9}{46}$, depending on $n_{i,5}(2)$, and the mean value of all 46 of the $C_{i,5}(2)$ is:


\begin{displaymath}
C_5(2) = \frac{10 \cdot \frac{10}{46} + 36 \cdot \frac{9}{46}}{46} =
\frac{424}{2116} \approx 0.200378
\end{displaymath}

In order to obtain $ApEn(S_N,5,2)$, we need to repeat all of the calculations above for $m = 6$. Doing so, we obtain:


\begin{displaymath}
\begin{array}{c}
n_{1,6}(2) = 9 \\
n_{2,6}(2) = 9 \\
n_{3,6}(2) = 9 \\
...
\end{array}\end{displaymath}

so that


\begin{displaymath}
C_{i,6}(2) = \frac{9}{45} = 0.2, 1 \leq i \leq 45
\end{displaymath}

and $C_6(2) = 0.2$. Finally, we calculate that


\begin{displaymath}
Apen(S_N,2,5) = \ln \left[ \frac{C_5(2)}{C_{6}(2)} \right] \approx 0.00189
\end{displaymath}

This is a very small value of ApEn, which suggests that the original time series is highly predictable (as indeed it is).

ApEn Software

In view of the weaknesses in ApEn, and in deference to the wishes of SM Pincus, we do not provide an implementation of ApEn here. This description is provided here so that researchers who wish to use ApEn can write their own code for doing so.

An ApEn implementation in Matlab m-code is included in Danny Kaplan's Software for Heart Rate Variability.


References:

1. Pincus SM. Approximate entropy as a measure of system complexity. Proc Natl Acad Sci USA 1991;88:2297-2301.

2. Pincus SM, Goldberger AL. Physiological time-series analysis: What does regularity quantify? Am J Physiol 1994;266(Heart Circ Physiol):H1643-H1656.

3. Ryan SM, Goldberger AL, Pincus SM, Mietus J, Lipsitz LA. Gender and age-related differences in heart rate dynamics: Are women more complex than men? J Am Coll Cardiol 1994;24:1700-1707.

4. Ho KKL, Moody GB, Peng CK, Mietus JE, Larson MG, Levy D, Goldberger AL. Predicting survival in heart failure case and control subjects by use of fully automated methods for deriving nonlinear and conventional indices of heart rate dynamics. Circulation 1997 (August);96(3):842-848.

5. Richman JS, Moorman JR. Physiological time-series analysis using approximate entropy and sample entropy. Am J Physiol Heart Circ Physiol 278(6):H2039-H2049 (2000).

Questions and Comments

If you would like help understanding, using, or downloading content, please see our Frequently Asked Questions.

If you have any comments, feedback, or particular questions regarding this page, please send them to the webmaster.

Comments and issues can also be raised on PhysioNet's GitHub page.

Updated Thursday, 09-Jul-2015 17:08:43 CEST

PhysioNet is supported by the National Institute of General Medical Sciences (NIGMS) and the National Institute of Biomedical Imaging and Bioengineering (NIBIB) under NIH grant number 2R01GM104987-09.