You are on page 1of 8

468 IEEE TRANSACTIONS ON INFORMATION TECHNOLOGY IN BIOMEDICINE, VOL. 10, NO.

3, JULY 2006
Combining Algorithms in Automatic Detection of
QRS Complexes in ECG Signals
Carsten Meyer, Jos e Fern andez Gavela, and Matthew Harris
AbstractQRS complex and specically R-Peak detection is the
crucial rst step in every automatic electrocardiogram analysis.
Much work has been carried out in this eld, using various meth-
ods ranging fromltering and threshold methods, through wavelet
methods, to neural networks and others. Performance is generally
good, but each method has situations where it fails. In this paper,
we suggest an approach to automatically combine different QRS
complex detection algorithms, here the PanTompkins and wavelet
algorithms, to benet fromthe strengths of bothmethods. Inpartic-
ular, we introduce parameters allowing to balance the contribution
of the individual algorithms; these parameters are estimated in a
data-driven way. Experimental results and analysis are provided
on the Massachusetts Institute of Technology-Beth Israel Hospital
(MIT-BIH) Arrhythmia Database. We show that our combination
approach outperforms both individual algorithms.
Index TermsAutomatic QRS complex detection, automatic
R-peak detection, combination algorithm, ensemble method,
Massachusetts Institute of Technology-Beth Israel Hospital (MIT-
BIH) Arrhythmia Database, Pan-Tompkins algorithm, wavelet al-
gorithm.
I. INTRODUCTION
T
HE QRS complex is the most prominent feature in the
electrocardiogram (ECG) signal and corresponds to the
ventricular excitation. The automatic detection of QRS com-
plexes (and central R-peaks) in an ECG signal is the crucial
rst step in any automatic ECG analysis. A number of algorith-
mic techniques have been developed for automatic ECG signal
segmentation and, in particular, QRS complex detection.
Many QRS complex detection algorithms involve a prepro-
cessor stage, where the ECG signal is transformed to accentuate
the QRS complex, and a decision stage, where a QRS com-
plex is detected, using thresholding. The most well known such
method is the PanTompkins (PT) algorithm [1]. Neural net-
works, trained to be adaptive nonlinear predictors of the ECG
signal, have been used for QRS complex detection [2], [3]. As
most of the ECG signal contains non-QRS segments, and the
signal in a QRS segment looks very different to the rest of
the signal, such neural networks have a high-prediction error
on QRS segments (and low-prediction error elsewhere). Con-
sequently, the prediction error constitutes a feature for QRS
complex detection [2], [3]. In another method, adaptive lters
Manuscript received August 30, 2005; revised December 8, 2005 and
December 16, 2005. This work was supported by the E.U. Marie Curie In-
dustry Host Fellowship Program under Contract IST-2001-82941.
C. Meyer and M. Harris are with Philips Research Laboratories, D-52066
Aachen, Germany (e-mail: carsten.meyer@philips.com; matthew.harris@
philips.com).
J. Fern andez Gavela was with Philips Research Laboratories, D-52066
Aachen, Germany. He is now with Telef onica Soluciones, E-28020 Madrid,
Spain.
Digital Object Identier 10.1109/TITB.2006.875662
have been used to give an estimate of the current ECG sample
as a weighted sum of previous ECG samples. The weights in
the sum are updated according to the changing signal statistics.
Sharp changes in the weights and in the errors of the current ECG
sample estimate were used as features for QRS complex detec-
tion (see, e.g., [4]). Other approaches include cross-correlation
methods, where a QRS-complex template is aligned to the ECG
signal [5], and syntactic approaches, where the ECG signal is
represented as a piecewise linear approximation, and is analyzed
using syntactic rules [6], [7]. For an overview of these and other
approaches see, e.g., [8] and [9].
However, the large variation in the QRS complex waveforms
as well as noise continue to present challenges to the algorithms,
so that further performance improvements are still an important
goal of current research.
Instead of further optimizing any individual QRS detection
method, we focus in this paper on combining two such state-
of-the-art algorithms, namely, the PT [1] and the wavelet algo-
rithm[10][12]. This is motivated rst by the general notion that
such a combination approach, which can be seen as an example
for an ensemble classier,
1
may improve upon the perfor-
mance of the individual classiers [13]. Second, for the task of
QRS complex detection, the large performance gain that can be
achieved by the optimal combination of the two algorithms
determined on our database in a cheating experiment (see
Section III-B)strongly motivate a combination approach. The
goal of our paper is to develop a data-driven framework for
combining algorithms in automatic QRS complex detection.
In a previous approach, Moraes et al. [14] combined two QRS
detection methods, namely, an algorithm proposed by Engelse
and Zeelenberg [15] and a second one based on the PT and
LigtenbergKunt algorithms [16]. In this approach, classica-
tion by the secondary detector is invoked only in case the rst
classier observes an undened event [14]. In this case, the
output fromthe secondary detector is used to determine whether
the event is a QRS complex.
Our combination algorithm differs from the approach by
Moraes et al. in three aspects: First, in our approach, the predic-
tion of both algorithms always enter into determining the nal
decision. Second, we propose a exible (instead of a xed)
combination scheme which is triggered by two parameters al-
lowing to balance the inuence of the two individual algorithms.
Third, these parameters are estimated in a data-driven way al-
lowing to adapt our combination scheme to individual data sets.
In experiments on the Massachusetts Institute of Technology-
Beth Israel Hospital (MIT-BIH) Arrhythmia Database, we show
1
By classication we mean the binary decision of detecting or not detecting
a QRS complex in a given time frame.
1089-7771/$20.00 2006 IEEE









MEYER et al.: COMBINING ALGORITHMS IN AUTOMATIC DETECTION OF QRS COMPLEXES IN ECG SIGNALS 469
that our combination approach improves performance over both
individual algorithms.
This paper is organized as follows. In Section II, we give a
brief description of the PT and wavelet algorithms used in our
combination approach. Section III is dedicated to describing
our framework for combining the two QRS complex detection
methods. This also includes an oracle experiment yielding the
best possible combination performance (Section III-B). In Sec-
tion IV, we experimentally evaluate our algorithm, including
some analysis and examples. Finally, in Section V, we discuss
and conclude our study.
II. QRS COMPLEX DETECTION METHODS USED IN OUR
COMBINATION ALGORITHM
We apply our combination approach to the PT and wavelet
QRS detection algorithms, which are among the best perform-
ing algorithms for this task [17]. In this section, we briey
describe both methods; for more details, we refer the reader to
the corresponding papers.
A. PT Method
The PT algorithm [1] is the most well-known example of a
lter threshold method for QRS complex detection. It comprises
a bandpass lter, a differentiator, a squaring operation, and a
moving window integrator. The bandpass lter lters out excess
noise. The differentiator and squaring operation accentuate steep
prominent features and the integrator carries out a smoothing
operation, whose window length might be adjusted such that
features with a particular width are accentuated.
The key parameter in the PT method is the threshold . QRS
complexes are detected in regions where the ltered signal rises
above the threshold . If no peak is detected within a time
interval , QRS complexes are looked for where the ltered
signal rises above a second, lower threshold
2
(a xed fraction
of ). Also, QRS complexes are not allowed to be within 0.3 s
(refractory time
2
) of each other. The thresholds and
2
are
dynamically updated according to the amplitudes of the R-peak
maxima in the ltered signal. For a more detailed description of
the algorithm see [1].
Interesting for our combination approach is the threshold
parameter . By varying this parameter, we can control the
sensitivity of the algorithm and, thus, the number of detected
QRS complexes. Increasing results in only very prominent
maxima in the ltered signal being found (and thus very likely
QRS complexes) and lowering means more maxima will be
predicted, some of which may be noise.
B. Wavelet Method
In our experiments, we used the wavelet QRS detector de-
scribed by Li et al. [10] and Mallat and Hwang [11].
2
In our experiments on noisy excerpts, large P-waves between 200 and 300 ms
from the QRS complex were additionally detected as QRS complexes. There-
fore, we obtained better results on our database with 0.3 s refractory time than
with 0.2 s, as used in [1].
The wavelet transform is a decomposition of a signal into
a set of basis functions, similar to a Fourier decomposition.
In the Fourier decomposition, the basis functions are dilations
and translations of the sine function. Comparably, the wavelet
basis functions are dilations (characterized by a parameter a)
and translations (characterized by a parameter b) of a prototype
function (x) with bounded support, called the mother wavelet.
The transformation W(a, b) of function x(t) is, thus, dened as
W(a, b)(x) =
1

x(t)

t b
a

dt. (1)
Examining the components of the wider (more dilated) ba-
sis functions (large a) gives information about the lower fre-
quency components of the signal as a function of time (b in
the transformed space). Similarly, the components for small a
give high-frequency information about the signal as a function
of time. By choosing a = 2
j
and b = 2
j
l (called the dyadic
wavelet transform), the wavelet transformation can be simply
implemented with repeated use of nite-impulse response l-
ters [12], [17], [18]. We thus obtain a sequence of functions
(indexed by j), which are called scales. Low scales contain
high-frequency information about the signal and high scales
contain low-frequency information about the signal.
In the wavelet QRS detection algorithm from Li et al. [10],
the rst four scales of the wavelet transformation are considered.
The rst scale contains high-frequency noise and the QRS com-
plex. The QRS complex is so prominent that it is clearly visible
on all four scales; however, it is most prominent in the second
and third scales. The fourth scale contains lower frequency in-
formation including T-wave information and baseline drift. The
wavelet method for detecting QRS complexes involves identify-
ing clear peaks in each scale and matching themcorrectly across
the different scales. For more details, see [10].
III. COMBINATION APPROACH
A. Motivation
The PT algorithm is good at detecting clear QRS complexes,
but is less able to detect wider QRS complexes, like prema-
ture ventricular contractions. The implemented wavelet method
is better able to detect wider and unusually shaped QRS com-
plexes, but is sometimes prone to missing some normal shaped
complexes. By combining the predictions of the two classiers,
we aimto obtain an improved QRS complex detection algorithm
combining the strengths of the individual algorithms, while
compensating their weaknesses. Our combination approach is
an example for an ensemble classier (see, e.g., [13]). As dis-
cussed in [13], an ensemble classier can be more accurate than
any of its individual members if the individual classiers are
doing better than random guessing and if they make different
(uncorrelated) errors on new data points [19]. This motivates
our approach from a theoretical perspective.
The second motivation comes from an empirical validation,
by evaluating the maximal improvement that can be obtained by
combining the base algorithms, assuming the perfect decision
strategy if both classiers disagree in their predictions. This will
be explained in Section III-B.









470 IEEE TRANSACTIONS ON INFORMATION TECHNOLOGY IN BIOMEDICINE, VOL. 10, NO. 3, JULY 2006
B. Oracle Experiment
In this section, we determine the maximal performance gain
that can be achieved by our combination approach over the
individual algorithms by assuming the perfect decision strategy
(oracle experiment).
First, it is reasonable to assume that in case of agreement
of the two algorithms whether to predict a QRS complex
location or not, this decision is accepted (majority vote).
At times where both algorithms make the wrong decision, the
combination will also be incorrect. Thus, there is an intrinsic
lower bound to the error rate that can be achieved by the
optimal combination, dictated by the accuracy of the two
individual algorithms. If instead the two algorithms disagree
about the presence of a QRS complex at a given time, in the
oracle experiment the idea is to take the correct decision, using
the cardiologist annotation. Formally, this can be viewed as
adding a third classier to the ensemble performing a perfect
classication (corresponding to the manual annotation) and
accepting the majority vote of the three classiers. This is
a cheating experiment giving the result for the best possible
combination of the two individual algorithms. The results of the
oracle experiment (discussed in Section IV) demonstrate that
the QRS detection performance can be dramatically improved
by optimally combining the two individual detection methods.
This indicates that the PT and wavelet methods partly contain
complementary information about the location of the QRS
complexes. This strongly motivates a combination approach.
In Section III-C, we suggest an automatic decision strategy
that does not use the manual annotation.
C. Combination Algorithm
In our combination approach, rst the two individual algo-
rithms (wavelet and PT) are run in parallel. If both classiers
agree whether to predict a QRS complex location at time t, this
decision is accepted. In case of disagreement between the two
individual classiers at time t, the basic idea is to rerun the PT
algorithm
3
locally (i.e., in a suitable time windowaround time t),
however with adjusted threshold

. More specically, we intro-


duce two parameters [0; 1] and [1; ), which specify
the amount of PT threshold reduction and increase, respectively,
in the local PT rerun. The parameter is used to reduce the PT
threshold when the PT method does not detect a QRS complex
location at time t, however the wavelet algorithm does. Con-
versely, the factor is applied to increase the PT threshold when
PT detects a QRS complex location at time t, but wavelet does
not. Intuitively, the parameters and test the condence
of the PT decision with respect to a threshold change, trying to
reproduce the wavelet decision. The result of the local PT rerun
with adjusted threshold determines whether or not to accept the
QRS complex in the nal output. This decision process for our
data-driven combination algorithm is displayed in Table I.
3
The PT method is controlled by few simple thresholds that have a direct
and intuitive inuence on the detected QRS complex location times. In contrast,
changing thresholds in the wavelet method affects the identication of peaks
in the different scales and, thus, makes correct matching across scales hard to
control.
TABLE I
COMBINED QRS COMPLEX DETECTION ALGORITHM. DETECTION DENOTED
1, NO DETECTION 0. PT: PAN-TOMPKINS, WVT: WAVELET
Fig. 1. Theoretical limiting cases of the combination algorithm in the two-
dimensional array of (, )-values. WVT: wavelet, PT: PanTompkins method.
There are several reasons for introducing two parameters
and . First, a parameterization of the decision strategy allows
to adapt the combination algorithm to different data sets by
appropriately selecting parameter values. Second, two separate
parameters for threshold adjustment allow to independently ad-
dress QRS complexes missed by PT and wavelet, respectively.
Moreover, for suitable parameter values, our combination
algorithm can recover both individual algorithms as well as
realize other simple combinations of the two classiers, as
shown in Fig. 1: By setting = 0 and , the combination
algorithm is equivalent to the wavelet method; setting = 1
and = 1 recovers the PT method. Choosing = 0 and = 1
leads, for local PT and wavelet predictions on the presence of
a QRS complex at time t, to the logical OR of the two binary
predictions; this is equivalent to the Boolean union of the two
sets of QRS complex locations. Finally, setting = 1 and
locally realizes the logical AND, i.e., a consensus
decision, where a QRS complex is detected if and only if it is
predicted by both the wavelet and the PT algorithm (equivalent
to the Boolean intersection of the QRS complex locations).
4
From Fig. 1 it can be inferred that by increasing , the QRS
complexes predicted only by the wavelet algorithm are increas-
ingly removed. In contrast, increasing more and more removes
the contribution of QRS complexes predicted only by the PT
algorithm.
Since our combination algorithm can interpolate between the
predictions of both individual algorithms as well as Boolean
combinations, we can expect to improve performance over the
best individual algorithm by optimizing the values of the pa-
rameters and . This will be explained in more detail in
Section III-D.
4
In practice, we cannot apply our combination approach if 0, since in
this case, the PT algorithmfails. This is as QRS complexes are detected between
up and down crossings of the threshold . If the threshold is too low, the whole
signal is above the threshold and there are no longer any threshold crossings.









MEYER et al.: COMBINING ALGORITHMS IN AUTOMATIC DETECTION OF QRS COMPLEXES IN ECG SIGNALS 471
So far, we have assumed a suitably discretized time scale
for QRS complex detection, e.g., dened by the sample rate.
In practice, a large sample rate may lead the two algorithms to
position the same QRS complex at slightly different times t
1
and t
2
. We introduce a tolerance interval to account for phys-
iological relevance of such small time misplacements. Specif-
ically, we match QRS complex locations predicted by the two
algorithms at slightly different times t
1
and t
2
, i.e., treat them
as a single QRS complex, if t
1
and t
2
are within of each
other (peak matching). This generally keeps the combina-
tion algorithms from predicting two different QRS complexes
within the interval , which is especially important for the
Boolean union (see Section IV-C2). Moreover, the location of
a slightly misplaced peak in one method may be corrected in
the combination. In all experiments described in Section IV,
peak matching is performed before applying any combination
algorithm. The impact of is experimentally investigated in
Section IV-C2.
Any matched QRS complex (predicted by both the PT
and the wavelet method within the tolerance interval ) is
accepted by all investigated combination algorithms, i.e., a
QRS complex location is detected at the time of the larger peak.
Unmatched QRS complexes, i.e., QRS complexes predicted
by only one algorithm within , are treated as follows. Our
data-driven combination algorithm, as explained above, decides
on acceptance of the QRS complexes by the (local) PT rerun
with adjusted threshold

(see Table I). In contrast, the union


algorithm accepts all unmatched QRS complexes, while the
intersection algorithm accepts no unmatched QRS complex.
Finally, the oracle approach selects the correct decision,
i.e., does or does not accept the unmatched QRS complex,
depending on the cardiologists annotation.
D. Estimation of Parameters and
Unfortunately, we do not know a priori the (locally) optimal
values for and , which will yield the correct decision at a
particular time where both algorithms make different predic-
tions. Therefore, we need a decision criterion to select suitable
values. Having chosen the values for and , the combina-
tion algorithm will be able to correct some of the errors in
the original PT predictions triggered by corresponding wavelet
predictions (if the wavelet decision was correct at the position
considered). On the other hand, also new errors to the origi-
nal PT predictions may be introduced (if the wavelet decision
happened to be wrong at the particular position). Therefore, the
values for and must be carefully selected in order to optimize
performance.
A simple and effective strategy is to estimate both parameters
in a data-driven way by minimizing the number of errors (as
dened in Section IV-B) on separate training data. In the fol-
lowing, we assume global (i.e., patient- and time-independent)
values for and (Section IV-C1. However, other estimation
criteria (e.g., unsupervised estimation on patient-specic data)
are also conceivable.
In Section IV, we discuss our experimental results on the
MIT-BIH Arrhythmia Database.
IV. EXPERIMENTS
A. Database
The MIT-BIH Arrhythmia Database was used for develop-
ment and analysis of our QRS complex detection algorithm.
This database contains 48 half-hour excerpts of two-channel
ambulatory ECG recordings, sampled at 360 Hz, including 23
recordings from a random selection of a mixed population and
25 recordings from selected patients with less common but clin-
ically signicant arrhythmias. The MIT-BIH database contains
110 k beats in total (on average about 2280 450 per patient).
More information on the database can be found in [20] and in
the Internet.
5
The algorithms in this paper were run only with
the rst of the two channels from each excerpt (as the base
algorithms were designed for one channel input).
By extracting every third excerpt, we divided the data into
training and test sets. The training set (30 excerpts, 66 103 QRS
complexes) was used to estimate the optimal values for the
parameters and , while the test set (17 excerpts, 41 529
QRS complexes) was used to evaluate the algorithms using the
parameter values estimated on the training set.
6
B. Error Rates
We will discuss the accuracy of the algorithms in various
ways. We will talk about two sorts of errors: false positives
(FPincorrectly detected QRS complexes) and false negatives
(FNmissed QRS complexes). We will call the sum of FP
and FN the total error (# error). We will give the total error
in absolute value and as a percentage of the total number of
annotated QRS complexes (% error). A QRS complex is taken
to be correctly detected if it is detected within 100 ms of the
annotation time. The general conclusions of the paper are not
affected if this tolerance is reduced.
C. Training
1) Estimation of and by Minimizing the Training Error:
As discussed in Section III-D, a simple way to estimate global
(patient- and time-independent) values for the parameters
and is to minimize the number of errors (i.e., the sum of
FPs and FNs) on separate training data, collected from various
representative patients. Since changes of and affect different
subsets of QRS complex locations, we can optimize the two
values independently. Thus, we rst set = 1 and choose
opt
in order to minimize the total number of FPs and FNs [Fig. 2(a)].
As expected, with decreasing , the number of FNs decreases
and the number of FPs increases since more and more wavelet
QRS complex predictions are considered in addition to the PT
predictions. For the sum of FPs and FNs, we see a shallow
minimumaround = 0.3 and select an optimal value of
opt
=
0.3.
Then, using
opt
= 0.3, we choose
opt
to minimize the
total number of FPs and FNs as a function of [Fig. 2(b)].
5
www.physionet.org/physiobank/database/html/mitdbdir/intro.htm
6
The excerpt 207 was not used, neither in the training nor the test set due to
bad performance of both base algorithms.









472 IEEE TRANSACTIONS ON INFORMATION TECHNOLOGY IN BIOMEDICINE, VOL. 10, NO. 3, JULY 2006
Fig. 2. Number of FPs, FNs, and their sumon the training data (a) as a function
of for = 1.0 and (b) as a function of for = 0.3.
Increasing yields the expected behavior of decreasing FPs
and increasing FNs, since we increasingly remove PT QRS
complex predictions. Here, however, the total number of FPs
and FNs has its (shallow) optimum at
opt
= 1. This is because
for most patients, the number of PTFPs is very small. Therefore,
there is no gain in further removing PT predictions by setting
> 1. Thus, we select globally optimized values of
opt
= 0.3
and
opt
= 1.0.
2) Inuence of Peak Matching Interval : The peak
matching interval (introduced in Section III-C) arises since
it does not make sense physiologically to distinguish QRS com-
plex locations t
1
and t
2
if their time difference is smaller than
some threshold value . Therefore, such QRS complexes are
matched, i.e., treated as a single QRS complex.
7
The value of
may inuence the number of detected QRS complexes in any
combination algorithm.
7
The location of the larger of the two R-peaks is selected. In the oracle
experiment, if the detected QRS complexes correspond to an annotated QRS
complex, the location of the R-peak being closer to the annotated R-peak is
chosen.
Fig. 3. Number of errors on the training set as a function of the peak matching
interval , for the union, our data-driven combination algorithm ( = 0.3, =
1.0), and the oracle. The intersection shows only a weak dependence on and
is not shown due to its large error rate.
TABLE II
TRAINING ERROR USING ORIGINAL AND COMBINATION METHODS
Except for the union, however, we observed only a weak de-
pendence of the training error on the value of in the investigated
interval (see Fig. 3). For the union, the error rate increases with
decreasing . For a smaller peak matching interval, more and
more QRS complexes predicted by PT and wavelet at slightly
different times will be treated independently (not matched), and
the union then accepts them as separate QRS complexes, giving
rise to FPs. Our data-driven combination algorithm, however, is
able to reject most of these FPs in the PT rerun, so that its error
rate is nearly independent of the value of in the investigated
interval.
8
For analogous reasons, also the training error for the
oracle and intersection show only a small variation with in the
investigated interval.
3) Training Results: In Table II we compare the training
error of our combination algorithm against the union and in-
tersection algorithms as well as the optimal oracle method (see
Section III-C). We chose = 240 ms in order to have a fair
comparison to the union.
On the training set, we obtain better performance for the
PT than for the wavelet algorithm (373 versus 455 errors). The
union algorithmstrongly decreases the error rate (to 272 errors),
mostly due to reducing the number of FNs as a result of combin-
ing the QRS complex predictions of both algorithms. Note that
8
This was conrmed on the test set, where = 120 ms and = 240 ms
resulted in similar error rates.









MEYER et al.: COMBINING ALGORITHMS IN AUTOMATIC DETECTION OF QRS COMPLEXES IN ECG SIGNALS 473
Fig. 4. (Absolute) error reduction by our combination algorithm ( =
0.3, = 1.0) as compared to the PT algorithm, as a function of the PT er-
ror rate (in %, logarithmic scale) for the individual patients of the MIT-BIH
Database. 13 patients (5 training, 8 test) have zero error on both the PT and
combination algorithm and are not shown.
TABLE III
ERROR ON THE TEST SET USING VARIOUS ORIGINAL
AND COMBINATION METHODS
because of peak matching, only the larger peak of two QRScom-
plexes predicted by both algorithms within the time interval is
accepted in order to avoid too many FPs; = 240 ms is nearly
optimal for the union (see Fig. 3). Our data-driven combination
algorithm signicantly decreases the number of FPs compared
to the union leading to 227 training errors for the (globally)
optimal values = 0.3 and = 1.0. This error rate is hardly
affected by modifying in an interval [0.25; 0.4] and in an
interval [1.0; 1.1]. The best error rate that can be achieved by
optimally combining the wavelet and PT algorithms, given by
the (cheating) oracle method, is 159 errors. In Fig. 4, results of
our combination algorithm are compared with the PT algorithm
for the individual patients.
D. Test Results
Results on the test set are shown in Table III ( = 240 ms).
Again, we obtained fewer errors with the PT method than with
the wavelet algorithm on our database. Note that for the patients
105 and 108, the wavelet algorithm produced a large number of
extra errors (see below).
The general trends discussed in Section IV-C3 are also ob-
served on the test data. In particular, the union and our combi-
nation approach dramatically reduce the number of FNs com-
pared to the individual algorithms. However, the large number
of wavelet errors especially on the excerpts 105 and 108 detri-
ments the union and our combination algorithm. One reason for
the large number of wavelet errors is that the wavelet algorithm
is often unable to identify the correct location of potential QRS
complexes. A misplaced wavelet peak may result in two errors,
namely, a FN and a FP error (if it is more than 100 ms from the
annotated position). On the other hand, peak matching with suf-
ciently large (see Section IV-C2) removes such an error pair,
if there is a nearby more pronounced PT peak that is matched
with the wavelet peak.
9
Although (nearly) optimizing the peak
matching interval for the union, the large number of wavelet
FPs in particular on patients 105 and 108 detriments the union
so that it performs worse than PT on the (complete) test set. In
contrast, our data-driven combination algorithm allows to re-
duce this effect and limit the number of FPs by accepting only a
subset of the wavelet QRScomplex predictions controlled by the
parameter . (In addition, FPs predicted by PT can be removed
by increasing ). Thus, our combination approach outperforms
both the union and the PT algorithm on the test set.
The negative effect of the wavelet FPs on the performance
of the union (and our combination algorithm) can be seen by
removing excerpts 105 and 108 from the test data. Then, both
the union and our combination algorithm clearly outperformthe
PT method by strongly decreasing the number of PT FNs while
inserting only a small number of additional FPs compared to PT.
Our data-driven combination method (slightly) improves upon
the union by further reducing the number of FPs. However, recall
that the performance of the union has been nearly optimized
by setting = 240 ms. In contrast, our combination algorithm
nearly gave the same results when using = 120 ms instead of
= 240 ms.
Again, the results for our combination algorithm are hardly
affected by variations of the (global) value for within the
interval [0.25; 0.4]. On the test set, however, slightly increasing
has a larger effect on the error rate than observed on the
training set, since the (relative) number of PT FPs is larger on
the test set than on the training set (especially for patients 105
and 108).
E. Individual Patient Results
Combining our training and test results,
10
we arrive at an
error rate of 0.70% for our data-driven combination approach
( = 0.3, = 1.0), compared to 0.85% for the PT algorithm,
1.36% for wavelet, and 0.83% for the union. Fig. 4 shows the
(absolute) error reduction by our combination algorithm com-
pared to the PT method for the individual patients, as a function
of the patients PT error rate. For 24 patients, our combination
approach reduces the number of PT errors (on the average by
9.5 errors per patient); 20 patients yield identical results and for
four patients (105, 108, 111, 232) our data-driven combination
increases the number of errors compared to PT. This is mostly
due to the large number of wavelet FPs (see above), especially
9
This is an explanation for the union having less FP errors than the wavelet
algorithm.
10
Including patient 207.









474 IEEE TRANSACTIONS ON INFORMATION TECHNOLOGY IN BIOMEDICINE, VOL. 10, NO. 3, JULY 2006
Fig. 5. Example for automatic QRS complex detection: PT method detects
peaks at time points 50, 219, and 386 (dashed lines), and the wavelet method at
time points 219, 386, and 472 (dotted lines); dasheddotted lines refer to QRS
complexes predicted by both algorithms.
for the patients 105 and 108 (showing the largest error increase
with our algorithm). For these patients, by using a larger patient-
specic value for , the number of FPs can be strongly reduced.
For example, using = 0.8 instead of = 0.3 for patient 108,
we observe 18 FPs instead of 55, corresponding to 31 errors
(instead of 63). Conversely, for patients with a large number of
PT FPs, a patient-specic value of > 1 can further decrease
the error rate (e.g., for patient 207, increasing reduces the
number of PT FPs by 50%).
F. Examples
In this section, we illustrate examples for the corrections
made using our data-driven combination algorithm. In Fig. 5,
the combination method correctly accepts all four peaks and thus
corrects a FN from the PT and one from the wavelet method. In
Fig. 6, the combination algorithm correctly predicts a peak at
time point 50, which is the larger of the two peaks at times 41 and
50 (peak matching correction). The wavelet peak at time point
139 is correctly rejected. The wavelet peak at 368 is included
in the combination methoda FP error. The peaks at 275 and
498 were correctly included. Thus, one QRS complex location
is improved and an incorrectly detected QRS complex removed;
however, another incorrect QRS complex is included.
V. DISCUSSION AND CONCLUSION
We developed a framework for combining state-of-the-art
algorithms for detection of QRS complexes in ECG signals,
namely the PT and the wavelet algorithms. The basic idea is to
run both algorithms in parallel. When both methods disagree
whether to predict a QRS complex in a particular time window,
we applied a data-driven strategy for deciding whether or not to
accept the candidate QRS complex. More precisely, in cases of
disagreement, we suggest to locally rerun the PT method with a
modied threshold, accepting the result of the local rerun as the
Fig. 6. Second example for automatic QRS complex detection. Here, the PT
algorithm detects peaks at time points 50, 275, and 498 (dashed lines), and
wavelet at time points 41, 139, 368, and 498 (dotted lines); dasheddotted lines:
prediction by both algorithms.
nal decision. The local decisions can formally be seen as the
majority vote of a (three-component) ensemble classier, where
the third classier repeats one of the rst two classications,
however, with modied threshold. We introduced two parame-
ters and to control the threshold adjustment, which are both
estimated on training data. By varying and we can, in theory,
interpolate between the predictions of the individual algorithms
and Boolean combinations like union and intersection.
We showed that our combination algorithm outperformed
both the best individual algorithm and the union (and intersec-
tion) of the two methods. This is rst due to strongly reducing
the number of missed QRS complexes compared to the base
algorithms, due to combining the predictions of both methods.
Second, our data-driven approach allows to selectively accept
QRS complexes for which the two algorithms disagree, con-
trolled by the (optimized) parameters and . This is espe-
cially important for noisy patients in order to reject a poten-
tially large number of FPs in any of the base algorithms. Fur-
ther evaluations on larger databases remain an issue for future
work.
In our experiments, we used global (patient- and time-
independent) values for and estimated on separate, represen-
tative training data. However, for individual patients, the number
of FPs generated by either the wavelet or the PT method was
much larger than the average. For such patients, patient-specic
values for or , respectively, may remove a fraction of these
FPs, further reducing the error rate of our combination algo-
rithm. The issue of estimating and optimizing patient-specic
values for and remains to be addressed in future work.
Another interesting future research area is how to adjust the
individual algorithms parameters to result in a maximal im-
provement through the combination.
While we were focusing on a single ECG channel, our
approach can easily be applied to two ECG leads as well,









MEYER et al.: COMBINING ALGORITHMS IN AUTOMATIC DETECTION OF QRS COMPLEXES IN ECG SIGNALS 475
combining, e.g., PT predictions from channel 1 with PT pre-
dictions (or other algorithms) from channel 2.
We developed our combination algorithm to combine the
wavelet and PT methods for automatic detection of QRS com-
plexes. Our general framework, however, can be adopted to
other algorithms and other contexts as well, provided a suit-
able parameter can be identied for one of the two algorithms,
which allows to modify the predictions of this algorithm in a
continuous way. The parameters and then merely serve to
interpolate between the individual algorithms and their union
and intersection, as we discussed in detail.
To conclude, our data-driven approach for combining two
algorithms in a binary classication task (in our case QRS com-
plex detection) provides a exible way for improving perfor-
mance compared to the individual algorithms, as well as for
adapting the combined classier to individual data sets (e.g.,
patients or patient groups). Performance improvements can be
expected if a (sufciently large) set of cases exists where both
algorithms disagree in their prediction and if the predictions are
uncorrelated within this set.
ACKNOWLEDGMENT
The authors would like to thank M. Perkuhn and R. Schmidt
for their input to the original idea of combining QRS complex
detection algorithms and for fruitful discussions. They would
also like to thank the reviewers for their useful comments that
helped to improve the clarity of the manuscript.
REFERENCES
[1] J. Pan and W. L. Tompkins, A real-time QRS detection algorithm, IEEE
Trans. Biomed. Eng., vol. BME-32, no. 3, pp. 230236, Mar. 1985.
[2] Q. Xue, Y. H. Hu, and W. J. Tompkins, Neural-network-based adaptive
matched ltering for QRS detection, IEEE Trans. Biomed. Eng., vol. 39,
no. 4, pp. 317329, Apr. 1992.
[3] Y. H. Hu, W. J. Tompkins, J. L. Urrusti, and V. X. Afonso, Applications
of articial neural networks for ECG signal detection and classication,
J. Electrocardiol., vol. 26, pp. 6773, 1993.
[4] A. Krykos, E. Giakoumakis, and G. Carayannis, Time recursive predic-
tion techniques on QRS detection problem, in Proc. 9th Annu. Conf.
IEEE Eng. Med. Biol. Soc., Boston, MA, 1987, pp. 18851886.
[5] S. Abboud and D. Sadeh, The use of cross-correlation function for the
alignment of ECG waveforms and rejection of extrasystoles, Comput.
Biomed. Res., vol. 16, pp. 273286, 1993.
[6] S. L. Horowitz, A syntactic algorithm for peak detection in waveforms
with applications to cardiology, Commun. ACM, vol. 18, pp. 281285,
1975.
[7] G. Belforte, R. De Mori, and F. Ferraris, A contribution to the automatic
processing of electrocardiograms using syntactic methods, IEEE Trans.
Biomed. Eng, vol. 26, no. 3, pp. 125136, Mar. 1979.
[8] C. D. Nugent, J. A. C. Webb, G. T. H. Wright, and N. D. Black, Electro-
cardiogram1: Pre-processing prior to classication, Automedica, vol. 16,
pp. 263282, 1998.
[9] B. U. K ohler, C. Henning, and R. Orgelmeister, The principles of software
QRS detection, IEEE Eng. Med. Biol. Mag., vol. 21, no. 1, pp. 4257,
Jan.Feb. 2002.
[10] C. Li, C. Zheng, and C. Tai, Detection of ECG characteristic points using
wavelet transforms, IEEE Trans. Biomed. Eng., vol. 42, no. 1, pp. 2128,
Jan. 1995.
[11] S. Mallat and W. L. Hwang, Singularity detection and processing with
wavelets, IEEE Trans. Inform. Theroy, vol. 38, no. 2, pp. 617643, Mar.
1992.
[12] J. P. Martinez, S. Olmos, and P. Laguna, Evaluation of a wavelet based
ECG waveform detector on the QT database, in Proc. IEEE Comput.
Cardiol., 2000, vol. 27, pp. 8184.
[13] T. G. Dietterich, Ensemble Methods in Machine Learning (Lecture Notes
in Computer Science), Berlin, Germany: Springer-Verlag, 2000, vol. 1857,
pp. 115.
[14] J. C. T. B. Moraes, M. M. Freitas, F. N. Vilani, and E. V. Costa, A QRS
complex detection algorithm using electrocardiogram leads, in Proc.
IEEE Comput. Cardiol., 2002, vol. 29, pp. 205208.
[15] W. A. H. Engelse and C. Zeelenberg, A single scan algorithm for QRS
detection and feature extraction, in Proc. IEEE Comput. Cardiol., 1979,
pp. 3742.
[16] A. Ligtenberg and M. Kunt, A robust-digital QRS detection algorithm
for arrhythmia monitoring, Comput. Biomed. Res., vol. 16, pp. 273286,
1983.
[17] J. P. Martinez, R. Almeida, S. Olmos, A. P. Rocha, and P. Laguna, A
wavelet based ECG delineator: Evaluation on standard databases, IEEE
Trans. Biomed. Eng., vol. 51, no. 4, pp. 570581, Apr. 2004.
[18] S. Mallat, Zero-crossings of a wavelet transform, IEEE Trans. Inf. The-
ory, vol. 37, no. 4, pp. 10191033, Jul. 1991.
[19] L. Hansen and P. Salamon, Neural network ensembles, IEEE Trans.
Pattern Anal. Mach. Intell., vol. 12, no. 10, pp. 9931001, Oct. 1990.
[20] R. Mark and G. Moody, MIT-BIH Arrhythmia data base directory,
Cambridge, MA: Massachusetts Institute of Technology, 1988.
Carsten Meyer received the Ph.D. degree in the-
oretical physics from the University of G ottingen,
G ottingen, Germany, in 1997.
He has worked on statistical physics of neural net-
works at the Hebrew University of Jerusalem, Israel.
Since 1998, he has been with Philips Research Lab-
oratories, Aachen, Germany, working originally on
speech recognition, and since 2002, working on med-
ical signal and image processing.
Jos e Fern andez Gavela was born in Barcelona,
Spain, in 1976. He received the M.Sc. degree in
telecommunication engineering from the Technical
University of Catalonia, Barcelona, Spain, in 2001.
From 2003 to 2005, he was with Philips Research
Laboratories, Aachen, Germany, supported by the
European Union Marie Curie Industry Host Fellow-
ship Program. During this period, he was working
in signal processing, in particular, applied to speech
recognition and biomedical applications. Currently,
he is with Telef onica Soluciones, Madrid, Spain.
Matthew Harris was born in Adelaide, Australia,
in 1971. He received the Bachelor of Mathematical
Science (with honors) degree from the University of
Adelaide, Adelaide, in 1992 and the Ph.D. degree
in probability theory from the Technical University,
Delft, The Netherlands, in 1997.
Since 1998, he has been with Philips Research,
Laboratories Aachen, Germany, originally working
on the speech recognition eld, and since 2003, work-
ing on ECG analysis.

You might also like