Function Repository Resource:

SampleEntropy

Source Notebook

Compute the sample entropy of a time series

Contributed by: Jessica Alfonsi (Padova, Italy)

ResourceFunction["SampleEntropy"][timeseries,emdim,rfilt]

computes the sample entropy of the timeseries with embedding dimension emdim and filtering factor rfilt.

Details

Sample entropy (SampEn) was introduced as a modification of the conceptually similar approximate entropy (ApEn) to quantify the complexity and the unpredictability of fluctuations in a time series, especially in the domain of physiological time series like electroencephalograms (EEGs) for investigating brain signals and electrocardiogram (ECGs or EKGs) for diagnosing heart diseases. SampEn has two additional advantages over ApEn: input data length independence and self-matching is ignored.
A low value of SampEn indicates that the time series timeseries is deterministic, whereas a high value indicates randomness and chaotic behaviour.
The default value for the embedding dimension emdim is set as input argument but it is frequently set to 2 in applications.
The value usually suggested for the filter factor rfilt is 0.2 times the standard deviation of the input series and is set as an input argument to the function.
The delay time τ for subsampling is set to 1 as a default optional argument.

Examples

Basic Examples (1) 

Show the sample entropy of a time series from a uniform distribution of real numbers:

In[1]:=
SeedRandom[42];
rndmts = RandomReal[1, 1000];
ResourceFunction["SampleEntropy"][rndmts, 2, 0.2*StandardDeviation[rndmts]]
Out[3]=

Scope (6) 

Set up a nonlinear time series in the periodic regime for the logistic map:

In[4]:=
lmaptsper = Drop[N@RecurrenceTable[{x[t + 1] == 3.5*x[t] (1 - x[t]), x[0] == 0.1`2800}, x[t], {t, 4501}], 501];

Show it:

In[5]:=
ListLinePlot[Take[lmaptsper, 100], Mesh -> All, MeshStyle -> AbsolutePointSize[3], PlotStyle -> {Darker[Blue, 0.17], AbsoluteThickness[1]}, PlotRange -> {Full, {0, 1}}, PlotLabel -> "Periodic regime \[Lambda] = 3.5"]
Out[5]=

Verify the SampleEntropy of the periodic time series is zero:

In[6]:=
m = 2;
r = 0.2*StandardDeviation[lmaptsper];
ResourceFunction["SampleEntropy"][lmaptsper, m, r]
Out[8]=

Change the λ parameter in the logistic map model to set up a chaotic time series:

In[9]:=
lmaptschaos = Drop[N@RecurrenceTable[{x[t + 1] == 4.0*x[t] (1 - x[t]), x[0] == 0.1`2800}, x[t], {t, 4501}], 501];

Show it:

In[10]:=
ListLinePlot[Take[lmaptschaos, 100], Mesh -> All, MeshStyle -> AbsolutePointSize[3], PlotStyle -> {Darker[Red, 0.13], AbsoluteThickness[1]}, PlotRange -> {Full, {0, 1}}, PlotLabel -> "Chaotic regime \[Lambda] = 4 "]
Out[10]=

Verify the SampleEntropy of the nonlinear chaotic time series is nonzero:

In[11]:=
m = 2;
r = 0.2*StandardDeviation[lmaptschaos];
In[12]:=
ResourceFunction["SampleEntropy"][lmaptschaos, m, r]
Out[12]=

Options (1) 

Show the sample entropy of a time series from a uniform distribution of real numbers with the delay set to τ = 2:

In[13]:=
SeedRandom[42];
rndmts = RandomReal[1, 1000]; ResourceFunction[
 "SampleEntropy"][rndmts, 2, 0.2*StandardDeviation[rndmts], 2]
Out[14]=

Applications (1) 

Show the sample entropy results computed for two ECG signals taken from Wolfram Documentation:

In[15]:=
ecg1 = TemporalData[
    TimeSeries, {CompressedData[
      "\n1:eJwl1wk0VO//B3BJZSkktEklZWklW8igDdkSUSlkS6JsWVKypFBkKYpKWrRQ\nlCVL3pLs+26Yca9dqaQIlf7P9/d3jvM5M889M3Of87qf5/1Ze+KMiT0nBwfH\nHPI/MpeD487t//46ERrw/7VR+P9rk3nC/+qdZ9f/V4/u1Uj4r1YJCN38rw7O\n47nxX21IfXfxf9cPG274rz4PWncgntSnydkpN0j9+snr5zlSpZ/lKYiQ6qpX\ne744vhM83FYvw2M7kXl0mPvclU4E209yap/sRHLf8f6u1Z3YkRa83j6sA16c\nB60V3duxw0rcuP9xK75ZcunYczdjm6eWb8GZelgd4RTV21eBjLTwrWVzSyC8\nMVM/x6kQTw/YMaL7C8BZ7WKmbP0epS8enLS/Ww5jMZ7v99bXo/b8/HWGys0o\n4VNf4qrcBuWp3X/kr3ZgQmpnp8uKLohHRpjWMXugerbkPZ3bizt6C1+zt9NY\nMeY+7c1Vjo4nFUGB7C7G6nCH3puZwwwN+fa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/Vl4q/XveZoI9nPp/LL88OIv1uT+V/uE3/79pVKGBJ/z0ti\nA58Sf08upBmaE398njuEIom//wPA8bVT\n"], {{0, 10, Rational[1, 100]}}, 1, {"Continuous", 1}, {"Discrete", 1}, 1, {ResamplingMethod -> {"Interpolation", InterpolationOrder -> 1}}}, False, 10.2]["Values"];
ecg2 = TemporalData[
    TimeSeries, {CompressedData[
      "\n1:eJwllwk0Ve3/xTPmrYgiyhAaREVoUOEi4Y0GGqQoRBFNKIrQJKkUIUpSIkUZ\nkihsZBYuLtd1h3NM0WxIRdL/eX//u9Zd33XPOuusc59nP/uzt5rrMTt34SlT\npgiR7weRKVPuJPz34YAl8//TpS/uf9Nq+q3/TZMEif9NA4XfYf/NUbFVe/+b\n/q75cv9NxY9s/3gyVzcb3Ykh09yhNDqIzF1qq1SmkTnHgSUtf5uD8OpVVwtu\nkOeHjGol+ZP7jR49/aHPQZ/CpeDKqA7E80wHz1uy4cuYu+OkTBumDC92dfjS\njLKGK7a7nr9DRkibhMKtKuTsz9SrffkWlcnxn9ZbVuLoS1O9rqI6cO00njXO\nakad5Uw5lTQWEvaL0+aH2RARC/UMf87B3x+KVzan82FY87eNkdYFWTFXxQuh\nApSKXly9QP4W/v4K83aT6WKIf5oSuTGHzRgL5x3UXdmCmKqJqZ+u9KJ7xvRy\nyZ09uKCNfXr7BFgU903QOtaJ4Ny6v4UCDo4u/vX2YWEHGsRchhtl2Xh0SPx4\nbDsLIgGN4tSfZhxo/vl5cmsDlloYP1+2rAoeV49RnNQSrPjwbEx7xwtI6Oot\nHNVJxzaBtrD/1keQ3qtrXdiegYWh05g3BPnIv6V/LIBThoFKU5v3trUQnLvZ\nmebPRN9hkcHfP1uRdSSo89PHdgzdP+GvtpqD6rJUzTZ+J66vXrihb4wLk6wf\nSyOf8qCTsWk0byYf7ZYX7w5s4CPJNPzoiz18+JnE7JV24WNWQeF1wT4+Qm9O\nr3xjz0d0zzsh/S18MDNEfcvN+VjzfaXc4fV8aMbuPaGp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oVYW6WxzVVfllyC5v6bB7WozvHWMXpp4o\nhluR9uoC7zI0P/PKr42ogmh+721nuwasPfqL6+bdgt3lCe8bVdphwdtg3+PJ\nQdY+g9c/5/EgF7Fdf0BdgKHep/nM6xSkupxRRvjByHP47Et6g9IhWb4RyQu3\nD3dlmJJ8ubPh71wVoouJt12tToQnnSMRI5YZND5FKe39TvghrxPzc0U8yRXj\nQRfDCD8WPvuZ+p3wQ0i5WyOQ9JniHKnWuT40Kr/csmASfqSZKUYmEX4kzG+T\nuED8SUZ7LDRgM8mhjDkbDpvTiJ8fHzdG+DHm0Mpv/Y8fUx8EfSD8+FJ9Rbj7\nNwULz8fXrx6jcNFwuZDVTgHk1DbzF7jyYJR48LLhKQ7+jK15p0R4fG6T75E1\nvi34oJKvOX0bE+NJWRMipIf0st5bb3VtwZoN22bKt7WhcEGwQCmEg/AHcrnL\nzvEQeV/rmXqxAKz0o21XCD9uwur82sIePH76ZXcl4UfwVlmhUcIPafmuvZuT\nWhlMy7Uv/w5wGYLy+23XFSqQnSZ/QkD4sSvjQcQ7wo+Ap15BLwk/hKoyFr0h\n/EhvU5Vc4kJB1MAsMo/w483zrpLH1Tx4Zs0Y/EH4EZ/78uyuP2z8DUvpmQYW\nDPdmTmosbYb6N++ZT/TqUcux9SsbqoCw4lb7F/6lWLHMvFz+exE+j5je0XlU\ngslwq9GPveXQ9kmifJ/U4LWGRaphfRPUFi/0fEv4UU/n2mYSfmwd6pdd69qJ\nKT+GS4W5PHjH3NYzzhSgXfDsR8QAhSjRe6LG9jQCm9nVhwg/NpzVb1Ug++5c\nRkVuJNx4fDfh2HEyPx1kUDaEH2dFmJ6RhB//B6JZ5o8=\n"], {{0, 10, Rational[1, 100]}}, 1, {"Continuous", 1}, {"Discrete", 1}, 1, {ResamplingMethod -> {"Interpolation", InterpolationOrder -> 1}}}, False, 10.2]["Values"];
ListLinePlot[{ecg1, ecg2}, PlotRange -> Full, AxesLabel -> {"time (s)", "voltage (mV)"}, DataRange -> {0, 10}, ImageSize -> 400]
Out[16]=
In[17]:=
m = 2;
r1 = 0.2*StandardDeviation[ecg1];
r2 = 0.2*StandardDeviation[ecg2];
{ResourceFunction["SampleEntropy"][ecg1, m, r1], ResourceFunction["SampleEntropy"][ecg2, m, r2]}
Out[18]=

Properties and Relations (3) 

Sample entropy of a linearly increasing time series is zero:

In[19]:=
ts = Range[10000];
m = 2; r = 0.2*StandardDeviation[ts];
ResourceFunction["SampleEntropy"][ts, m, r]
Out[20]=

Sample entropy of a pure sine wave:

In[21]:=
data = N@Sin[2*Pi*Range[3000]/100];
m = 2; r = 0.2*StandardDeviation[data];
ResourceFunction["SampleEntropy"][data, m, r]
Out[15]=

Sample entropy of a time series sampled from a normal distribution:

In[22]:=
SeedRandom[1234567];
datanorm = RandomVariate[NormalDistribution[], 10000];
m = 2; r = 0.2*StandardDeviation[datanorm];
ResourceFunction["SampleEntropy"][datanorm, m, r]
Out[23]=

Neat Examples (1) 

Sample entropy of gaussian fractional noise with Hurst exponential H = 0.5:

In[24]:=
SeedRandom[42];
samplenoise = Flatten@RandomFunction[
     FractionalGaussianNoiseProcess[.5], {1, 10000, 1}]["ValueList"];
m = 2; r = 0.2*StandardDeviation[samplenoise];
ResourceFunction["SampleEntropy"][samplenoise, m, r]
Out[25]=

Publisher

Jessica Alfonsi

Requirements

Wolfram Language 13.0 (December 2021) or above

Version History

  • 1.0.0 – 22 July 2024

Source Metadata

Related Resources

Author Notes

More examples related to physiological applications will be probably added in future versions of the function.

License Information