scieee Science in your language
[en] (orig)

New fast ApEn and SampEn entropy algorithms implementation and their application to supercomputer power consumption

Abstract

Approximate Entropy and especially Sample Entropy are recently frequently used algorithms for calculating the measure of complexity of a time series. A lesser known fact is that there are also accelerated modifications of these two algorithms, namely Fast Approximate Entropy and Fast Sample Entropy. All these algorithms are effectively implemented in the R software package TSEntropies. This paper contains not only an explanation of all these algorithms, but also the principle of their acceleration. Furthermore, the paper contains a description of the functions of this software package and their parameters, as well as simple examples of using this software package to calculate these measures of complexity of an artificial time series and the time series of a complex real-world system represented by the course of supercomputer infrastructure power consumption. These time series were also used to test the speed of this package and to compare its speed with another R package pracma. The results show that TSEntropies is up to 100 times faster than pracma and another important result is that the computational times of the new Fast Approximate Entropy and Fast Sample Entropy algorithms are up to 500 times lower than the computational times of their original versions. At the very end of this paper, the possible use of this software package TSEntropies is proposed.

Read accessible full text

New fast ApEn and SampEn entropy algorithms implementation and their application to supercomputer power consumption

Author: Tomčala, Jiří
Publisher: MDPI
Year: 2020
DOI: 10.3390/e22080863
Source: https://dspace.vsb.cz/bitstreams/35210fe5-7951-482a-864c-3582bdc6399c/download
en opy
A icle
New Fas ApEn and SampEn En opy Algo i hms
Implemen a ion and Thei Applica ion o
Supe compu e Powe Consump ion
Jiˇ í Tomˇcala
IT4Inno a ions, VSB—Technical Uni e si y o Os a a, 17.lis opadu 2172/15, 70833 Os a a-Po uba,
Czech Republic; [email p o ec ed]
Recei ed: 20 June 2020; Accep ed: 31 July 2020; Published: 5 Augus 2020


Abs ac :
App oxima e En opy and especially Sample En opy a e ecen ly equen ly used
algo i hms o calcula ing he measu e o complexi y o a ime se ies. A lesse known ac is ha
he e a e also accele a ed modi ica ions o hese wo algo i hms, namely Fas App oxima e En opy
and Fas Sample En opy. All hese algo i hms a e e ec i ely implemen ed in he R so wa e package
TSEn opies. This pape con ains no only an explana ion o all hese algo i hms, bu also he p inciple
o hei accele a ion. Fu he mo e, he pape con ains a desc ip ion o he unc ions o his so wa e
package and hei pa ame e s, as well as simple examples o using his so wa e package o calcula e
hese measu es o complexi y o an a i icial ime se ies and he ime se ies o a complex eal-wo ld
sys em ep esen ed by he cou se o supe compu e in as uc u e powe consump ion. These ime
se ies we e also used o es he speed o his package and o compa e i s speed wi h ano he R
package p acma. The esul s show ha TSEn opies is up o 100 imes as e han p acma and
ano he impo an esul is ha he compu a ional imes o he new Fas App oxima e En opy and
Fas Sample En opy algo i hms a e up o 500 imes lowe han he compu a ional imes o hei
o iginal e sions. A he e y end o his pape , he possible use o his so wa e package TSEn opies
is p oposed.
Keywo ds:
en opy; measu e o complexi y; app oxima e en opy; sample en opy;
as app oxima e en opy; as sample en opy; benchma king; so wa e compa ison; supe compu e
powe consump ion
1. In oduc ion
Nowadays, i is necessa y in many scien i ic ields o ind ou whe he a ce ain ime se ies is
chao ic and wha is he deg ee o i s chao ic beha io . The e a e se e al es s o de ec chao ic dynamics
o ime se ies such as a 0–1 es o chaos [
1
] o Shilniko chaos condi ion [
2
]. Howe e , hese es s
can only be used o dis inguish be ween egula and chao ic dynamics. Howe e , i i is necessa y
o de e mine he le el o de e minism in he analyzed ime se ies, i would be mos app op ia e o
calcula e i s en opy.
In gene al, he en opy o a sys em de e mines he deg ee o i s diso de [
3
]. This s a e a iable is
he highe he mo e diso de ed he sys em is. This le el o diso de hen p opo ionally a ec s he
deg ee o p edic abili y o such a sys em. The cha ac e is ics o his sys em a e e lec ed in he ime
se ies c ea ed by his sys em, so wi h some simpli ica ion i can be a gued ha he en opy o his ime
se ies would be a measu e o he unp edic abili y o his sys em and also a measu e o i s complexi y.
In ecen yea s, he o en used algo i hms o calcula ion o a measu e o ime se ies complexi y
a e App oxima e En opy (ApEn) [
4
] and Sample En opy (SampEn) [
5
]. A his poin , howe e , i is
En opy 2020,22, 863; doi:10.3390/e22080863 www.mdpi.com/jou nal/en opy
En opy 2020,22, 863 2 o 10
impo an o say ha hese algo i hms do no calcula e en opy in a ma hema ical sense, bu essen ially
de e mine he deg ee o complexi y o he analyzed ime se ies in a ious ways.
The App oxima e En opy was o iginally de eloped o analyze medical da a, such as hea a e,
and la e i s applica ion was ex ended in inance, psychology, e c. I is de ined as ollows:
ApEn(x,m, ) =
=1
N−m+1"N−m+1
∑
i=1
log |ji|
N−m+1#−1
N−m"N−m
∑
i=1
log |ki|
N−m#, (1)
whe e
ji={ξ| kyi−yξk ≤ ∧ξ∈ h1, N−m+1i},
ki={ξ| kzi−zξk ≤ ∧ξ∈ h1, N−mi},
yi= [xi,xi+1, ..., xi+m−1],zi= [xi,xi+1, ..., xi+m],N=|x|.
This Equa ion (1) looks o simila sub-sequences
yi
esp.
zi
o leng hs
m
esp.
m+
1. I i
is assumed ha he e alua ion o
kyi−yξk ≤
is one elemen a y ope a ion, hen
N−m+
1
ope a ions a e equi ed o calcula e each
|ji|
. The o al numbe o ope a ions would hen be
2N2+N(6−4m) + 2m2−6m+7, so he ime complexi y o he App oxima e En opy is O(N2).
Ano he algo i hm used o ime se ies complexi y analysis is he Sample En opy, which is
sligh ly simple han he App oxima e En opy algo i hm. Al hough i equi es ewe ope a ions o
calcula e, i will be shown below ha i has he same ime complexi y. This algo i hm was p oposed in
2000 by Richman and Moo man o assess he complexi y o physiological ime se ies.
The de ini ion o Sample En opy is:
SampEn(x,m, ) = log ∑N−m+1
i=1|bi|
∑N−m
i=1|ai|!, (2)
whe e
bi={ξ| kyi−yξk ≤ ∧ξ∈ h1, N−m+1i i},
ai={ξ| kzi−zξk ≤ ∧ξ∈ h1, N−mi i},
yi= [xi,xi+1, ..., xi+m−1],zi= [xi,xi+1, ..., xi+m],N=|x|.
No e ha se s
bi
and
ai
a e di e en om se s
ji
and
ki
o App oxima e En opy. They do no
con ain index
i
, so calcula ing
|bi|
esp.
|ai|
akes only
N−m
esp.
N−m−
1 ope a ions. Howe e ,
i also b ings wi h i he possibili y ha he sum o all
|ai|
can be ze o. The o al numbe o ope a ions
is hen 2N2+N(2−4m) + 2m2−2m+1 and he ime complexi y is O(N2)again.
2. New Fas Algo i hms
Quad a ic ime complexi y o he App oxima e and Sample En opy algo i hms was he main
eason why hei accele a ed modi ica ions Fas App oxima e En opy and Fas Sample En opy ha e
been p oposed in [
6
]. The o iginal App oxima e En opy algo i hm looks o mu ually simila
sub-sequences by compa ing all possible sub-sequences wi h each o he . This me hod is appa en ly an
ex emely ime-consuming and also he same pai o sub-sequences is unnecessa ily compa ed wice.
The accele a ion o he modi ied Fas App oxima e En opy algo i hm is ha , once i inds wo simila
sub-sequences, all o he sub-sequences in he same neighbo hood will be ma ked as al eady included
in some neighbo hood. An impo an ac is ha hese sub-sequences a e no longe aken in o accoun
when sea ching o o he simila sub-sequences, he eby speeding up hese u he sea ches.
The o mula o he Fas App oxima e En opy hen eads as ollows:
En opy 2020,22, 863 3 o 10
Fas ApEn(x,m, ) =
=1
Nm"Nm
∑
i=1
log |si,m|
Nm#−1
Nm+1"Nm+1
∑
i=1
log |si,m+1|
Nm+1#, (3)
whe e
si,m={ξ|(kyi−yξk ≤ )∧(ξ/∈sj,m,j<i)},yi= [xi,xi+1, ..., xi+m−1],
si,m
is a se o sub-sequences o leng h
m
belonging o he
i
- h neighbo hood, and
Nm
is numbe o
hese neighbo hoods.
The same p inciple is used in he modi ied Fas Sample En opy algo i hm:
Fas SampEn(x,m, ) = log ∑Nm
i=1|si,m|
∑Nm+1
i=1|si,m+1|!, (4)
whe e
si,m={ξ|(kyi−yξk ≤ ,ξ6=i)∧(ξ/∈sj,m,j<i)},
yi= [xi,xi+1, ..., xi+m−1],
si,m
is a se o sub-sequences o leng h
m
belonging o he
i
- h neighbo hood, and
Nm
is numbe o
hese neighbo hoods.
In his way, he sea ch ime o simila sub-sequences and hus he o al calcula ion imes can be
signi ican ly educed. The na u e o his modi ica ion implies ha he numbe o ope a ions is di e en
o di e en ime se ies o he same leng h, bu he numbe o ope a ions o he bes case and o
he wo s can be de e mined. Fo he bes case, he numbe o ope a ions equi ed o calcula e bo h
accele a ed algo i hms is equal o 2
N−
2
m+
7. In he wo s case, he numbe o ope a ions equi ed
o compu e Fas App oxima e En opy is equal o
N2+N(
5
−
2
m) + m2−
5
m+
7 and o compu e Fas
Sample En opy equals N2+N(2−2m) + m2−2m+1.
Thus, i can be seen om he abo e ha he ime complexi y o bo h accele a ed algo i hms anges
om
O(N)
o
O(N2)
. An in e es ing ac is ha he abo e-men ioned bes case co esponds o a ime
se ies wi h a low deg ee o diso de , which also implies a low Fas ApEn o Fas SampEn alue o
analyzed ime se ies. On he con a y, he wo s case co esponds o a ime se ies wi h a high deg ee o
diso de and hence a high Fas ApEn o Fas SampEn alue. The amoun o compu a ional ope a ions
and he ime complexi y o hese accele a ed algo i hms is hus in e es ingly dependen on he alue
hey calcula e.
3. Supe compu e Powe Consump ion Time Se ies
Fo he pu poses o his a icle, access o he ime se ies ep esen ing he elec ical consump ion
o i s in as uc u es [
7
] was ob ained. The powe consump ion o his supe compu e depends on
many ac s ha may depend nonlinea ly on each o he , and he numbe o such ac s is so la ge ha i
is in ac able o modeling, so i can be said ha his supe compu e in as uc u e is so called complex
sys em in e ms o i s powe consump ion. Thus, he eco ded ime se ies o elec ical consump ion is a
ime se ies wi h complex dynamics, o simply a complex ime se ies.
Fo his eason, his ime se ies is a good ep esen a i e o eal-wo ld ime se ies o es ing and
compa ing he pe o mance o complexi y deg ee analyze s. The esul s o hese es s and pe o mance
compa ison a e shown in Sec ion 4.
A his poin , i should be men ioned why an analysis o a complexi y deg ee o his ime se ies
o powe consump ion is use ul. This analysis is usually used in medicine whe e he cou se o an
elec oca diog am (ECG) o elec oencephalog am (EEG) is analyzed. Fo example, based on EEG
complexi y deg ee, he beginning, end, and he ype o epilep ic seizu e can be iden i ied.
En opy 2020,22, 863 4 o 10
Howe e , as shown in [
8
], he ime se ies complexi y can also be an indica o o i s p edic abili y
in o ecas ing i s u u e cou se. A high deg ee o he complexi y in such a case sugges s ha any
p edic ion a a gi en poin in he ime se ies is e y likely o be a mo e e oneous han a p edic ion
a ano he poin in he analyzed ime se ies whe e he complexi y deg ee is lowe . One could e en
say ha , om a ce ain deg ee o ime se ies complexi y, any o ecas is wo hless and can easily be
eplaced by a simple a i hme ic mean.
By analyzing he complexi y o his ime se ies o powe consump ion, i is possible o de e mine
in ad ance whe he he p edic ion o i s de elopmen can be c edible. This is e y impo an i he
o ecas indica es he possibili y o o e loading he powe sys em.
Accele a ed e sions o en opy algo i hms such as Fas App oxima e En opy and Fas Sample
En opy om he so wa e package
TSEn opies
[
9
] may be help ul in eally quickly de e mining he
plausibili y o u u e ime se ies p edic ions. See Appendix A o ins alla ion ins uc ions.
The calcula ed wa e o ms o ApEn, SampEn, Fas ApEn, and Fas SampEn alues oge he wi h
he cou se o he analyzed powe consump ion ime se ies a e shown in he g aph in Figu e 1. As can
be seen om his image, he alues o he new accele a ed algo i hms a e a di e en le els han hei
o iginal e sions. This ac is discussed in de ail in [
6
], whe e i is also shown ha hei abili y o de ec
an inc ease o dec ease in complexi y o he ime se ies is oughly he same as in hei o iginal e sions.
A mo e de ailed analysis o his phenomenon goes beyond he scope o his a icle.
Figu e 1. The no malized supe compu e powe consump ion ime se ies, which is he subjec o he
analysis, along wi h calcula ed alues o App oxima e En opy (ApEn), Sample En opy (SampEn),
Fas App oxima e En opy (Fas ApEn), and Fas Sample En opy (Fas SampEn). A loa ing window
wi h a wid h o 2880 min was used o he calcula ion.
He e is an example o a simple sou ce code, which can be used o calcula e he cou se o he
Sample En opy o powe consump ion, he measu ed alues o which a e s o ed in he ime se ies
powe TS. The loa ing calcula ion window in his case is 2880 in leng h:
lib a y(TSEn opies)
SampEn_powe TS <- nume ic()
o (i in 1:7120) {
SampEn_powe TS[i] <- SampEn(powe TS[i:(i+2880)])
}
plo (powe TS[1:10000], ype="l")
lines(x = 1440 + (1:leng h(SampEn_powe TS)), y = SampEn_powe TS, ype = "l",
l y = 3, col = "da kg een")
En opy 2020,22, 863 5 o 10
# x = 1440 + ... is he o se o he middle o he calcula ion window
This chunk o code assumes ha he powe consump ion ime se ies powe TS is al eady
no malized, which should be done in ad ance. The displayed cou se o he calcula ed SampEn
alue is shi ed by hal a calcula ion window so ha i s alues in he g aph a e loca ed in he middle o
he a ea om which hey we e calcula ed.
4. Benchma ks and Compa ison
Ano he so wa e p og am ha can calcula e bo h App oxima e En opy and Sample En opy is
he R package
p acma
[
10
]. The e o e, his R package was chosen o compa ison wi h he
TSEn opies
package. The
p acma
package is a e sa ile so wa e ha allows one o calcula e many di e en
p ac ical ea u es. I p o ides a la ge numbe o unc ions om nume ical analysis and linea
algeb a, nume ical op imiza ion, di e en ial equa ions, ime se ies, plus some well-known special
ma hema ical unc ions.
Th ee ypes o ime se ies we e used in he compa a i e es s. Fi s ly, he eal-wo ld ime se ies
powe TS ep esen ed by he powe consump ion o he supe compu e in as uc u e. Fu he mo e,
an a i icial ime se ies sinTS whose cou se is de e mined by he sine unc ion. This ime se ies
is assumed o be a low deg ee o complexi y. I will be in e es ing o obse e he di e ence in
compu a ional imes compa ed o he las ype o ime se ies no mTS wi h a high deg ee o complexi y,
which is a andom signal wi h no mal p obabili y dis ibu ion.
F om he poin o iew o he ocus o his pape , he mos impo an a e calcula ions o ApEn,
SampEn, Fas ApEn, and Fas SampEn alues o he supe compu e powe consump ion ime se ies
powe TS om he eal wo ld and he e o e he a en ion will be gi en especially on hem. The de ailed
esul s o calcula ions o a i icially c ea ed ime se ies as sinTS and no mTS ha e al eady been
published in [6].
The measu ed un- imes o ime se ies powe TS a e depic ed in he g aphs in Figu e 2, whe e he
package unc ions implemen ed in C we e used, and, in Figu e 3, whe e he package unc ions
implemen ed in R we e used. The un- imes achie ed by he package
p acma
can also be ound in
hese wo igu es, which allows an immedia e g aphical compa ison o he pe o mance wi h he
TSEn opies package.
As men ioned in Sec ion 2, he numbe o compu a ional ope a ions and hence he compu a ional
ime equi ed o new modi ied algo i hms depends on he deg ee o diso de in he analyzed ime
se ies. This is one o he easons why all h ee ypes o hese ime se ies we e used o es he
pe o mance o his so wa e. Since he lowes le el o diso de is assumed o he sinTS, i is expec ed
ha i s un- imes will also be he lowes .
A summa y o measu ed un- imes equi ed by bo h accele a ed algo i hms o all h ee ypes o
ime se ies using he
TSEn opies
package is shown in Figu e 4, which p esen s he esul ing un- imes
o he Fas App oxima e En opy algo i hm, and Figu e 5, which p esen s he esul ing un imes o
he Fas Sample En opy algo i hm. These calcula ions we e pe o med o a ious leng hs o ime
se ies om 103 o 107samples.
Du ing he calcula ions, he de aul alues o he pa ame e s we e se o he execu ed unc ions.
Thei se ings can be seen in Appendix B.
The calcula ions we e pe o med on a compu e wi h an In el Co e i5-6200U CPU @ 2.30 GHz
p ocesso , 8 GB RAM SO-DIMM DDR3 1600 MHz and SSD Li eOn L8H-256V2G-HP. The ope a ing
sys em ins alled was Ubun u 18.04.4 (64-bi ).
This es ing could, o cou se, be done on one o he supe compu e clus e s (Salomon, Anselm,
o Ba bo a) and su ely sho e compu a ional imes would be achie ed, bu he e was an e o o
show ha his R package
TSEn opies
and also new algo i hms can handle any ime se ies e en on a
egula compu e .

En opy 2020,22, 863 6 o 10
Figu e 2.
Compa ison o he ime needed o un a ious ypes o algo i hms using he TSEn opies
package unc ions implemen ed in C and he p acma package unc ions. The analyzed ime se ies is
he powe consump ion o he supe compu e .
Figu e 3.
Compa ison o he ime needed o un a ious ypes o algo i hms using he TSEn opies
package unc ions implemen ed in R and he p acma package unc ions. The analyzed ime se ies is
he powe consump ion o he supe compu e .
En opy 2020,22, 863 7 o 10
Figu e 4.
Compa ison o Fas App oxima e En opy compu a ion imes o ime se ies wi h a ious
le els o diso de .
Figu e 5.
Compa ison o Fas Sample En opy compu a ion imes o ime se ies wi h a ious le els
o diso de .
5. Conclusions and Fu u e Wo k
As can be seen om he g aphs o un- imes in Figu es 2–5, he
TSEn opies
package calcula es
bo h App oxima e and Sample En opy much as e han package
p acma
. This is ue no only o
unc ions implemen ed in C (Figu e 2), which we e app oxima ely 100 imes as e , bu e en in R
(Figu e 3), which we e abou 20 imes as e .
I can also be obse ed in Figu es 4and 5 ha he un- imes o he new accele a ed algo i hms
con i med he assump ion o he dependence o compu a ion ime on he analyzed ime se ies diso de
le el. In e es ingly, wi h hese algo i hms, he mul iplica i e di e ence be ween sinTS and no mTS
un- imes o C unc ions was much g ea e (150 imes) han o R unc ions (only 30 imes) o he
same TSEn opies package.
The compu ed alues o all algo i hms as well as hei un- imes we e sligh ly lowe o powe TS
han o no mTS, sugges ing ha he e a e some egula i ies in he powe consump ion wa e o m
ha dis inguish i om a comple ely andom signal. This p o es ha an e en ual p edic ion o i s
de elopmen would make sense. Al hough his inding is no he pu pose o his pape , i ne e heless
indica es he possible use o his so wa e.
Pe haps he mos impo an esul o es ing his
TSEn opies
package seems o be ha he
compu a ional imes o he new Fas App oxima e En opy and Fas Sample En opy algo i hms a e up
o 500 imes lowe in he ime se ies om he eal wo ld han he compu a ional imes o hei o iginal
En opy 2020,22, 863 8 o 10
e sions. This makes his so wa e a eally powe ul ool o he as sea ching o any egula i ies in
huge amoun s o da a. Such ype o sea ch is needed in a wide ange o ields. F om he de ec ion o
epilep ic seizu es in he ECG, h ough he p edic ion o engine gea ailu e by mechanical ib a ion
analysis, o such exo ic issues as he sea ch o in elligen li e mani es a ions in adio signals om he
su ounding uni e se. In all hese cases (and many o he s), he e is a need o apid analysis o huge
amoun s o da a. The new accele a ed Fas App oxima e En opy and Fas Sample En opy algo i hms
implemen ed in he TSEn opies package a e pe ec o his.
As a u u e de elopmen o his so wa e, i seems app op ia e o c ea e a ully pa allelized
e sion, which would be in ended mainly o p ocessing big da a on supe compu e s. Ano he possible
di ec ion ha his so wa e de elopmen could ake is o add a g aphical ou pu o he cou se o he
calcula ed alues along wi h he cou se o he analyzed ime se ies, simila o hose in Figu e 1.
Funding: This esea ch ecei ed no ex e nal unding.
Acknowledgmen s:
This wo k was suppo ed by he Minis y o Educa ion, You h and Spo s om he La ge
In as uc u es o Resea ch, Expe imen al De elopmen , and Inno a ions p ojec “e-INFRA CZ—LM2018140”
and by SGC G an No. SP2020/137 “Dynamic sys em heo y and i s applica ion in enginee ing”, VSB—Technical
Uni e si y o Os a a, Czech Republic.
Con lic s o In e es : The au ho decla es no con lic o in e es .
Appendix A. Ins alla ion o TSEn opies Package
The
TSEn opies
package [
9
] is a ailable om he Comp ehensi e R A chi e Ne wo k (CRAN) a
h ps://c an. -p ojec .o g/package=TSEn opies. The e o e, he TSEn opies package can be ins alled
in he s anda d way using he command:
R> ins all.packages("TSEn opies")
This package does no use any o he R packages, so he e is no need o wo y abou se ing
dependencies. Howe e , he e sion o R i sel should be a leas 3.4.0 [11].
I he ins alla ion was success ul, he package can be loaded by:
R> lib a y(TSEn opies)
Appendix B. TSEn opies Package Con en and Implemen a ion
The package con ains unc ions o calcula ion o App oxima e En opy and Sample En opy
as well as hei modi ied e sions: Fas App oxima e En opy and Fas Sample En opy. All hese
algo i hms a e implemen ed in wo ways.
Fi s , hey a e implemen ed as unc ions only in R. These unc ions include he su ix _R in hei
name. Then, hese algo i hms a e implemen ed again in R, bu , in his implemen a ion, R se es only
as a w appe o hidden in e nal unc ions w i en in C. As i will be seen in he nex chap e , using his
way a signi ican accele a ion o he calcula ion is achie ed. Func ions c ea ed in his way a e indica ed
by an _C su ix.
The package also includes unc ions wi hou any su ix in hei name. These unc ions only igge
unc ions o he same name, bu wi h he su ix _C and pass hem he e y same pa ame e s. These alias
unc ions a e he e o make i easie o use hose as e e sions o implemen a ion. I someone wan s o
use unc ions w i en pu ely in R, hen hey mus explici ly use unc ions wi h he su ix _R. Howe e ,
in e ms o speed, his op ion is no ecommended.
The s uc u e o he pa ame e s is essen ially he same o all implemen ed unc ions. The only
di e ence is in he case o unc ions implemen ing modi ied algo i hms in he de aul alue o he las
pa ame e
. This pa ame e de e mines he highes alue o he dis ance be ween sub-sequences ha
a e s ill conside ed as simila . Fo he o iginal algo i hms, i is ecommended o se his pa ame e
o a alue co esponding o 0.2 imes he s anda d de ia ion o he analyzed ime se ies. Howe e ,
in nume ical expe imen s wi h modi ied algo i hms, i has been ound ha i is mo e app op ia e o
hem o se his pa ame e o a alue equal o 0.15 imes his s anda d de ia ion.
En opy 2020,22, 863 9 o 10
The emaining pa ame e s, as well as hei de aul alues, a e he same o all package unc ions.
The analyzed ime se ies, deno ed as
TS
, is always he i s and manda o y pa ame e . I should be in
he o m o some nume ic R ec o .
An impo an pa ame e is he dimension
dim
, which is op ional. This pa ame e co esponds o
he a iable
m
in all he abo e o mulas. As i can be seen om he package lis ing below, i s de aul
alue is 2.
Fo cla i y, he e is a lis o all he unc ions o his package and hei syn ax usage:
ApEn(TS, dim = 2, lag = 1, = 0.2 * sd(TS))
ApEn_C(TS, dim = 2, lag = 1, = 0.2 * sd(TS))
ApEn_R(TS, dim = 2, lag = 1, = 0.2 * sd(TS))
SampEn(TS, dim = 2, lag = 1, = 0.2 * sd(TS))
SampEn_C(TS, dim = 2, lag = 1, = 0.2 * sd(TS))
SampEn_R(TS, dim = 2, lag = 1, = 0.2 * sd(TS))
Fas ApEn(TS, dim = 2, lag = 1, = 0.15 * sd(TS))
Fas ApEn_C(TS, dim = 2, lag = 1, = 0.15 * sd(TS))
Fas ApEn_R(TS, dim = 2, lag = 1, = 0.15 * sd(TS))
Fas SampEn(TS, dim = 2, lag = 1, = 0.15 * sd(TS))
Fas SampEn_C(TS, dim = 2, lag = 1, = 0.15 * sd(TS))
Fas SampEn_R(TS, dim = 2, lag = 1, = 0.15 * sd(TS))
All o hese unc ions e u n a alue o ype nume ic. Examples o use may be as ollows.
A simple example o calcula ing he App oxima e En opy o a andom ime se ies wi h a no mal
p obabili y dis ibu ion using a unc ion implemen ed in C:
R> lib a y(TSEn opies)
R> no mTS <- no m(1000)
R> ApEn( no mTS)
[1] 1.61967
R> ApEn( no mTS, = 0.1*sd( no mTS))
[1] 1.07962
R> ApEn( no mTS, dim = 4, = 0.5*sd( no mTS))
[1] 0.8241541
o an example o calcula ing he Fas Sample En opy o a ime se ies whose alues a e de i ed om
he cou se o a sine wa e using a unc ion implemen ed in R:
R> lib a y(TSEn opies)
R> sinTS <- sin(seq(0,100*pi,pi/10))
R> Fas SampEn_R(sinTS)
[1] 0.003059666
R> Fas SampEn_R(sinTS, = 0.3*sd(sinTS))
[1] 0.003047234
R> Fas SampEn_R(sinTS, dim = 5, = 0.4*sd(sinTS))
[1] 0.001019888
I is simila o ApEn_C(),ApEn_R(),SampEn(),SampEn_C(),SampEn_R(),Fas ApEn(),
Fas ApEn_C(),Fas ApEn_R(),Fas SampEn(), and Fas SampEn_C() unc ions.