HRV time series

For heart rate variability (HRV) analysis, inter-beat interval (IBI) data is required. Such data can be extracted from electrocardiogram (ECG) recording as time intervals between successive ECG R-waves, i.e. RR time intervals. Similarly IBI data can be extracted from photoplethysmography (PPG) recording as time intervals between successive pulsations. The detection of beats, beat detection accuracy and formation of HRV time series is discussed below.

QRS detection

The aim in heart rate variability analysis is to examine the sinus rhythm modulated by the autonomic nervous system. Therefore, one should technically detect the occurrence times of the SA-node action potentials, which initiate every heart beat. In practical applications, this is not however possible. Instead, an the electrocardiogram (ECG) is recorded by placing two or more electrodes on skin contact and heart beats are detected from the ECG. The nearest observable activity in the ECG compared to SA-node firing is the P-wave resulting from atrial depolarization (see Fig. 1). The signal-to-noise ratio of the P-wave is, however, clearly lower than that of the strong QRS complex which results primarily from ventricular depolarization. Therefore, the heart beat period is commonly evaluated as the time difference between the easily detectable QRS complexes. A typical QRS detector consists of a preprocessing part followed by a decision rule. Several different QRS detectors have been proposed within last decadesThakor et al. 1983Pahlm et al. 1985Pan & Tompkins 1985Hamilton et al. 1984Friesen et al. 1990.

Origin of ECG waveforms

Figure 1: Electrophysiology of the heart (redrawn from Malmivuo & Plonsey 1995). 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.

The accuracy of the R-wave occurrence time estimates is often required to be 1–2 ms, and thus, the sampling frequency of ECG should be at least 500–1000 Hz Task Force 1996. If the sampling frequency of ECG is less than 500 Hz, the errors in R-wave occurrence times can cause critical distortion to HRV analysis results, especially to spectrum estimates Merri et al. 1990. The distortion of the spectrum is even bigger if the overall variability in heart rate is small Pinna et al. 1994. The estimation accuracy can however be improved by interpolating the QRS complex e.g. by using a cubic spline interpolation Daskalov et al. 1997 or some model based approach Bragge et al. 2005.

Pulse detection

Photoplethysmography (PPG) is a technique for monitoring blood volume changes in the micro vascular bed of tissue. Shortly after the QRS complex appears in the ECG, the ventricular systole generates a pulse wave which leads to a rapid increase in blood pressure and blood volume, this change is seen by the steep rise in the pulse wave (see Fig. 2). The subsequent decline corresponds to cardiac diastole and may contain a secondary peak, the so-called dicrotic notch, which is attributed to the closure of the aortic valve. Pulse-to-pulse interval (PP-interval) is defined as a time interval between the rising part of two consecutive pulse waves.

PPG, and ECG signals

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

Depending on the pulse wave velocity and the vascular path from the heart, there is a delay between each QRS complex and the onset of its corresponding pulse wave. The delay is called pulse transit time (PTT) and is negatively correlated with blood pressure, arterial stiffness, and age. Physiological variability in PTT causes deviation between the PP-intervals and the RR-intervals. Since PP and RR intervals are not equal, it is always better to use the term pulse rate variability (PRV) rather than heart rate variability (HRV) when PPG measurement is used. Usability and accuracy of PRV as an estimate of HRV has been widely studied. A good review on the topic can be found from Schafer et al 2013, with the following concluding remarks:

  • PRV as an estimate of HRV has been proved to be sufficiently accurate only for healthy (and mostly younger) subjects at rest.
  • Moderate physical or mental stress tends to diminish agreement between PRV and HRV to an extent that is or is not acceptable.
  • Physically more active states, such as walking or physical exercising, the agreement between PRV and HRV often becomes insufficient, mostly due to motion artifacts.

Kubios HRV beat detection algorithms

In case ECG data is imported into Kubios HRV software, the R-wave time instants are automatically detected by applying a built-in QRS detection algorithm. This in-house developed detection algorithm is based on the Pan–Tompkins algorithmPan & Tompkins 1985. The detector consists of a preprocessing part followed by decision rules.The preprocessing part includes bandpass filtering of the ECG (to reduce power line noise, baseline wander and other noise components), squaring of the data samples (to highlight peaks) and moving average filtering (to smooth close-by peaks). The decision rules include amplitude threshold and comparison to expected value between adjacent R-waves. Both of these rules are adjusted adaptively every time a new R-wave is acceptably detected. Before R-wave time instant extraction, the R-wave is interpolated at 2000 Hz to improve the time resolution of detection. The up-sampling can significantly improve the time resolution of R-wave detection when the sampling rate of the ECG is low.

Pulse wave detector of Kubios HRV software is based on the matched filtering approach. Firstly, maximum of 1st derivative representing the steepest part of the pulse wave is used for initial pulse location estimation. Secondly, a template for the pulse wave (and matched filter) is constructed using the initial pulses. Decision of the final pulse wave locations are defined by comparing the filtered signal against varying threshold and comparing normalized error between the template and the PPG signal. Allowed normalized error between template and pulse wave under inspection can be adjusted in software preferences. That is, the smaller the acceptance threshold percent is the more similar the pulse wave have to be with the template in order to be accepted. The accuracy of the pulse wave detection algorithm is shown in Fig. 3. The left panel showing the Bland-Altman plot illustrating the agreement between detected PP intervals and corresponding RR intervals during a resting measurement. The right panel shows error percentages of commonly used heart rate variability parameters estimated from PP interval compared to RR interval time series. Used dataset contains 20 healthy volunteers with wide age scale (20 to 50 years). The error between the RR and PP intervals was -0.01±5.16 ms (mean ± SD). This ±5 ms error in heart beat detection produces approximately ±10 % maximum errors to the HRV parameters.

Accuracy of pulse interval detection

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.

Inter-beat interval (IBI) time series

After the beat occurrence times (i.e. QRS complex or pulse wave fiducial points) have been detected, an inter-beat interval (IBI) time series can be derived. Instead of IBI, we will here use the term RR interval, which refers to time interval between successive ECG R-wave occurrence times. The n‘th RR interval is obtained as the difference between the R-wave occurrence times RRn=tn − tn-1. In some context, normal-to-normal (NN) may also be used when referring to these intervals indicating strictly intervals between successive QRS complexes resulting from SA-node depolarization Task Force 1996. In practice when analysing normal sinus rhythm, the NN and RR intervals are the same, and thus, the term RR is preferred here.

The time series constructed from all available RR intervals is not equidistantly sampled, but has to be presented as a function of time, i.e. as values (tn, RRn). This fact has to be taken into account before frequency-domain analysis. In general, three different approaches have been used to get around this issue Task Force 1996. The simplest approach that have been adopted e.g. in Baselli et al. 1987 is to assume equidistant sampling and calculate the spectrum directly from the RR interval tachogram (RR intervals as a function of beat number), see Fig. 4 middle panel. This assumption can however cause distortion into the spectrum Mateo et al. 2000. This distortion becomes substantial when the variability is large in comparison to the mean RR interval length. Furthermore, the spectrum can not be considered to be a function of frequency, but rather a function of cycles per beat DeBoer et al. 1984, see Fig. 5 bottom panel. One choice for the interpolation method is the cubic spline interpolation Mateo et al. 2000. After interpolation, regular spectrum estimation methods can be applied. The third general approach is to apply methodology, which are designed for analysing non-equidistantly sampled data. Such a method is for example the Lomb-Scargle periodogram, which computes the periodogram spectrum estimate for non-equidistantly sampled data van Dongen et al. 1999.

Inter-beat interval (IBI) time series

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


  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</li
  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.