# Sample entropy

**Sample entropy** (SampEn) is a modification of approximate entropy (ApEn), used extensively for assessing the complexity of a physiological time-series signal, thereby diagnosing diseased state.^{[1]} Unlike ApEn, SampEn shows good traits such as data length independence and trouble-free implementation.

There is a multiscale version of SampEn as well, suggested by Costa and others.^{[2]}

## Definition

Like approximate entropy (ApEn), **Sample entropy** (**SampEn**) is a measure of complexity [1]. But it does not include self-similar patterns as ApEn does. For a given embedding dimension , toleranceTemplate:Dn and number of data points , SampEn is the negative logarithm of the probability that if two sets of simultaneous data points of length have distance then two sets of simultaneous data points of length also have distance . And we represent it by (or by including sampling time ).

Now assume we have a time-series data set of length with a constant time interval . We define a template vector of length m, such that and the distance function (i≠j) is to be the Chebyshev distance (but it could be any distance function, including Euclidean distance). We count the number of vector pairs in template vectors of length and having and denote it by and respectively. We define the sample entropy to be

Where,

= no of template vector pairs having of length

= no of template vector pairs having of length

It is clear from the definition that will always have smaller value than , so the value of will be always positive. A smaller value of also indicates more self-similarity in data set or less noise.

Generally we take the value of to be and the value of to be . Where std stands for standard deviation.

## Multiscale SampEn

The definition mentioned above is a special case of multi scale sampEn with ,where is called skipping parameter.In multiscale SampEn we define template vectors with a certain interval between its each element specified by the value of we are using. And we define our modified template vector as and sampEn can be written as And we calculate and like before.And here also we use the value of to be and to be

## Implementation

The SampEn can be implemented easily in many different programming language. One example among MatLab versions can be found here.