A comprehensive step-by-step tutorial with an explanation of the theoretical foundations of Approximate Entropy is available.10 The algorithm is:
An implementation on Physionet,11 which is based on Pincus,12 use d [ x ( i ) , x ( j ) ] < r {\displaystyle d[\mathbf {x} (i),\mathbf {x} (j)]<r} instead of d [ x ( i ) , x ( j ) ] ≤ r {\displaystyle d[\mathbf {x} (i),\mathbf {x} (j)]\leq r} in Step 4. While a concern for artificially constructed examples, it is usually not a concern in practice.
Consider a sequence of N = 51 {\displaystyle N=51} samples of heart rate equally spaced in time:
Note the sequence is periodic with a period of 3. Let's choose m = 2 {\displaystyle m=2} and r = 3 {\displaystyle r=3} (the values of m {\displaystyle m} and r {\displaystyle r} can be varied without affecting the result).
Form a sequence of vectors:
Distance is calculated repeatedly as follows. In the first calculation,
In the second calculation, note that | u ( 2 ) − u ( 3 ) | > | u ( 1 ) − u ( 2 ) | {\displaystyle |u(2)-u(3)|>|u(1)-u(2)|} , so
Similarly,
The result is a total of 17 terms x ( j ) {\displaystyle \mathbf {x} (j)} such that d [ x ( 1 ) , x ( j ) ] ≤ r {\displaystyle d[\mathbf {x} (1),\mathbf {x} (j)]\leq r} . These include x ( 1 ) , x ( 4 ) , x ( 7 ) , … , x ( 49 ) {\displaystyle \mathbf {x} (1),\mathbf {x} (4),\mathbf {x} (7),\ldots ,\mathbf {x} (49)} . In these cases, C i m ( r ) {\displaystyle C_{i}^{m}(r)} is
Note in Step 4, 1 ≤ i ≤ n {\displaystyle 1\leq i\leq n} for x ( i ) {\displaystyle \mathbf {x} (i)} . So the terms x ( j ) {\displaystyle \mathbf {x} (j)} such that d [ x ( 3 ) , x ( j ) ] ≤ r {\displaystyle d[\mathbf {x} (3),\mathbf {x} (j)]\leq r} include x ( 3 ) , x ( 6 ) , x ( 9 ) , … , x ( 48 ) {\displaystyle \mathbf {x} (3),\mathbf {x} (6),\mathbf {x} (9),\ldots ,\mathbf {x} (48)} , and the total number is 16.
At the end of these calculations, we have
Then we repeat the above steps for m = 3 {\displaystyle m=3} . First form a sequence of vectors:
By calculating distances between vector x ( i ) , x ( j ) , 1 ≤ i ≤ 49 {\displaystyle \mathbf {x} (i),\mathbf {x} (j),1\leq i\leq 49} , we find the vectors satisfying the filtering level have the following characteristic:
Therefore,
Finally,
The value is very small, so it implies the sequence is regular and predictable, which is consistent with the observation.
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.13 A time series containing many repetitive patterns has a relatively small ApEn; a less predictable process has a higher ApEn.
The advantages of ApEn include:14
The ApEn algorithm counts each sequence as matching itself to avoid the occurrence of log ( 0 ) {\displaystyle \log(0)} in the calculations. This step might introduce bias in ApEn, which causes ApEn to have two poor properties in practice:15
ApEn has been applied to classify electroencephalography (EEG) in psychiatric diseases, such as schizophrenia,16 epilepsy,17 and addiction.18
Pincus, S. M.; Gladstone, I. M.; Ehrenkranz, R. A. (1991). "A regularity statistic for medical data analysis". Journal of Clinical Monitoring and Computing. 7 (4): 335–345. doi:10.1007/BF01619355. PMID 1744678. S2CID 23455856. /w/index.php?title=Journal_of_Clinical_Monitoring_and_Computing&action=edit&redlink=1 ↩
Pincus, S. M. (1991). "Approximate entropy as a measure of system complexity". Proceedings of the National Academy of Sciences. 88 (6): 2297–2301. Bibcode:1991PNAS...88.2297P. doi:10.1073/pnas.88.6.2297. PMC 51218. PMID 11607165. https://www.ncbi.nlm.nih.gov/pmc/articles/PMC51218 ↩
Cohen, A.; Procaccia, I. (1985). "Computing the Kolmogorov entropy from time signals of dissipative and conservative dynamical systems". Physical Review A. 28 (3): 2591(R). Bibcode:1985PhRvA..31.1872C. doi:10.1103/PhysRevA.31.1872. PMID 9895695. /wiki/Physical_Review_A ↩
Pincus, S.M.; Kalman, E.K. (2004). "Irregularity, volatility, risk, and financial market time series". Proceedings of the National Academy of Sciences. 101 (38): 13709–13714. Bibcode:2004PNAS..10113709P. doi:10.1073/pnas.0405168101. PMC 518821. PMID 15358860. https://www.ncbi.nlm.nih.gov/pmc/articles/PMC518821 ↩
Pincus, S.M.; Goldberger, A.L. (1994). "Physiological time-series analysis: what does regularity quantify?". The American Journal of Physiology. 266 (4): 1643–1656. doi:10.1152/ajpheart.1994.266.4.H1643. PMID 8184944. S2CID 362684. /wiki/The_American_Journal_of_Physiology ↩
McKinley, R.A.; McIntire, L.K.; Schmidt, R; Repperger, D.W.; Caldwell, J.A. (2011). "Evaluation of Eye Metrics as a Detector of Fatigue". Human Factors. 53 (4): 403–414. doi:10.1177/0018720811411297. PMID 21901937. S2CID 109251681. /wiki/Human_Factors_(journal) ↩
Delgado-Bonal, Alfonso; Marshak, Alexander; Yang, Yuekui; Holdaway, Daniel (2020-01-22). "Analyzing changes in the complexity of climate in the last four decades using MERRA-2 radiation data". Scientific Reports. 10 (1): 922. Bibcode:2020NatSR..10..922D. doi:10.1038/s41598-020-57917-8. ISSN 2045-2322. PMC 6976651. PMID 31969616. https://www.ncbi.nlm.nih.gov/pmc/articles/PMC6976651 ↩
Delgado-Bonal, Alfonso; Marshak, Alexander (June 2019). "Approximate Entropy and Sample Entropy: A Comprehensive Tutorial". Entropy. 21 (6): 541. Bibcode:2019Entrp..21..541D. doi:10.3390/e21060541. PMC 7515030. PMID 33267255. https://www.ncbi.nlm.nih.gov/pmc/articles/PMC7515030 ↩
"PhysioNet". Archived from the original on 2012-06-18. Retrieved 2012-07-04. https://web.archive.org/web/20120618173711/http://physionet.org/physiotools/ApEn/ ↩
Ho, K. K.; Moody, G. B.; Peng, C.K.; Mietus, J. E.; Larson, M. G.; levy, D; Goldberger, A. L. (1997). "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. 96 (3): 842–848. doi:10.1161/01.cir.96.3.842. PMID 9264491. /wiki/Circulation_(journal) ↩
Richman, J.S.; Moorman, J.R. (2000). "Physiological time-series analysis using approximate entropy and sample entropy". American Journal of Physiology. Heart and Circulatory Physiology. 278 (6): 2039–2049. doi:10.1152/ajpheart.2000.278.6.H2039. PMID 10843903. S2CID 2389971. /wiki/American_Journal_of_Physiology._Heart_and_Circulatory_Physiology ↩
Sabeti, Malihe (2009). "Entropy and complexity measures for EEG signal classification of schizophrenic and control participants". Artificial Intelligence in Medicine. 47 (3): 263–274. doi:10.1016/j.artmed.2009.03.003. PMID 19403281. /wiki/Artificial_Intelligence_in_Medicine ↩
Yuan, Qi (2011). "Epileptic EEG classification based on extreme learning machine and nonlinear features". Epilepsy Research. 96 (1–2): 29–38. doi:10.1016/j.eplepsyres.2011.04.013. PMID 21616643. S2CID 41730913. /w/index.php?title=Epilepsy_Research&action=edit&redlink=1 ↩
Yun, Kyongsik (2012). "Decreased cortical complexity in methamphetamine abusers". Psychiatry Research: Neuroimaging. 201 (3): 226–32. doi:10.1016/j.pscychresns.2011.07.009. PMID 22445216. S2CID 30670300. /wiki/Psychiatry_Research:_Neuroimaging ↩