Approximate Entropy (ApEn)

$ApEn$ is a ``regularity statistic'' that quantifies the unpredictability of fluctuations in a time series$HR(i)$.  Given a sequence $S_N$$HR(1)$$HR(2)$$\cdots$$HR(N)$, pattern length $m$ and criterion of similarity $r$,  we calculate$ApEn({S_N},m,r)$as follows. We denote a subsequence (or pattern) of $m$ 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}

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 

< \end{displaymath} -->\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, $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.