Beat detection and HRV time series

This article focuses on the beat detection accuracy, which directly affects the accuracy of the HRV parameters when we calculate HRV from RR interval or IBI data. RR time intervals are derived from electrocardiogram (ECG) recordings as intervals between successive ECG R-waves, while inter-beat interval or IBI data comes from photoplethysmogram (PPG) recordings as intervals between pulsations. For heart rate variability or HRV analysis, either RR interval or IBI data is required. HRV analysis cannot be conducted with averaged heart rate data over time.

Beat detection from ECG

ECG waveform data

ECG is recorded by placing two or more electrodes on the skin across the chest, measuring the potential difference between any two electrodes. This setup produces ECG waveform data ideal for accurate HRV analysis. The P-wave, which results from atrial depolarization and is associated with the sino-atrial (SA) node firing, is the first observable wave in the ECG (see Fig. 1). However, the P-wave has a lower signal-to-noise ratio compared to the more pronounced QRS complex, which primarily results from ventricular depolarization. Consequently, the heartbeat period is commonly evaluated using the time difference between the more easily detectable QRS complexes or R-waves. QRS detection typically involves a preprocessing step followed by a decision rule, with several detection methods developed over the past decades. [15], [10], [11], [6], [5] 

Origin of ECG and heart beats

Figure 1: Electrophysiology of the heart (redrawn from [7]). The different waveforms for each of the specialized cells found in the heart are shown. The latency shown approximates that normally found in the healthy heart.

ECG sampling rate

For precise HRV analysis, R-wave detection accuracy is crucial, typically required to be within 1-2 msec. Therefore, the ECG sampling rate should be at least 500-1000 Hz [14]. Sampling rates below 500 Hz can introduce significant errors in R-wave timing, critically distorting HRV analysis results, particularly in spectral estimates [9]. However, interpolation techniques like cubic spline or model-based approaches can enhance estimation accuracy [3], [2].


Kubios QRS detector algorithm

When ECG data is imported into the Kubios HRV software, R-wave timings are automatically detected using a built-in QRS detection algorithm based on the Pan-Tompkins method. The algorithm includes preprocessing—bandpass filtering to reduce noise, squaring of data samples to emphasize peaks, and moving average filtering to smooth peaks—followed by decision rules based on amplitude thresholds and expected values between adjacent R-waves. These rules are adaptively adjusted with each new R-wave detection. Additionally, R-waves are interpolated at 2000 Hz before extraction to enhance time resolution, significantly improving detection accuracy when the original ECG sampling rate is low.

Beat detection from PPG

Blood volume pulse or PPG waveform data

Photoplethysmography (PPG) monitors blood volume changes in the tissue’s microvascular bed. After the QRS complex in an ECG, the ventricular systole creates a pulse wave, causing a sharp increase in blood pressure and volume, visible as a steep rise in the PPG waveform (see Fig. 2). The decline after this peak often shows a dicrotic notch due to the aortic valve closing. The time between consecutive pulse wave rises is termed the pulse-to-pulse interval (PP-interval).

Beat detection from ECG and PPG

Figure 2: Normal PPG end ECG signal and definitions of pulse transmit time (PTT) and pulse to pulse interval (PP).

Pulse rate variability

There is a delay, known as pulse transit time (PTT), between the QRS complex and the onset of the pulse wave due to the velocity and vascular path from the heart. This delay varies with factors like blood pressure, arterial stiffness, and age, causing differences between PP-intervals and RR-intervals. Thus, pulse rate variability (PRV) is used instead of HRV for PPG measurements. PRV has been shown to be sufficiently accurate as an estimate of HRV only for healthy, mostly younger subjects at rest. However, PRV and HRV can vary under conditions like physical or mental stress, or during more active states like walking, where motion artifacts can affect the measurement accuracy. [13]


Kubios pulse wave detector

Kubios HRV software uses a matched filtering approach for pulse wave detection. It starts by identifying the steepest part of the pulse wave using the maximum of its first derivative. A template and matched filter are then constructed from these initial pulses. The final pulse locations are determined by comparing the filtered signal to a threshold and the normalized error between the template and the actual PPG signal. Settings allow for adjusting the acceptable error threshold, thus controlling the similarity needed for a pulse wave to be recognized. The algorithm’s accuracy, including its impact on HRV parameters and the agreement between detected PP intervals and corresponding RR intervals, is depicted in a Bland-Altman plot and error percentage data (see Fig. 3). Data is derived from 20 health volunteers, aged 20-50 years. It is observed that a ±5 msec error in heartbeat interval detection produces up to ±10 % errors to the HRV parameters.

PPG beat detection accuracy

Figure 3: Bland-Altman plot for the difference between PP intervals and RR intervals extracted from resting measurements (left axes). The errors in standard HRV parameters when computed from PRV compared to HRV time series (right axes); where red lines show the median, the box shows the 25-75 percentiles, and the whiskers show the most extreme error values.

HRV time series data

After detecting the beat occurrence times (i.e., QRS complex or pulse wave fiducial points), a HRV time series is derived. We use the term RR interval here, which refers to the time interval between successive R-wave occurrences in the ECG. The nth RR interval, RRn, is calculated as the difference between successive R-wave times, RRn=tn − tn-1. The term normal-to-normal (NN) intervals is sometimes used to specifically denote intervals between successive QRS complexes originating from SA-node depolarizations [14].

In practice, when analyzing normal sinus rhythm, NN and RR intervals are equivalent, thus “RR” is the preferred term. The resulting time series of RR intervals is not equidistantly sampled but is represented as a function of time (tn, RRn), which must be considered before performing frequency-domain analysis.

Historically, three approaches have been used to address this issue. One common method is to assume equidistant sampling and directly compute the spectrum from the RR interval tachogram (RR intervals as a function of beat number) [1], though this can introduce significant spectral distortion when variability is large relative to the mean RR interval [8]. Alternatively, cubic spline interpolation can be used to facilitate standard spectral estimation methods [8]. Another advanced method involves using techniques like the Lomb-Scargle periodogram, designed specifically for analyzing non-equidistantly sampled data, offering a more accurate spectrum estimation [16].

HRV time series

Figure 4: Derivation of two HRV time series from ECG: the interval tachogram (middle panel) and interpolated RR interval series (bottom panel).

Frequently Asked Question (FAQ)

Why is beat to beat interval data required for HRV analysis?

Heart rate variability (HRV) analysis examines the fluctuations in the time intervals between consecutive heartbeats, known as interbeat intervals. Accurate HRV analysis requires precise beat-to-beat data, such as RR intervals or IBI data. It cannot be conducted using averaged heart rate data over time.


Can I use a PPG device for heart rate variability monitoring?

PPG devices are suitable for HRV monitoring during rest or sleep when motion artifacts are minimal. However, for activities that involve movement, such as exercise, an ECG device is recommended due to its superior accuracy in beat detection. PPG may be less reliable for older or diseased individuals with low HRV due to its lower beat detection accuracy compared to ECG.


How does motion affect HRV readings from PPG devices?

Motion can significantly impact the accuracy of HRV readings from PPG devices due to their sensitivity to movement. This effect varies depending on the physical location of the sensor, such as the wrist, upper arm, or finger. Sensors placed at locations with more incidental movement, like the wrist, are typically more prone to motion artifacts, leading to less reliable data during activities involving movement.


What is the difference between RR intervals and IBI data in HRV analysis?

RR intervals refer specifically to the times between successive R-waves detected in an ECG, which are direct measurements of heartbeats. IBI data, often measured via PPG, refers more generally to intervals between any detectable heartbeats, which may not always align precisely with R-waves, especially in conditions of poor signal quality or arrhythmia.


  1. G. Baselli, S. Cerutti, S. Civardi, F. Lombardi, A. Malliani, M. Merri, M. Pagani, and G. Rizzo. Heart rate variability signal processing: a quantitative approach as an aid to diagnosis in cardiovascular pathologies. Int J Bio-Med Comput, 20:51–70, 1987.
  2. T. Bragge, M.P. Tarvainen, P.O. Ranta-aho, and P.A. Karjalainen. High-resolution QRS fiducial point corrections in sparsely sampled ECG recordings. Physiol Meas, 26(5):743–751, 2005.
  3. I. Daskalov and I. Christov. Improvement of resolution in measurement of electrocardiogram RR intervals by interpolation. Med Eng Phys, 19(4):375–379, June 1997.
  4. R.W. DeBoer, J.M. Karemaker, and J. Strackee. Comparing spectra of a series of point events particularly for heart rate variability data. IEEE Trans Biomed Eng, 31(4):384–387, April 1984.
  5. G.M. Friesen, T.C. Jannett, M.A. Jadallah, S.L. Yates, S.R. Quint, and H.T. Nagle. A comparison of the noise sensitivity of nine QRS detection algorithms. IEEE Trans Biomed Eng, 37(1):85–98, January 1990.
  6. P.S. Hamilton and W.J. Tompkins. Quantitative investigation of QRS detection rules using the MIT/BIH arrhythmia database. IEEE Trans Biomed Eng, 33(12):1157–1165, December 1986.
  7. J. Malmivuo and R. Plonsey. Bioelectromagnetism: Principles and Applications of Bioelectric and Biomagnetic Fields. Oxford University Press (Web Edition), 1995.
  8. J. Mateo and P. Laguna. Improved heart rate variability signal analysis from the beat occurrence times according to the IPFM model. IEEE Trans Biomed Eng, 47(8):985–996, August 2000.
  9. M. Merri, D.C. Farden, J.G. Mottley, and E.L. Titlebaum. Sampling frequency of the electrocardiogram for spectral analysis of the heart rate variability. IEEE Trans Biomed Eng, 37(1):99–106, January 1990.
  10. O. Pahlm and L. Sörnmo. Software QRS detection in ambulatory monitoring – a review. Med Biol Eng Comput, 22:289–297, July 1984.
  11. J. Pan and W.J. Tompkins. A real-time QRS detection algorithm. IEEE Trans Biomed Eng, 32(3):230–236, March 1985.
  12. G.D. Pinna, R. Maestri, A. Di Cesare, R. Colombo, and G. Minuco. The accuracy of power-spectrum analysis of heart-rate variability from annotated RR lists generated by Holter systems. Physiol Meas, 15:163–179, 1994.
  13. A Schäfer and J Vagedes. How accurate is pulse rate variability as an estimate of heart rate variability? Int J Cardiol, 166:15–29, 2013.
  14. Task force of the European society of cardiology and the North American society of pacing and electrophysiology. Heart rate variability – standards of measurement, physiological interpretation, and clinical use. Circulation, 93(5):1043–1065, March 1996.
  15. N.V. Thakor, J.G. Webster, and W.J. Tompkins. Optimal QRS detector. Med Biol Eng Comput, 21:343–350, May 1983.
  16. H.P.A. Van Dongen, E. Olofsen, J.H. VanHartevelt, and E.W. Kruyt. Searching for biological rhythms: peak detection in the periodogram of unequally spaced data. J Bioloogical Rhythms, 14(6):617–620, 1999.