entropy = apen( pre, post, r );
pre
| An embedding of data. |
post
| The images of the data in the embedding. |
r
| The filter factor, which sets the length scale over which to compute the approximate entropy. |
entropy
| The numerical value of the approximate entropy. |
The "approximate entropy" was introduced by Pincus to quantify the creation of information in a time series. A low value of the entropy indicates that the time series is deterministic; a high value indicates randomness.
The "filter factor" r
is an important parameter. In
principle, with an infinite amount of data, it should approach zero.
With finite amounts of data, or with measurement noise, it is not
always clear what is the best value to choose. Past work on heart
rate variability has suggested setting r
to be
0.2 times the standard deviation of the data.
Another important parameter is the "embedding dimension." Again, there is know precise means of knowing the best such dimension, but previous work has used a dimension of 2. The final parameter is the embedding lag, which is often set to 1, but perhaps more appropriately is set to be the smallest lag at which the autocorrelation function of the time series is close to zero.
The apen
function expects the data to be presented in
a specific format. Working with a time series tseries
,
the following steps will compute the approximate entropy, with an
embedding dimension of 2 and a lag of 1.
edim = 2; lag = 1; edata = lagembed(tseries,edim,lag); [pre,post] = getimage(edata,lag); r = 0.2*std(tseries); apen(pre,post,r);
apenhr
.
lagembed
.
getimage
.
tseries = randn(500,1);should have a large approximate entropy.
tseries = sine((1:.2:100)');should have a small approximate entropy since it is deterministic.