# Multiscale Cross-Entropies

*Functions for estimating the multiscale entropy between two univariate time series.*

Just as one can calculate multiscale entropy using any Base entropy, the same functionality is possible with multiscale cross-entropy using any Cross-entropy function: (`XApEn`

, `XSampEn`

, `XK2En`

, `XCondEn`

, `XPermEn`

, `XSpecEn`

, `XDistEn`

, `XFuzzEn`

).

To do so, we again use the `MSobject`

function to pass a multiscale object (`Mobj`

) to the multiscale cross-entropy functions.

Multiscale cross-entropy functions have two positional arguments:

- the time series signals,
`Sig`

(an Nx2 matrix), - the multiscale entropy object,
`Mobj`

.

For cross-entropy and multiscale cross-entropy functions, the two time series signals are passed as a two-column or two-row matrix. At present, it is not possible to pass signals of different lengths separately.

The following functions use the multiscale entropy object shown above.

`EntropyHub._XMSEn.XMSEn`

— Function`MSx, CI = XMSEn(Sig, Mobj)`

Returns a vector of multiscale cross-entropy values `MSx`

and the complexity index `CI`

between the data sequences contained in `Sig`

using the parameters specified by the multiscale object `Mobj`

over 3 temporal scales with coarse- graining `default`

.

```
MSx,CI = MSEn(Sig::AbstractArray{T,2} where T<:Real, Mobj::NamedTuple;
Scales::Int=3, Methodx::String="coarse", RadNew::Int=0, Plotx::Bool=false)
```

Returns a vector of multiscale cross-entropy values `MSx`

and the complexity index `CI`

of the data sequences contained in `Sig`

using the parameters specified by the multiscale object `Mobj`

and the following 'keyword' arguments:

**Arguments:**

`Scales`

- Number of temporal scales, an integer > 1 (default: 3)

`Method`

- Graining method, one of the following:

```
{`"coarse", "modified", "imf", "timeshift"`} [default: 'coarse']
For further info on graining procedures, see the Entropyhub guide.
```

`RadNew`

- Radius rescaling method, an integer in the range [1 4]. When the entropy specified by `Mobj`

is `SampEn`

or `ApEn`

, `RadNew`

allows the radius threshold to be updated at each time scale (Xt). If a radius value is specified by `Mobj`

(`r`

), this becomes the rescaling coefficient, otherwise it is set to 0.2 (default). The value of `RadNew`

specifies one of the following methods:

```
[1] Standard Deviation - r*std(Xt)
[2] Variance - r*var(Xt)
[3] Mean Absolute Deviation - r*mean_ad(Xt)
[4] Median Absolute Deviation - r*med_ad(Xt)
```

`Plotx`

- When `Plotx`

== true, returns a plot of the entropy value at each time scale (i.e. the multiscale entropy curve) [default: false]

`For further info on these graining procedures see the EntropyHub guide.`

**See also MSobject, MSEn, cXMSEn, rXMSEn, hXMSEn, XSampEn, XApEn, XFuzzEn**

**References:**

```
[1] Rui Yan, Zhuo Yang, and Tao Zhang,
"Multiscale cross entropy: a novel algorithm for analyzing two
time series."
5th International Conference on Natural Computation.
Vol. 1, pp: 411-413 IEEE, 2009.
[2] Madalena Costa, Ary Goldberger, and C-K. Peng,
"Multiscale entropy analysis of complex physiologic time series."
Physical review letters
89.6 (2002): 068102.
[3] Vadim V. Nikulin, and Tom Brismar,
"Comment on “Multiscale entropy analysis of complex physiologic
time series”."
Physical review letters
92.8 (2004): 089803.
[4] Madalena Costa, Ary L. Goldberger, and C-K. Peng.
"Costa, Goldberger, and Peng reply."
Physical Review Letters
92.8 (2004): 089804.
[5] Antoine Jamin, et al,
"A novel multiscale cross-entropy method applied to navigation
data acquired with a bike simulator."
41st annual international conference of the IEEE EMBC
IEEE, 2019.
[6] Antoine Jamin and Anne Humeau-Heurtier.
"(Multiscale) Cross-Entropy Methods: A Review."
Entropy
22.1 (2020): 45.
```

`EntropyHub._cXMSEn.cXMSEn`

— Function`MSx, CI = cXMSEn(Sig, Mobj)`

Returns a vector of composite multiscale cross-entropy values (`MSx`

) between two univariate data sequences contained in `Sig`

using the parameters specified by the multiscale object (`Mobj`

) using the composite multiscale method (cMSE) over 3 temporal scales.

```
MSx, CI = cXMSEn(Sig::AbstractArray{T,2} where T<:Real, Mobj::NamedTuple;
Scales::Int=3, RadNew::Int=0, Refined::Bool=false, Plotx::Bool=false)
```

Returns a vector of composite multiscale cross-entropy values (`MSx`

) between the data sequences contained in `Sig`

using the parameters specified by the multiscale object (`Mobj`

) and the following keyword arguments:

**Arguments:**

`Scales`

- Number of temporal scales, an integer > 1 (default: 3)

`RadNew`

- Radius rescaling method, an integer in the range [1 4]. When the entropy specified by Mobj is `XSampEn`

or `XApEn`

, RadNew rescales the radius threshold of the sub-sequences at each time scale (Ykj). If a radius value is specified by `Mobj`

(`r`

), this becomes the rescaling coefficient, otherwise it is set to 0.2 (default). The value of RadNew specifies one of the following methods:

```
[1] Standard Deviation - r*std(Ykj)
[2] Variance - r*var(Ykj)
[3] Mean Absolute Deviation - r*mean_ad(Ykj)
[4] Median Absolute Deviation - r*med_ad(Ykj,1)
```

`Refined`

- Refined-composite XMSEn method. When `Refined`

== true and the entropy function specified by `Mobj`

is 'XSampEn', cXMSEn returns the refined-composite multiscale entropy (rcXMSEn). (default: false) `Plotx`

- When `Plotx`

== true, returns a plot of the entropy value at each time scale (i.e. the multiscale entropy curve) [default: false]

**See also MSobject, XMSEn, rXMSEn, hXMSEn, XSampEn, XApEn, cMSEn**

**References:**

```
[1] Rui Yan, Zhuo Yang, and Tao Zhang,
"Multiscale cross entropy: a novel algorithm for analyzing two
time series."
5th International Conference on Natural Computation.
Vol. 1, pp: 411-413 IEEE, 2009.
[2] Yi Yin, Pengjian Shang, and Guochen Feng,
"Modified multiscale cross-sample entropy for complex time
series."
Applied Mathematics and Computation
289 (2016): 98-110.
[3] Madalena Costa, Ary Goldberger, and C-K. Peng,
"Multiscale entropy analysis of complex physiologic time series."
Physical review letters
89.6 (2002): 068102.
[4] Antoine Jamin, et al,
"A novel multiscale cross-entropy method applied to navigation
data acquired with a bike simulator."
41st annual international conference of the IEEE EMBC
IEEE, 2019.
[5] Antoine Jamin and Anne Humeau-Heurtier.
"(Multiscale) Cross-Entropy Methods: A Review."
Entropy
22.1 (2020): 45.
[6] Shuen-De Wu, et al.,
"Time series analysis using composite multiscale entropy."
Entropy
15.3 (2013): 1069-1084.
```

`EntropyHub._rXMSEn.rXMSEn`

— Function`MSx, CI = rXMSEn(Sig, Mobj)`

Returns a vector of refined multiscale cross-entropy values (`MSx`

) and the complexity index (`CI`

) between the data sequences contained in `Sig`

using the parameters specified by the multiscale object (`Mobj`

) and the following default parameters: Scales = 3, Butterworth LPF Order = 6, Butterworth LPF cutoff frequency at scale (T): Fc = 0.5/T. If the entropy function specified by `Mobj`

is `XSampEn`

or `XApEn`

, `rMSEn`

updates the threshold radius of the data sequences (Xt) at each scale to 0.2std(Xt) when no `r`

value is provided by `Mobj`

, or r.std(Xt) if `r`

is specified.

```
MSx, CI = rXMSEn(Sig::AbstractArray{T,2} where T<:Real, Mobj::NamedTuple; Scales::Int=3,
F_Order::Int=6, F_Num::Float64=0.5, RadNew::Int=0, Plotx::Bool=false)
```

Returns a vector of refined multiscale cross-entropy values (`MSx`

) and the complexity index (`CI`

) between the data sequences contained in `Sig`

using the parameters specified by the multiscale object (`Mobj`

) and the following keyword arguments:

**Arguments:**

`Scales`

- Number of temporal scales, an integer > 1 (default: 3)

`F_Order`

- Butterworth low-pass filter order, a positive integer (default: 6)

`F_Num`

- Numerator of Butterworth low-pass filter cutoff frequency, a scalar value in range [0 < `F_Num`

< 1]. The cutoff frequency at each scale (T) becomes: Fc = `F_Num`

/T. (default: 0.5)

`RadNew`

- Radius rescaling method, an integer in the range [1 4]. When the entropy specified by `Mobj`

is `XSampEn`

or `XApEn`

, `RadNew`

allows the radius threshold to be updated at each time scale (Xt). If a radius value is specified by `Mobj`

(`r`

), this becomes the rescaling coefficient, otherwise it is set to 0.2 (default). The value of `RadNew`

specifies one of the following methods:

```
[1] Standard Deviation - r*std(Xt) (default)
[2] Variance - r*var(Xt)
[3] Mean Absolute Deviation - r*mean_ad(Xt)
[4] Median Absolute Deviation - r*med_ad(Xt,1)
```

`Plotx`

- When `Plotx`

== true, returns a plot of the entropy value at each time scale (i.e. the multiscale entropy curve) [default = false]

**See also MSobject, XMSEn, cXMSEn, hXMSEn, XSampEn, XApEn, MSEn**

**References:**

```
[1] Matthew W. Flood,
"rXMSEn - EntropyHub Project"
2021, https://github.com/MattWillFlood/EntropyHub
[2] Rui Yan, Zhuo Yang, and Tao Zhang,
"Multiscale cross entropy: a novel algorithm for analyzing two
time series."
5th International Conference on Natural Computation.
Vol. 1, pp: 411-413 IEEE, 2009.
[3] José Fernando Valencia, et al.,
"Refined multiscale entropy: Application to 24-h holter
recordings of heart period variability in healthy and aortic
stenosis subjects."
IEEE Transactions on Biomedical Engineering
56.9 (2009): 2202-2213.
[4] Puneeta Marwaha and Ramesh Kumar Sunkaria,
"Optimal selection of threshold value ‘r’for refined multiscale
entropy."
Cardiovascular engineering and technology
6.4 (2015): 557-576.
[5] Yi Yin, Pengjian Shang, and Guochen Feng,
"Modified multiscale cross-sample entropy for complex time
series."
Applied Mathematics and Computation
289 (2016): 98-110.
[6] Antoine Jamin, et al,
"A novel multiscale cross-entropy method applied to navigation
data acquired with a bike simulator."
41st annual international conference of the IEEE EMBC
IEEE, 2019.
[7] Antoine Jamin and Anne Humeau-Heurtier.
"(Multiscale) Cross-Entropy Methods: A Review."
Entropy
22.1 (2020): 45.
```

`EntropyHub._hXMSEn.hXMSEn`

— Function`MSx, Sn, CI = hXMSEn(Sig, Mobj)`

Returns a vector of cross-entropy values (`MSx`

) calculated at each node in the hierarchical tree, the average cross-entropy value across all nodes at each scale (`Sn`

), and the complexity index (`CI`

) of the hierarchical tree (i.e. sum(`Sn`

)) between the data sequences contained in `Sig`

using the parameters specified by the multiscale object (`Mobj`

) over 3 temporal scales (default). The entropy values in `MSx`

are ordered from the root node (S.00) to the Nth subnode at scale T (S.TN): i.e. S.00, S.10, S.11, S.20, S.21, S.22, S.23, S.30, S.31, S.32, S.33, S.34, S.35, S.36, S.37, S.40, ... , S.TN. The average cross-entropy values in Sn are ordered in the same way, with the value of the root node given first: i.e. S0, S1, S2, ..., ST

```
MSx, Sn, CI = hXMSEn(Sig::AbstractArray{T,2} where T<:Real, Mobj::NamedTuple;
Scales::Int=3, RadNew::Int=0, Plotx::Bool=false)
```

Returns a vector of cross-entropy values (`MSx`

) calculated at each node in the hierarchical tree, the average cross-entropy value across all nodes at each scale (`Sn`

), and the complexity index (`CI`

) of the entire hierarchical tree between the data sequences contained in `Sig`

using the following name/value pair arguments:

**Arguments:**

`Scales`

- Number of temporal scales, an integer > 1 (default: 3) At each scale (T), entropy is estimated for 2^(T-1) nodes.

`RadNew`

- Radius rescaling method, an integer in the range [1 4]. When the entropy specified by `Mobj`

is `XSampEn`

or `XApEn`

, `RadNew`

allows the radius threshold to be updated at each node in the tree. If a radius value is specified by `Mobj`

(`r`

), this becomes the rescaling coefficient, otherwise it is set to 0.2 (default). The value of `RadNew`

specifies one of the following methods:

```
[1] Standard Deviation - r*std(Xt)
[2] Variance - r*var(Xt)
[3] Mean Absolute Deviation - r*mean_ad(Xt)
[4] Median Absolute Deviation - r*med_ad(Xt,1)
```

`Plotx`

- When `Plotx`

== true, returns a plot of the average cross-entropy value at each time scale (i.e. the multiscale entropy curve) and a hierarchical graph showing the entropy value of each node in the hierarchical tree decomposition. (default: false)

**See also MSobject, XMSEn, rXMSEn, cXMSEn, XSampEn, XApEn, hMSEn**

**References:**

```
[1] Matthew W. Flood,
"hXMSEn - EntropyHub Project"
2021, https://github.com/MattWillFlood/EntropyHub
[2] Rui Yan, Zhuo Yang, and Tao Zhang,
"Multiscale cross entropy: a novel algorithm for analyzing two
time series."
5th International Conference on Natural Computation.
Vol. 1, pp: 411-413 IEEE, 2009.
[3] Ying Jiang, C-K. Peng and Yuesheng Xu,
"Hierarchical entropy analysis for biological signals."
Journal of Computational and Applied Mathematics
236.5 (2011): 728-742.
```