Sei sulla pagina 1di 13

See discussions, stats, and author profiles for this publication at: https://www.researchgate.

net/publication/220539765

An open source tool for heart rate variability spectral analysis.

Article  in  Computer Methods and Programs in Biomedicine · January 2011


Source: DBLP

CITATIONS READS

3 297

6 authors, including:

Leandro Rodríguez-Liñares Arturo J. Méndez


University of Vigo University of Vigo
46 PUBLICATIONS   239 CITATIONS    59 PUBLICATIONS   680 CITATIONS   

SEE PROFILE SEE PROFILE

David N Olivieri Xose A. Vila


University of Vigo University of Vigo
105 PUBLICATIONS   436 CITATIONS    92 PUBLICATIONS   1,062 CITATIONS   

SEE PROFILE SEE PROFILE

Some of the authors of this publication are also working on these related projects:

RWizard View project

CAD Mammography View project

All content following this page was uploaded by Xose A. Vila on 07 January 2014.

The user has requested enhancement of the downloaded file.


c o m p u t e r m e t h o d s a n d p r o g r a m s i n b i o m e d i c i n e 1 0 3 ( 2 0 1 1 ) 39–50

journal homepage: www.intl.elsevierhealth.com/journals/cmpb

An open source tool for heart rate variability spectral


analysis

L. Rodríguez-Liñares ∗ , A.J. Méndez, M.J. Lado, D.N. Olivieri, X.A. Vila, I. Gómez-Conde
Dpto. Informática University Vigo, Spain1

a r t i c l e i n f o a b s t r a c t

Article history: In this paper we describe a software package for developing heart rate variability analysis.
Received 15 October 2009 This package, called RHRV, is a third party extension for the open source statistical envi-
Received in revised form ronment R, and can be freely downloaded from the R-CRAN repository. We review the state
26 April 2010 of the art of software related to the analysis of heart rate variability (HRV). Based upon this
Accepted 24 May 2010 review, we motivate the development of an open source software platform which can be used
for developing new algorithms for studying HRV or for performing clinical experiments. In
Keywords: particular, we show how the RHRV package greatly simplifies and accelerates the work of
Heart rate variability the computer scientist or medical specialist in the HRV field. We illustrate the utility of our
Open source package with practical examples.
Apnea © 2010 Elsevier Ireland Ltd. All rights reserved.
Signal processing

three relevant peaks: the VLF (very-low frequency) contai-


1. Introduction ning frequencies below 0.03 Hz, the LF (low frequency),
having frequencies between 0.03 and 0.15 Hz, and the HF
In ancient times, physicians believed that our heart beats regu-
(high frequency) peaks which lie between 0.18 and 0.4 Hz.
larly with a fixed rate, rising or falling due to external stimulus,
Using drugs for selectively blocking different components
such as fear, anxiety, relaxations, etc. When it was possible to
of the neurovegetative control systems, Akselrod discovered
measure the heart rhythm with more precision, it was disco-
that the parasympathetic system modulates the LF and HF
vered that it was not constant but experienced some amount
peaks, the sympathetic system alters the LF peak, and the
of variability. Until the past century, physicians thought this
renin–angiotensin system modulates the VLF peak. A prac-
variability was simply noise and had no clinical relevance.
tical consequence of this experiment was that the heart rate
It wasn’t until the period between 1970 and 1990, that key
variability could be used as an indicator or indirect measure of
research findings demonstrated that this variability had phy-
the status of the neurovegetative control system.
siological origins and was related to phenomena such as the
HRV has been an active research field since the 1990s. Seve-
respiratory rate or the neurovegetative control system [1,2].
ral analysis techniques have been developed and improved
Explicit relationships between spectral components of
[4,5] including time indices, spectral analysis, and non-linear
heart rate variability (HRV) and the different components
analysis. The relation of HRV with some pathologies such
of the neurovegetative control systems were experimen-
as myocardial infarction, sudden cardiac death, heart failure,
tally demonstrated by Akselrod et al. [3], who described
hypertension, and ischaemia has been established in several


Corresponding author at: Escuela Superior de Ingeniera Informática, As Lagoas, s/n, 32004 Ourense, Spain. Tel.: +34 988387009.
+34 986813929.
E-mail addresses: leandro@uvigo.es (L. Rodríguez-Liñares), mrarthur@uvigo.es (A.J. Méndez), mrpepa@uvigo.es
(M.J. Lado), olivieri@uvigo.es (D.N. Olivieri), anton@uvigo.es (X.A. Vila), igconde@correo.ei.uvigo.es (I. Gómez-Conde).
1
http://www.milegroup.net.
0169-2607/$ – see front matter © 2010 Elsevier Ireland Ltd. All rights reserved.
doi:10.1016/j.cmpb.2010.05.012
40 c o m p u t e r m e t h o d s a n d p r o g r a m s i n b i o m e d i c i n e 1 0 3 ( 2 0 1 1 ) 39–50

studies [6,7]. As an indication that HRV continues to be an laible tools to study HRV, consists mostly of custom software
active practical field with unresolved problems, there were 21 packages or a loose collection of utilities (a significant number
papers directly related with HRV in the recent 2009 Computers of them using Matlab or Octave). Some authors describe their
in Cardiology Conference [8]. algorithms, yet do not give specifics of the implementation
Unfortunately, clinical practitioners have not included HRV platform or language. Among the few authors that describe
analysis in their standard diagnostic protocols. As a conse- specific environments for studying HRV signals, many of the
quence, medical device manufacturers have not traditionally tools are proprietary and not made available in the public
placed a high priority on including this type of analysis in their domain for use by other researchers.
products [7]. First generation monitoring systems of the 1990s Recently, National Instruments described how variability
permitted the analysis of only a limited number of basic para- analysis can be performed in LabVIEW [10]. While they freely
meters in the time domain and provided only rudimentary offer both the LabVIEW model and documentation, the Lab-
spectral analysis. The principal disadvantage of these early VIEW software platform is a commercial product and is more
systems, however, was the inherent limitations for modifying frequently used by hardware designers or experimentalists
measurement parameters as well as the inflexibility of data than by computer scientists working in the field of medical
format interchange. informatics.
Modern commercial monitoring systems have impro- We have previously mentioned Physionet, which is a web
ved considerably due to greater computational capability of portal containing an extensive database of physiologic signals
embedded systems and to the ability to include a greater range as well as software tools, such as the WFDB [11] library, that
of flexibility. For example, our research related to signal pro- are freely available. Amongst the utilities offered at this site is
cessing of apnea, a chronic sleep disorder, has benefitted from the C language based HRV Toolkit [12] that utilizes the WFDB
recent commercial polysomnographic systems such as the library to obtain signals of heart rate and parameters of varia-
Ultrasom Network by Nicolet and the Somnoscreen of Sonome- bility, both in the time and frequency domain. This is a basic
dics, where variability analysis may be performed both in the software tool and requires installation of both the libraries and
time and frequency domain. Such systems also offer the pos- the HRV Toolkit on systems that support C.
sibility of using different standard formats required by various Recently, Physionet published a news item on their web-
data processing software and hardware tools. site [13] which suggests three different options available for
Despite these improvements, present commercial systems performing HRV analysis with their databases:
are designed for clinical uses and do not have the program-
mability needed by researchers in signal processing, looking • The preliminary version of our package RHRV [14].
for new and yet unforeseen discriminators or algorithms. For • A collection of Matlab scripts [15] which implement func-
this task, researchers rely upon software post-processing. As tions for the linear and non-linear spectrum. Nonetheless,
an example, such systems do not directly permit the custo- these Matlab scripts do not include convenient interfaces
mization of the spectral bands, nor other analysis parameters for importing data, nor does it include specific graphics uti-
such as the size of temporal windows, type of spectral esti- lities.
mators, etc. Thus, researchers rely upon software tools, and • A software package called KUBIOS-HRV [16,17]. The latest
not commercial clinical systems for exploring new diagnostic version of this software is based on Matlab and is multi-
techniques. platform. It imports ASCII files as well as data files from
In this paper we present a software tool useful for resear- Polar and Suunto heart rate monitors (HRM and SDF/STE
chers in the HRV field. The paper is structured as follows. In files, respectively). It has a well designed graphical interface
Section 2 we review the state of the art in the field of software and performs analysis in time and frequency domain as well
for HRV analysis. Section 3 contains a general description of as non-linear dynamical studies.
our software package and an example for presenting the use
of our tool. In Section 4, we present another example in order The most complete and useful software tool that we
to explain how our tool could be used to validate a medical encountered for HRV analysis is the aHRV, developed by Nevro-
hypothesis related with HRV. Finally a discussion section is kard [18]. This is a very well designed commercial tool that
included in which we summarize the main advantages of our provides many options. With this software, heart rate data
software tool and describe future work. from multiple sources such as ASCII files, binary files in Euro-
pean Data Format [19], or other proprietary formats may be
imported. Other aspects of this software include time and
2. Background frequency analysis, flexibility for modifying input processing
parameters, and a well designed user interface. Nevorkard also
The development of our HRV software package grew out of offers other modified versions of this tool, such as LT-HRV for
what we perceived as a need to unify software functionality analyzing segmented ECG records or OSAS for apnea scree-
into one open source and easily extendible tool. We based ning.
our decision to develop the package in the R-language after As researchers, however, we believe that our use of the
a thorough bibliographic review, paying careful attention to aHRV system has several drawbacks. Foremost, it is a closed
the software tools being employed and developed. commercial tool, which is not typically an issue for hospital
The majority of researchers have obtained their data from users, but poses significant limitations for researchers interes-
commercial acquisition systems or from a standard database ted in developing new algorithms. Thus, beyond the provided
such as Physionet [9]. Besides, a large collection of ava- functionalities, it isn’t possible to implement new algorithms,
c o m p u t e r m e t h o d s a n d p r o g r a m s i n b i o m e d i c i n e 1 0 3 ( 2 0 1 1 ) 39–50 41

Fig. 2 – The central data structure used in RHRV.

Fig. 1 – Extracting useful information from the spectral


content of the heart-rate signal. RHRV uses a custom data structure to store all information
related to digital recordings from a polysomnograph. While a
more detailed description of the data structure may be consul-
ted elsewhere [22], its most salient aspects shall be described
define new plots, or configure new statistical tests. Thus,
here.
this software package is a good solution for physicians with
The package uses a data structure called HRVData which is
concrete clinical studies in mind, however it is not suitable for
described graphically in Fig. 2 and is implemented as a list
researches with mathematical and programming skills who
data object in the R language. This list contains fields corres-
would like to experiment with new methodologies, integrate
ponding to imported data as well as parameters generated
with other software tools, adapt the interfaces to different
by our pre-processing functions to perform heart rate varia-
types of users, etc.
bility analysis. It is also possible to perform various analyses
with different parameters and the results are stored in their
3. Software description respective structure which can be very useful for comparing
purposes.
Three types of data substructures are defined, corres-
In this section we describe our RHRV software package. First,
ponding to time-domain, frequency-domain and non-linear
we briefly review the characteristics of the R-statistical envi-
analysis. The present version of our package only imple-
ronment which are fundamental to our package. Next, we
ments frequency analysis functions, so the other structures
provide an overview of the functions in our RHRV package and
are implemented as placeholders for future development.
a complete example.
The HRVData structure has the following fields:

3.1. The R environment/language


• Beat: a dataframe which stores the instantaneous heart rate
data. It contains the position of beats (Time) and the non-
The R language [20,21] is an open source software idiom for
interpolated or instantaneous frequency (niHR).
statistical computing and graphics that is presently used by a
• Episodes: a dataframe containing fields to store the begin-
growing number of researchers. The R language is an imple-
ning, type, duration and a numerical value associated with
mentation of the S language, which was inspired by dialects
each episode (InitTime, Type, Duration and Value, res-
of Lisp. R is distributed under the GNU project and can be run
pectively).
on a wide variety of UNIX, Windows and MacOSX platforms.
• HR: a vector containing the instantaneous interpolated heart
The main characteristics of the R language are:
rate data.
• FreqAnalysis: list of objects of FreqAnalysis type contai-
• Its core functionality is for statistical calculations. ning results of one or more frequency analysis.
• It is highly extensible via third party packages, many of • Other fields containing the heart rate interpolation fre-
which are supplied with the R distribution and others are quency (Freq HR), a string used as file extension by
available through the CRAN family of Internet sites and loading/writing functions (Ext) and the date and time asso-
cover a very wide range of applications. ciate with the record (datetime).
• It consists of a rich programming language with user defi-
ned data types, a suite of mathematical operators for The package RHRV provides utility functions for importing
vectors and matrices, and an integrated collection of data heart rate time series data, analyzing their variability, and
analysis tools. plotting and/or exporting the analysis results. These functions
• It contains facilities for highly customized plots. are summarized graphically in Fig. 3 and can be called from
custom user code, allowing transparent interoperability with
3.2. The RHRV package other R-packages.
RHRV imports data files containing heart beat posi-
The general processing steps involved in extracting useful tions both in WFDB and ASCII fomat (LoadBeatWFDB() and
information from the spectral content of the heart-rate signal LoadBeatAscii(), respectively). LoadBeatWFDB() acts as a
is shown in Fig. 1. These steps define the basic design and wrapper for the C-language utility program rdann, provided by
process pipeline of our software package, RHRV. Physionet, which imports data from a record in WFDB format.
42 c o m p u t e r m e t h o d s a n d p r o g r a m s i n b i o m e d i c i n e 1 0 3 ( 2 0 1 1 ) 39–50

Fig. 3 – Main functions in the RHRV package.

The instantaneous heart rate can be defined as the inverse An evenly spaced heart rate series may be obtained with
of the time separation between two consecutive heart beats. InterpolateNIHR(), which uses cubic spline interpolation.
The core utility BuildNIHR() implements this operation and This functions fills the HR field of HRVData structure.
fills the niHR field of the Beat dataframe. Functions are provided to graphically represent the non-
Intervals within the heart beat time series, which are of interpolated and interpolated heart rate (PlotNIHR() and
physiologic interests, are annotated in so-called episode files. PlotHR(), respectively). These functions allow the user to
The RHRV package provides functions for loading ASCII or include episodic information in the plots.
WFDB formatted files (LoadEpisodesAscii() and LoadAp- A large part of the core functionality of the RHRV
neaWFDB()). Besides, manual episodes generation is possible package is dedicated to the spectral analysis of heart rate
with AddEpisodes(). Another option is to generate new signals. As can be observed in Fig. 2, several analyses
episodes from existing ones: this is done with GenerateE- (with different input parameters) may be performed and
pisodes(), which inserts an annotation with a specific time stored in parallel. The package includes functions for cal-
duration before or after an existing episode event. culating the spectrogram and the energy contained within
Outlier or spurious points may be deleted manually or auto- specified spectral bands (CalculateSpectrogram() and Cal-
matically. In order to delete outliers manually, a graphical culatePowerBand()). The function CalculatePowerBand()
editor is provided (from the function call EditNIHR()) so that calculates the spectrogram and then obtains the power in four
the user may interactively delete ranges of points from the spectral bands: ULF, VLF, LF and HF. Default limits for these
instantaneous heart rate analysis. The elimination of these bands and the size and shift of the analysis window are spe-
points does not affect the calculation of beat intervals or cified but can be modified by the user.
the subsequent interpolation since the input data from the RHRV includes specialized plotting utilities for represen-
ECG consists of a sequence of absolute time positions. Since ting the spectrogram and the power in each spectral band
episodes are identified by their beginning instants and their (PlotSpectrogram() and PlotPowerBand(), respectively).
durations and both magnitudes are absolute times, removal Episodic information can be included in the plots.
of artifacts has no effect on them. Automatic removal of out- The package provides functions to split heart rate signals
liers can also be performed by the FilterNIHR() function. and power band arrays into new data structures corresponding
This function is based on an algorithm developed by one of to intervals inside and outside episodes (SplitHRbyEpi-
the authors [4], that uses adaptive thresholding for rejecting sodes() and SplitPowerBandByEpisodes()). The former is
beats whose value exceeds the cumulative mean threshold. used by AnalyzeHRbyEpisodes() to perform a comparison of
The filter also eliminates points that are not within acceptable HR data inside and outside episode events.
physiological values.
c o m p u t e r m e t h o d s a n d p r o g r a m s i n b i o m e d i c i n e 1 0 3 ( 2 0 1 1 ) 39–50 43

Listing 1 – A complete example of RHRV in use.

For a more detailed description of each of these functions, information), and how this information is used for parameter
the software package is distributed with an extensive user comparison.
manual that conforms to the standards of R-package distri- The example uses a data record (a03) from the Apnea-
butions of the CRAN repository. ECG database [23], constructed for the 2000 Computers in
Cardiology Challenge, which can be downloaded from the Phy-
3.3. A practical example siobank collection [24].
An analysis of Listing 1 is useful to describe the program
In this section, an illustrative example of a heart rate variabi- logic and flow, as well as the different parts of the package that
lity analysis with our software package is presented. Listing 1 are involved:
shows an example program for studying apnea signal data. In
particular, this example illustrate how data is loaded and pro- • All the functions in the package accept a logical
cessed, how plots are generated (including physiologic episode argument verbose that instructs the program to
44 c o m p u t e r m e t h o d s a n d p r o g r a m s i n b i o m e d i c i n e 1 0 3 ( 2 0 1 1 ) 39–50

Fig. 4 – Plot obtained with function PlotNIHR().

Fig. 5 – Removing artifacts with EditNIHR().

show information of the performed actions in the R


console.
• Data structures must be initialized before using them. Line 6 performs the following actions: (a) it splits the sequence
creates the variable md for storing all the data of this record of interpolated heart rate values into two vectors contai-
and is used by all other functions as a global parameter. Line ning samples inside and outside the episode specified in
28 creates a new frequency analysis which can be referred the argument tag, and (b) it applies a function to each of
to by an index (lines 29 to 33). This structure allows md to these vectors returning a list with two results InEpisodes
store different frequency analysis, as can be seen in Fig. 2. and OutEpisodes. The output of lines 24 to 26 can be seen in
• Each episode is labelled with a tag. Subsequently, vectors Listing 2. In this example, a very simple user-defined func-
of tags can be used by functions involving episodes. For tion (CalPower()) was used, but any other function could
example, in line 15 only episodes with the specified tags be used independent of its complexity, so that training or
are included in the plot, while in line 22 all the episodes are testing procedures could easily be implemented.
represented.
• The example shows how RHRV manipulates episodic infor-
mation:
Line 10 loads episodes from an external file.
Line 11 adds a new episode labelled “MANUAL” in order to
define an interval with a length of 1000 seconds with start
value beginning at second 4300. More than one episode
can be added simultaneously using vectors as arguments.
Lines 12 and 13 create episodes with duration 480 seconds
120 seconds before (“PREV APN”) and after (“POST APN”)
each episode “APN”.
• Plots are generated in lines 15, 22 and 30 (Figs. 4, 6 and 7). As
stated, episodic information can be specified using the argu-
ment tag. While line 15 (Fig. 4) plots the non-interpolated
heart rate, line 22 (Fig. 6) plots the heart rate after outlier
removal (lines 17 and 18) and interpolation (line 20).
• Two methods for removing outliers are used in the program:
automatic (line 17) and manual (line 18). The latter opens an
interactive editor (see Fig. 5) which allows the user to select a
rectangular area defined by two points. The points included
in these areas can then be removed from data.
• In line 24, interpolated HR data inside and outside each
episode is compared. Function AnalyzeHRbyEpisodes() Fig. 6 – Plot obtained with function PlotHR().
c o m p u t e r m e t h o d s a n d p r o g r a m s i n b i o m e d i c i n e 1 0 3 ( 2 0 1 1 ) 39–50 45

Fig. 7 – Plot obtained with function PlotPowerBand().

• The power of the heart rate values in the spectral bands


ULF, VLF, LF and HF is estimated in line 29 and this informa-
4. A clinical example
tion is included in the frequency analysis created in line 28.
Arguments of CalculatePowerBand() control several para- As a clinical example of using the RHRV software package,
meters related to the windowing, spectrogram calculation, we present an analysis of a patient suffering from sleep
and power spectral bands definition. apnea. The example consists of data from a polysomnogram
• Using episodic information to split frequency analysis is with an ECG record and an ASCII file with annotations of
also possible, as shown in lines 32 to 36. The output of these respiratory events, including obstructive apnea (OBSAPNEA),
lines of code is given in Listing 3. This example uses func- hypoapnea (GENHYPO) and central apnea (CENAPNEA) epi-
tion t-test from the R package stats to perform a Student’s sodes. Each episode was determined by an initial time and
t-test to the ULF band of segments before and after apnea duration, and contains information of oxygen saturation level
episodes. decreases. While based on real data, however, the purpose of

Listing 2 – Result of analyzing interpolated Heart Rate using episodes.


46 c o m p u t e r m e t h o d s a n d p r o g r a m s i n b i o m e d i c i n e 1 0 3 ( 2 0 1 1 ) 39–50

Listing 3 – Result of analyzing power bands using episodes.

this example is merely to explain how our RHRV package could


Table 1 – Differences in LF/HF ratios (R) for the three
be used for testing a hypothesis, and is not meant to suggest a types of apnea episodes, and corresponding 95%CIs.
rigorous clinical procedure for experiments of sleep apnea and
OBSAPNEA GENHYPO
ischaemia.
As was mentioned previously, HRV is a good indicator of GENHYPO
R 0.152
the status of the neurovegetative control system and, as such,
95%CI (−0.331, 0.028)
is a good non-invasive indicator of some pathologies. Its rela-
tion with sleep apnea has been established by several papers CENAPNEA
[25–27]. Nonetheless, our analysis of the LF/HF ratio, which R 0.816 0.969
95%CI (0.641, 0.991) (−1.108, −0.829)
is used as an indicator of balance between sympathetic and
parasympathetic systems, is not conclusive.
The software implementation of these steps, using the
In this study, the RHRV software package was used to
RHRV package, is given in Listing 4.
calculate the LF/HF ratio for the ECG apnea events pre-
Results were evaluated employing a t-test that estimates
viously described: in particular for OBSAPNEA, GENHYPO, and
the 95% confidence intervals (95%CIs) and the p-value. Statis-
CENAPNEA. This was done in order to determine if statisti-
tically significant differences were obtained for the LF/HF ratio
cal differences can be discerned from the three types of sleep
for all the types of apnea episodes, which are given in Table 1.
apnea classes. To do this with our software, the following steps
A general statistical condition for two independent sets to be
are required:
significantly different, with respect to a given variable, is that
the variable does not assume a zero value within the corres-
ponding 95% confidence interval (CI) [28]. From this definition,
1. Create the data structure. we found significant differences when comparing the CENAP-
2. Load the heart beats and the apnea episodes from the NEA events with the GENHYPO and OBSAPNEA episodes. The
annotation file. box-plot in Fig. 8 shows the average LF/HF ratios, quartiles,
3. Estimate the non-interpolated heart rate (NIHR) frequency. maximum, and minimum obtained from power spectral ana-
4. Reject artifacts with the automatic filter and manual edi- lysis applied to the apnea episodes of the study.
ting. This clinical example also illustrates other useful functions
5. Interpolate the heart rate signal at 4 Hz. of the RHRV software package. In particular, the software can
6. Create a data structure for the frequency analysis. be used to compare the heart rate data prior-, or posterior-, to an
7. Perform a power spectral analysis using a Short-Time Fou- annotated apnea episode interval. Such a study could be useful
rier Transform (STFT) with a window size of 30 seconds, for searching for patterns or testing hypothesis of the origins
a displacement of 2.5 seconds and a zero-padding of 1024 of apnea. For this task, we generated two new episodes: the
samples. Next, the power spectra were calculated for each first was 5 minutes before the given OBSAPNEA apnea episode,
spectral band (ULF, VLF, LF and HF), as well as the total and the second was 5 minutes after the OBSAPNEA episode
power spectrum. The LF/HF ratio was calculated for each (Listing 5). Once these new episodes have been established,
type of apneic events. a new analysis was performed in the same way as descri-
c o m p u t e r m e t h o d s a n d p r o g r a m s i n b i o m e d i c i n e 1 0 3 ( 2 0 1 1 ) 39–50 47

Listing 4 – R file used for clinical experiment.

Listing 5 – Code implementation for generating episodes before and after the apnea events.

bed previously. The result of this analysis is that now we can


obtain LF/HF ratios 5 minutes before and after the OBSAPNEA
episode, which can be used for a statistical comparison. Our
results of this analysis are shown in Table 2.
A careful study of the results of Table 2, reveals that while
no important distinction exists between the posterior- signal as
compared with the apnea episode, there does exist a statistical
difference between the prior- episode as compared with the
apneic episode. While these results are suggestive, this is by
no means an exhaustive study, and is only meant to illustrate
the use of our software package.

Table 2 – Differences in LF/HF ratios (R) and 95%CIs for


before, during and after obstructive apnea episodes.
5 minutes before 5 minutes after
OBSAPNEA OBSAPNEA
OBSAPNEA
Fig. 8 – Average LF/HF ratios for the OBSAPNEA, GENHYPO R 0.206 0.095
and CENAPNEA episodes. 95%CI (0.043, 0.368) (−0.256, 0.066)
48 c o m p u t e r m e t h o d s a n d p r o g r a m s i n b i o m e d i c i n e 1 0 3 ( 2 0 1 1 ) 39–50

Fig. 9 – Non-interpolated HR and spectrogram obtained with RHRV and matplotlib.

data model, thereby making their functions compatible with


5. Discussion the entire RHRV library.
Using open source software offers a number of advantages
We believe that the examples of the previous section demons- for integrating the package with other systems. As an example,
trate both the adequacy and intuitive design of our R software Fig. 9 shows a plot with data generated from our R package
package for analyzing the heart rate variability. The soft- and processed through matplotlib [30], which is a powerful
ware package is easily downloaded and installed, following graphic library developed for python. The plot shows the non-
standard procedures for third party software for the R plat- interpolated heart rate and the spectrogram (white lines mark
form. Updates of our software are periodically uploaded to the limits of the ULF, VLF, LF and HF bands). Matplotlib is beco-
the public R-CRAN repository, together with a detailed change ming popular among scientists for its flexibility for producing
log. Moreover, the source code is completely available under complex plots. This example demonstrates that while no spe-
an open source license, allowing researchers to mold the tool cific bindings have been included yet into the R language for
to their requirements. matplotlib, the open design of our package permits unlimi-
Our data model with R offers a great degree of flexibility ted possibilites for the user to combine the output with other
for a wide spectrum of users. To make our package easier to tools.
use, we have developed a web-service application [31] that is At present, our R package is being used in two Spanish
capable of executing the application directly from a web brow- hospitals for heart rate variability analysis, specifically for
ser, without the need to install software, as can be seen in analyzing records from apneic patients. Results from recent
Fig. 10. This web interface could be useful for physicians that clinical studies, that we obtained by using our package, have
desire results offered by our software, without having to install been accepted for publication, and will appear soon [29]. We
the R environment. This service offers researchers the possibi- have also begun a study with the use of our package for ana-
lity of analyzing their own records in our server, obtain results, lyzing patients with Chronic Obstructive Pulmonary disease.
visualize them and download numerical results in ASCII for- While a stable version is presently being used in a hospital
mat. R users with modest programming skills can integrate setting and by other research groups, we are continually inclu-
the data model and the RHRV functions into their own scripts, ding improvements and new algorithms into the package. In
as can be seen in the examples included in this paper. At the particular, the next major version of our software will include
other end of the spectrum, advanced users can easily modify in time domain and non-linear fractal dimension analysis.
existing RHRV functions or add their own algorithms using our
c o m p u t e r m e t h o d s a n d p r o g r a m s i n b i o m e d i c i n e 1 0 3 ( 2 0 1 1 ) 39–50 49

Fig. 10 – Integration of RHRV in a web application.

[4] J.A. Vila, F. Palacios, J. Rodrguez-Presedo, M.


Acknowledgements Fernández-Delgado, P. Félix, S. Barro, Time–frequency
analysis of heart-rate variability, IEEE Engineering in
This work was supported by the Xunta de Galicia under the Medicine and Biology Magazine 16 (1997) 119–125.
grant 08SIN002206PR and the Spanish Ministry under the grant [5] P. Mansier, J. Clairambault, N. Charlotte, C. Medigue, C.
Vermeiren, G. Lepape, F. Carre, A. Gounaropoulou, B.
TIN-2006-15460-C04-02.
Swynghedauw, Linear and non-linear analyses of heart rate
variability: a minireview, Cardiovascular Research 31 (13)
(1996) 371–379.
[6] M. Malik, A.J. Camm (Eds.), Heart Rate Variability, Futura
references Publishing Company, Armonk, NY, 1995.
[7] X.A. Vila, Análisis de la variabilidad de señales fisiológicas.
Integración en un sistema de monitorización inteligente,
[1] B.W. Hyndman, R.I. Kitney, B. Sayers, Spontaneous rhythms Ph.D. Dissertation, Univ. Santiago de Compostela, Spain,
in physiological control systems, Nature 233 (1971) 339–341. 1997 (in Spanish).
[2] B. Sayers, Analysis of heart rate variability, Ergonomics 16 [8] http://cinc2009.org/.
(1973) 17–32. [9] G.B. Moody, R.G. Mark, A.L. Goldberger, PhysioNet: a
[3] S. Akselrod, D. Gordon, F.A. Ubel, D.C. Shannon, A.C. Berger, Web-based resource for the study of physiologic signals,
R.J. Cohen, Power spectrum analysis of heart rate IEEE Engineering in Medicine and Biology 20 (3) (2001) 70–75.
fluctuations: a quantitative probe of beat-to-beat [10] National Instruments, Using LabVIEW For Heart Rate
cardiovascular control, Science 213 (1981) 220–222. Variability Analysis, Published online at
50 c o m p u t e r m e t h o d s a n d p r o g r a m s i n b i o m e d i c i n e 1 0 3 ( 2 0 1 1 ) 39–50

http://zone.ni.com/devzone/cda/epd/p/id/5832 on April 24, [22] http://www.milegroup.net/files.


2009. [23] T. Penzel, G.B. Moody, R.G. Mark, A.L. Goldberger, J.H. Peter,
[11] http://www.physionet.org/physiotools/wfdb.shtml. The apnea-ECG database, Computers in Cardiology (2000)
[12] Physionet, Heart Rate Variability Analysis with the HRV 255–258.
Toolkit: Basic Time and Frequency Domain Measures, [24] http://www.physionet.org/physiobank/.
Published online at http://www.physionet.org/tutorials/ [25] K. Narkiewicz, N. Montano, C. Cogliati, P.J.H. van de Borne,
hrv-toolkit/ on August 4, 2009. M.E. Dyken, V.K. Somers, Altered cardiovascular variability
[13] Physionet, Analyzing Heart Rate Variability Using the HRV in obstructive sleep apnea, Circulation 98 (1998) 1071–1077.
Toolkit, Published online at http://www.physionet.org/ [26] L.J. Gula, A.D. Krahn, A. Skanes, K.A. Ferguson, C. George, R.
tutorials on January 29, 2009. Yee, G.J. Klein, Heart rate variability in obstructive sleep
[14] L. Rodríguez-Liñares, X. Vila, A.J. Méndez, M.J. Lado, D. apnea: a prospective study and frequency domain analysis,
Olivieri, RHRV: an R-based software package for heart rate Annals of Non-invasive Electrocardiology (ANE) 8 (2003)
variability analysis of ECG recordings, in: 3rd Iberian 144–149.
Conference in Systems and Information Technologies (CISTI [27] T. Penzel, J.W. Kantelhardt, L. Grote, J.H. Peter, A. Bunde,
2008), Ourense, Spain, 2008, pp. 565–574. Comparison of detrended fluctuations and spectral analysis
[15] D. Kaplan, P. Stafin, Software for Heart Rate Variability, for heart rate variability in sleep and sleep apnea, IEEE
Published online at http://www.macalester.edu/kaplan/ Transactions on Biomedical Engineering 50 (2003) 1143–1151.
hrv/doc. [28] A. Grafen, R. Hails, Modern Statistics for the Life Sciences,
[16] J.P. Niskanen, M.P. Tarvainen, P.O. Ranta-aho, P.A. Oxford University Press, New York, 2002.
Karjalainen, Software for advanced HRV analysis, Computer [29] M.J. Lado, X. Vila, L. Rodríguez-Liñares, A.J. Méndez, D.
Methods and Programs in Biomedicine 76 (1) (2004) Olivieri, P. Félix, Detecting Sleep Apnea by Heart Rate
73–81. Variability Analysis: Assessing the Validity of Databases and
[17] http://kubios.uku.fi. Algorithms, Journal of Medical Systems, in press.
[18] http://www.nevrokard.eu/index.html. doi:10.1007/s10916-009-9383-5.
[19] http://www.edfplus.info/index.html. [30] http://matplotlib.sourceforge.net.
[20] http://www.r-project.org/. [31] http://www.hrv-site.net.
[21] http://cran.r-project.org/.

View publication stats

Potrebbero piacerti anche