Literature DB >> 22474535

An efficient time-varying filter for detrending and bandwidth limiting the heart rate variability tachogram without resampling: MATLAB open-source code and Internet web-based implementation.

A Eleuteri1, A C Fisher, D Groves, C J Dewhurst.   

Abstract

The heart rate variability (HRV) signal derived from the ECG is a beat-to-beat record of RR intervals and is, as a time series, irregularly sampled. It is common engineering practice to resample this record, typically at 4 Hz, onto a regular time axis for analysis in advance of time domain filtering and spectral analysis based on the DFT. However, it is recognised that resampling introduces noise and frequency bias. The present work describes the implementation of a time-varying filter using a smoothing priors approach based on a Gaussian process model, which does not require data to be regular in time. Its output is directly compatible with the Lomb-Scargle algorithm for power density estimation. A web-based demonstration is available over the Internet for exemplar data. The MATLAB (MathWorks Inc.) code can be downloaded as open source.

Entities:  

Mesh:

Year:  2012        PMID: 22474535      PMCID: PMC3310232          DOI: 10.1155/2012/578785

Source DB:  PubMed          Journal:  Comput Math Methods Med        ISSN: 1748-670X            Impact factor:   2.238


1. Introduction

A time record consisting of beat-to-beat RR intervals is referred to as the heart rate tachogram. This forms the basis for a number of metrics of heart rate variability (HRV). The simplest measures of HRV are based on variance determined over a range of time periods. More complex measures can be derived from power spectrum density (PSD) estimations. The two most commonly used PSDs are the Welch Periodogram, based on the DFT, and the AR Spectrum, based on an autoregressive process model [1]. Both approaches require the data to be sampled regularly. Resampling the raw HRV data onto a regular time axis introduces noise into the signal and the information quality is compromised [1]. Conventionally, the HRV power is reported over 3 bandwidths: [0.01 ⋯ 0.04] Hz (Very Low Frequency, VLF) [0.04 ⋯ 0.15] Hz (Low Frequency, LF), and [0.15 ⋯ 0.4] Hz (High Frequency, HF) [1, 2]. Prior to transformation into the frequency domain, normal practice requires that the time series data are “detrended” or “high-pass filtered” at a very low frequency, say ~0.005 Hz. There is no universally formal justification for such detrending other than it minimises the effects of medium-term nonstationarity within the immediate time epoch (window) of interest [2]. Stationarity is an axiomatic assumption in conventional time-to-frequency transformation of the PSD (see Appendix B). A number of methods have been described to identify the trend component in the tachogram such that it can be simply removed by subtraction. These methods include fixed low-order polynomials [3, 4], adaptive higher-order polynomials [5, 6], and, more recently, the smoothing by priors approach (SPA) proposed by [7] which they describe as a time-varying finite impulse high-pass filter. The SPA uses a technique well-established in modern time series analysis and it addresses directly the phenomenon of nonstationarity. However, the Tarvainen approach suffers two limitations. The first is conceptual: the algorithm requires resampling by interpolation onto a regular time axis. The second is practical: the MATLAB implementation is computationally inefficient and expensive and consequently very slow. In practice, its application is limited to relatively short tachograms [7]. In the present work, a novel algorithm is introduced which obviates these limitations by extending the SPA. The Smoothing by Gaussian process Priors (SGP) method described here explicitly does not require resampling and executes in MATLAB at least an order of magnitude faster than the SPA. By employing the SGP twice in sequence, the bandpass effect achieves detrending (high-pass) and low-pass filtering which is directly compatible with the Lomb Scargle Periodogram (LSP) [8].

2. The Smoothing Priors Approach

The SPA method considers the problem of modelling the trend component in a time series with a linear observation model: where H is the observation matrix, v is observation error, and y are parameters to be determined. The solution to estimating the trend is then expressed in terms of minimisation of a regularised least squares problem: where σ is a regularisation parameter and D is the discrete approximation to the dth derivative operator. By choosing H as the identity matrix, and d = 2, the solution can be written as Tarvainen et al. argue that selection of the observation matrix is done to simplify things, in the context of estimating parameters in a finite-dimensional space. A Bayesian interpretation of (2) is given, but always in the context of finite-dimensional parameter spaces. It is interesting and useful to give a different interpretation in the context of Gaussian Process (GP) priors, which implies a function-space view, rather than a parametric view, of the regression problem. In passing it is noted that the SPA, as published, is markedly inefficient and potentially unstable in using matrix inversion. A more efficient approach is presented as Appendix C.

3. An Alternative Smoothing Prior Operator

Use of the D 2 operator implies uniform sampling of the data and in the case of the HRV tachogram requires that the raw data be projected onto a regular time axis using some means of interpolation. Such a projection is frequently referred to as resampling which is undesirable in that it corrupts, preferentially, the higher frequency components [2]. In the present development, it is proposed that resampling can be avoided by using a different approximation for the second-order derivative operator. The usual approximation is based on a centred formula: which implies that each row of the D 2 matrix is the constant vector [1,−2,1]. A different approximation formula to the derivative, which does not imply uniform sampling, can also be obtained by Taylor expansion with nonuniform increments. After some algebra, where h is now the maximum local grid spacing. The rows of the operator now explicitly depend on the x values as desired: The operator is denoted by the symbol . An efficient implementation of the above algorithm (MATLAB) is the following: T = length(x); id = 2 : (T − 1); idp1 = id + 1; idm1 = id − 1; V1 = 2./((x(idm1) − x(idp1)). *(x(id) − x(idp1))); V2 = −2./((x(idm1) − x(id)). *(x(id) − x(idp1))); V3 = 2./((x(idm1) − x(id)). *(x(idm1) − x(idp1))); D2hat = spdiags  ([V1, V2, V3]∖V1(1), [0 : 2], T − 2, T); L = chol(speye(T) + sigma ∧2 *D2hat' *D2hat, ‘lower'); z_stat = z − L'∖(L∖z); Note that to reduce the possibility of numerical instabilities in the solution of the linear systems, the D2hat matrix is normalised by the first element of vector V1.

4. Equivalent Kernel and Smoothing

The operation of the smoothing priors can be understood by looking at the following simplified form: where z is the vector of data and H is the matrix coefficient of (3). The smoother acts as a linear filter. Since each element of z and y can be thought of as placed at a distinct time point, it is seen that each row of the H matrix acts over all the elements of z to produce a single element of y. Consequently, the filter is noncausal. In fact, each row of H defines a weighting function. Each weighting function is localised around a specific time, and its bandwidth determines how many samples from the past and from the future contribute to the estimate. The wider the weighting function, the smoother the resulting estimates. In the case of uniformly sampled data, the weighting functions have the same shape (except at the boundaries), which can be imagined as a sliding window translating in time: this is a consequence of the definition of the D 2 operator, which is time independent. Figure 1 shows some weight functions implied by the D 2 operator.
Figure 1

Weight functions (viz. D 2 operator).

However, for the case of arbitrarily (irregularly) sampled data of the HRV tachogram, the operator actually depends on time; therefore the weighting functions will take on a different shape. This makes the resulting filter effectively a time-variant filter. It is possible to calculate the transfer function of the filter H in the limit as the number of data points tends to infinity. It can be shown [2] that the (non-stationary) spectral density of the Gaussian process prior is From the above, the power spectral density of the equivalent kernel filter is derived as In Figure 2 it is shown an example of the transfer function of the equivalent kernel filter (with σ 2 = 1): the phase is constant zero.
Figure 2

Bode plot of theoretical transfer function of equivalent kernel filter.

5. Estimation of the Filter Bandwidth

Although the approximation in (9) is only valid in the limit as the number of data points goes to infinity, it is still useful for calculating the approximate −3 dB bandwidth of the finite-sample approximation of the filter in terms of the smoothing parameter σ 2. Whereas the SPA as presented [7] does not provide an effective bandwidth estimate but only the qualitative behaviour of the filter, the following approximation provides a quantitative tool. Inverting (9) and applying the bilinear transformation of the continuous frequencies, we get where ω is the normalised cut-off frequency (namely, the Nyquist frequency = 1). Since the number of data points mostly impacts the estimation of low frequencies, the expectation is that the approximation is good in the low-frequency range. In a Monte Carlo simulation, 1000 replications of the Welch periodogram estimates were made of white Gaussian noise coloured through the equivalent filter H. Each noise sequence was composed of 5000 regularly spaced samples. In Table 1, it is seen that this approximation is good and, predictably, deteriorates as the cut-off frequency increases.
Table 1

approximation of −3 dB point [Hz].

True –3 dB cut-off frequencyApproximate frequency
0.050.049
0.10.102
0.20.208
0.30.34
Figure 3 shows the transfer function of the digital equivalent kernel filter.
Figure 3

Bode plot of discrete transfer function of equivalent kernel filter.

There is very little phase distortion, except at very high frequencies close to the Nyquist frequency.

6. Illustrative Performance with Synthetic and Real Data Sets

A synthetic data set of was generated (MATLAB) as series of normallydistributed random numbers of mean 0.85(1) s (equivalent to a heart rate of ~75 bpm) and std 0.025 s: this was low-pass filtered at 1 Hz (3rd-order phase-less IIR). These data were projected by interpolation, onto an irregular time axis of mean interval 0.86(1) s and variance 0.01s2. The resulting synthetic HRV record, as a time record of band-limited Gaussian noise, was of 30 s duration, average sampling frequency of 1.15(6) Hz and had no significant power above 1 Hz. Clinical ECG data from a Lead II configuration were recorded from a healthy adult seated for a period of 60 minutes using a Spacelabs Medical Pathfinder Holter system. RR intervals were available with 1 ms resolution. The time domain and frequency domain (as the Lomb Scargle periodogram) representations of the synthetic data set and the clinical data set are shown in Figure 4 to illustrate the band-pass filtering effect achieved using sequential SGP. The synthetic HRV data and the clinical HRV data are filtered in the band-pass [0.025 ⋯ 0.5] Hz and [0.025 ⋯ 0.35] Hz, respectively.
Figure 4

Synthetic and clinical HRV records band-pass filtered by sequential application of SGP: raw data vt 0 “smoothed” to give vt 1; vt 2 = vt 0 − vt 1 (not shown); vt 2 “smoothed” to give vt 3. Lomb Scargle Periodograms (LSPs) are for vt 0, vt 2, and vt 3.

7. Internet Resources and Open-Source Code

Resources relevant to this work are located at http://clinengnhs.liv.ac.uk/links.htm and include the following. A website demonstration of SGP running on an automation instance of MATLAB 2008a. Developed for JavaScript-enabled MS IE6+ and FireFox browsers. MATLAB open-source code: Smoothing by Gaussian process Priors (SGP): gpsmooth_3.m, Optimized Lomb Scargle Periodogram (fLSPw: fastest Lomb Scargle Periodogram in the West): fLSPw.m.

8. Conclusion

The SGP (Smoothing by Gaussian process Priors) algorithm is a second-order response time-varying filter which operates on irregularly sampled data without compromising low-frequency fidelity. In the context of Heart Rate Variability analysis, it provides detrending (high-pass) and low-pass filtering with explicitly specified −3 dB cut-off points. A small limitation is the implicit requirement to assume a representative sampling frequency to establish the frequency interval: here this is taken as the reciprocal of the median sampling interval. The SGP MATLAB code is available as open source via a comprehensive website and is directly compatible with an optimised implementation of the Lomb Scargle Periodogram (fLSPw) estimator.
  5 in total

1.  A method for assessment and processing of biomedical signals containing trend and periodic components.

Authors:  I P Mitov
Journal:  Med Eng Phys       Date:  1998 Nov-Dec       Impact factor: 2.242

2.  An advanced detrending method with application to HRV analysis.

Authors:  Mika P Tarvainen; Perttu O Ranta-Aho; Pasi A Karjalainen
Journal:  IEEE Trans Biomed Eng       Date:  2002-02       Impact factor: 4.538

3.  Software for advanced HRV analysis.

Authors:  Juha-Pekka Niskanen; Mika P Tarvainen; Perttu O Ranta-Aho; Pasi A Karjalainen
Journal:  Comput Methods Programs Biomed       Date:  2004-10       Impact factor: 5.428

4.  Heart rate variability. Standards of measurement, physiological interpretation, and clinical use. Task Force of the European Society of Cardiology and the North American Society of Pacing and Electrophysiology.

Authors: 
Journal:  Eur Heart J       Date:  1996-03       Impact factor: 29.983

5.  Time and frequency domain methods for heart rate variability analysis: a methodological comparison.

Authors:  D A Litvack; T F Oberlander; L H Carney; J P Saul
Journal:  Psychophysiology       Date:  1995-09       Impact factor: 4.016

  5 in total
  3 in total

1.  The Ornstein-Uhlenbeck third-order Gaussian process (OUGP) applied directly to the un-resampled heart rate variability (HRV) tachogram for detrending and low-pass filtering.

Authors:  A C Fisher; A Eleuteri; D Groves; C J Dewhurst
Journal:  Med Biol Eng Comput       Date:  2012-06-12       Impact factor: 2.602

2.  Does a 20-week aerobic exercise training programme increase our capabilities to buffer real-life stressors? A randomized, controlled trial using ambulatory assessment.

Authors:  Birte von Haaren; Joerg Ottenbacher; Julia Muenz; Rainer Neumann; Klaus Boes; Ulrich Ebner-Priemer
Journal:  Eur J Appl Physiol       Date:  2015-11-18       Impact factor: 3.078

3.  Temporary sympathectomy in chronic refractory angina: a randomised, double-blind, placebo-controlled trial.

Authors:  Christine Denby; David G Groves; Antonio Eleuteri; Hoo Kee Tsang; Austin Leach; Clare Hammond; John D Bridson; Michael Fisher; Matthew Elt; Robert Laflin; Anthony C Fisher
Journal:  Br J Pain       Date:  2015-08
  3 in total

北京卡尤迪生物科技股份有限公司 © 2022-2023.