Example 1: Sample Entropy

Import a signal of normally distributed random numbers [mean = 0; SD = 1], and calculate the sample entropy for each embedding dimension (m) from 0 to 4.

X = ExampleData("gaussian");
Samp, _ = SampEn(X, m = 4);
5-element Array{Float64,1}:
 2.178923612371957
 2.175742327787873
 2.181969567351662
 2.2209839754321417
 2.1755667174542923

Select the last value to get the sample entropy for m = 4.

Samp[end]
2.1755667174542923

Calculate the sample entropy for each embedding dimension (m) from 0 to 4 with a time delay (tau) of 2 samples.

Samp, Phi1, Phi2 = SampEn(X, m = 4, tau = 2)
([2.178923612371957, 2.183323250654987, 2.188041075511569, 2.189184333017654, 2.1440802180581136], [1.414258e6, 159224.0, 17843.0, 1998.0, 234.0], [1.24975e7, 1.413233e6, 159119.0, 17838.0, 1997.0])