Introduction

Respiration wave is an important physiological signal. It plays an important role in diagnosis and treatment of many diseases, such as obstructive sleep apnea [1, 2]. The respiratory signal is usually obtained with techniques like impedance pneumography, spirometry, or plethysmography. However, such techniques are unmanageable in certain applications such as stress testing, ambulatory monitoring and sleep studies due to the use of some cumbersome devices that may interfere with natural breath [3]. In contrast to traditional methods, electrocardiogram (ECG)-derived respiration (EDR) derives a respiratory signal from the electrocardiogram which is measured noninvasively via a few electrodes [4]. The ECG signal records easily and has less interference with natural breathing which makes the EDR method more suitable for ambulatory monitoring and home monitoring.

Respiration influences ECG parameters in two ways, mechanical interaction and respiratory sinus arrhythmia (RSA). Mechanical interaction is caused by two factors: (1) the motion of the electrodes relative to the heart during the respiratory cycle. (2) The thoracic impedance variations caused by the volume changes in the lungs [3, 5]. Respiratory sinus arrhythmia is an important phenomenon in heart rate variability (HRV). It shows how respiration modulates heart rate. The heart rate increases during inspiration and decreases during expiration. The mechanism is that heart rate changes due to respiratory-induced changes to the autonomic nervous system [6].

Due to these factors, a number of EDR algorithms have been described in the literatures. These algorithms provided surrogate respiratory signals based on the respiratory-induced changes of the ECG. The first EDR method based on morphologic variations was proposed by Wang and Calvert [7] which used the vectorcardiogram (VCG) to monitor the respiratory rate and depth. Then some EDR methods based on the amplitude of ECG features like R peak [8, 9], RS [10], T peak [11] or the area under the QRS complex [12] were proposed. A few studies got surrogate respiratory signals through VCG [13] or filtering of the ECG [14,15,16]. The methods based on RSA derived EDR signals by applying singular value decomposition (SVD) [17] or S-transform [18] to RR interval series. The methods mentioned above obtained the EDR signals only based on a single piece of information in ECG and this might be improved through data fusion method. Nemati et al. [19] presented a data fusion method based on Kalman-filter to estimate the respiratory rate which proved that data fusion EDR algorithm was more robust to background noise and more accurate. However, this method required multiple physiological sources like ECG, photoplethysmogram, arterial blood pressure and the peripheral arterial tonometry waveforms, and it only derived respiratory rate rather than respiratory waveform. Langley et al. [6] introduced principal component analysis (PCA) to EDR algorithm. They used PCA to look into morphological beat-to-beat variations and applied PCA algorithm to QRS complex and regarded the eigenvectors as EDR signal. They proved that the PCA algorithm outperformed the EDR algorithm based on RS amplitude. Widjaja et al. [5] improved this method by using Kernel PCA to take the nonlinearities in the data into account. These two ways performed well in obtaining EDR signals but they only utilized a part of the respiratory-induced information in ECG. In this article, we combined the ideas of data fusion and PCA to put forward a new EDR algorithm. It should be pointed out that the way we use PCA is completely different to the approach in the two studies mentioned above.

This article is organized as follows. The following section describes the database used in this study. In “ECG-derived respiration” section, the data preprocessing is introduced firstly. Next, the data fusion EDR algorithm based on PCA is presented in detail. The EDR methods based on RR intervals and RS amplitudes are shown at last for comparing. “Comparisons of EDR with standard respiratory signal” section describes the methods for quantitative assessment of respiratory derivation algorithms. The statistical analysis algorithm is given in “Statistical analysis” section. “Result” section presents the result of the proposed method, followed by the “Discussion” and “Conclusion” sections.

Methods

Database

The MIT-BIH Polysomnography Database includes 18 continuous records which come from 16 male subjects who suffer from sleep apnoea. Records slp01a and slp01b are segments of one subject’s polysomnogram, records slp02a and slp02b are segments of another subject’s polysomnogram. The remaining 14 records belong to different subjects. The records are digitized at 250 Hz with 12 bit resolution and continue between 2 and 7 h [20]. The ECG, electromyogram (EMG), electroculogram (EOG), arterial blood pressure, respiration and arterial blood oxygen saturation are included in the database. The respiration signals are recorded by inductance plethysmography or a nasal thermistor. The ECG and respiration signals were used in this article.

ECG-derived respiration

Data preprocessing

There are three main types of noise in ECG: electromyographical interference, powerline interference and baseline wander. In this article, the electromyographical interference was removed through discrete wavelet transform. Here, we took coif4 as wavelet basis to decompose the ECG into five levels. The soft-threshold equaling to 20% of the mean of the first detail component was employed to this component to remove the electromyographical interference. Next, the powerline interference was handled using average filtering whose width was 10, and the baseline wander was eliminated by polynomial fitting. Then the ECG features detection algorithm based on wavelet [21] was applied on the denoised ECG to get the positons and amplitudes of ECG feature points like P, Q, R, S, T and RR interval.

Then we put forward a histogram denoising method to avoid random noise and guarantee the stability of the EDR signal. The number of the bins in histogram was 100 in this study and more bins have no contribution to the effect of denoising. For example, we got the histogram of all R-peak amplitudes. Then two thresholds were confirmed according to that the ratio of the number of R-peaks, whose amplitudes were located in the region determined by these two thresholds, to all the R-peaks exceeded a fixed value. The ratio was 98% in this article. Finally, the R-peak amplitudes which exceeded the threshold were specified to the threshold. The P-peak amplitudes, Q-peak amplitudes, S-peak amplitudes, T-peak amplitudes and RR intervals were also denoised by this method.

PCA data fusion algorithm

  1. (a)

    Construction of the input matrix

    The input matrix X with dimensions m × 6 consisted of 6 variables including P-peak amplitude (PA), Q-peak amplitude (QA), R-peak amplitude (RA), S-peak amplitude (SA), T-peak amplitude (TA) and RR interval (RR). The 6 variables in each row of X came from the same cardiac cycle. m was the number of heartbeats included in ECG.

  2. (b)

    Principal component analysis

    The input matrix X was described as

    $${\mathbf{X}}\left( {\text{n}} \right)=\left[ {{\varvec{P}}{\varvec{A}}\left( n \right)~{\varvec{Q}}{\varvec{A}}\left( n \right)~{\varvec{R}}{\varvec{A}}\left( n \right)~{\varvec{S}}{\varvec{A}}\left( n \right)~{\varvec{T}}{\varvec{A}}\left( n \right)~{\varvec{R}}{\varvec{R}}\left( n \right)} \right]=\left[ {{{\varvec{x}}_1}\left( n \right)~{{\varvec{x}}_2}\left( n \right)~{{\varvec{x}}_3}\left( n \right)~{{\varvec{x}}_4}\left( n \right)~{{\varvec{x}}_5}\left( n \right)~{{\varvec{x}}_6}\left( n \right)} \right]~,~n=1,2, \cdots ,m$$
    (1)

    Firstly, the means of the \({{\varvec{x}}_{\varvec{i}}}\) were removed from X to get matrix \({\varvec{X}}^{\prime}\)

    $${\mathbf{X^{\prime}}}\left( {\text{n}} \right)=\left[ {{{{\varvec{x}}^{\prime}}_1}\left( n \right)~{{{\varvec{x}}^{\prime}}_2}\left( n \right)~{{{\varvec{x}}^{\prime}}_3}\left( n \right)~{{{\varvec{x}}^{\prime}}_4}\left( n \right)~{{{\varvec{x}}^{\prime}}_5}\left( n \right)~{{{\varvec{x}}^{\prime}}_6}\left( n \right)} \right]~,\,n=1,2, \cdots ,m$$
    (2)

    Then the covariance matrix C of input matrix \({\varvec{X}}^{\prime}\) was calculated through

    $${\mathbf{C}}=\frac{1}{6}\mathop \sum \limits_{{j=1}}^{6} {{\varvec{x}}^{\prime}_j}{{\varvec{x}}^{\prime}_j}^{T}$$
    (3)

    Leading to a 6 × 6 matrix.

    The solution to

    $$\lambda {\varvec{\nu }}={\mathbf{Cv}}$$
    (4)

    yielded the eigenvectors \({\mathbf{v}}=[{{\varvec{v}}_{1~}}{{\varvec{v}}_{2~}}{{\varvec{v}}_{3~}}{{\varvec{v}}_{4~}}{{\varvec{v}}_{5~}}{{\varvec{v}}_6}]\)and eigenvalues \({\mathbf{\lambda }}=[{\lambda _{1~}}{\lambda _{2~}}{\lambda _{3~}}{\lambda _{4~}}{\lambda _{5~}}{\lambda _6}].\) The eigenvectors were arranged in order of magnitudes of the corresponding eigenvalues.

    Finally, the principal components (PCs) were obtained using

    $${\mathbf{PC}}={\varvec{X}}^{\prime}{\mathbf{V}}$$
    (5)

    The first k PCs were retained when the sum of \({\lambda _{1~}}\) to \({\lambda _{k~}}\)was greater than a ratio of the sum of all the eigenvalues. Here, we fixed the ratio to 60%.

    $$\mathop \sum \limits_{{i=1}}^{k} {\lambda _i} \ge ratio \times \mathop \sum \limits_{{i=1}}^{6} {\lambda _i},~ratio=60\%$$
    (6)

    The surrogate EDR signal was defined as the sum of the retained PCs.

    $${\mathbf{EDR}}={\varvec{P}}{{\varvec{C}}_1}+ \cdots +{\varvec{P}}{{\varvec{C}}_{\varvec{k}}}$$
    (7)

    The surrogate EDR signal can be also expressed as

    $${\mathbf{EDR}}={\varvec{X}}^{\prime} \cdot \mathop \sum \limits_{{i=1}}^{k} {{\varvec{v}}_{\varvec{i}}}$$
    (8)
  3. (c)

    Interpolation and post-processing

The surrogate EDR signals were interpolated to 250 Hz as for the respiratory signal using cubic spline interpolation for comparison. The baseline of the EDR was obtained by applying a 1-D digital filter with the window of 10 s to the EDR signal. Then the baseline was subtracted from the original EDR signal. At last a Kaiser low-pass filter was used whose cut-off frequency was 0.5 Hz and the passband ripple and stopband attenuation were 0.01 and 0.001 respectively. The reason for choosing 0.5 Hz as cut-off frequency was that normal human’s respiration frequency was less than 0.5 Hz [14].

EDR methods based on RR interval and RS amplitude

The algorithm proposed in this article was compared with the EDR signals derived from RR intervals and RS amplitudes.

The RR interval time series and RS amplitude series were constructed as

$${\mathbf{RR}}\left( {\text{n}} \right)={\varvec{R}}\left( {n+1} \right) - {\varvec{R}}\left( n \right)~n=1, \cdots ,m - 1$$
(9)

and

$${\mathbf{RS}}\left( {\text{n}} \right)={\varvec{R}}{\varvec{A}}\left( n \right) - {\varvec{S}}{\varvec{A}}\left( n \right)~n=1, \cdots ,m$$
(10)

The \(R\left( n \right)\) was the time of the n-th R-peaks in the ECG.

Both of the two series were denoised by the histogram method introduced in “Data preprocessing” section. Finally, the surrogate respiratory signals were generated by applying interpolation and post-processing to the denoised series.

Comparisons of EDR with standard respiratory signal

The assessment method proposed by Mason and Tarassenko [22] was used to compare the EDR signals with the simultaneously recorded reference respiratory signals.

Mason and Tarassenko put forward a quantitative assessment of respiratory derivation algorithms. In their article, the time at which a breath was detected in the EDR signal was compared with the time of the corresponding reference respiratory signal. For breath detection the time window about the reference breath time within which the derived breath should be found was ascertained as 2 s. And every respiration peak or trough was labelled to define a breath beat.

For a detail introduction, a reference respiratory signal and an EDR signal were shown in Fig. 1. There was an antiphase relationship between the two signals. The detailed explanation can be seen in [23]. But not all of the subjects in database were antiphase. In this example, the troughs of the reference signal were served as the breaths and the peaks of the EDR will be considered as breaths. Then the times of the reference respiration breaths will be compared with the times of the EDR breaths [22].

Fig. 1
figure 1

A reference respiration and an example EDR. The time interval “2s” marked in figure is the time window about the reference breath time within which the derived breath should be found

Then the mutually exclusive categories of true positives (TP), false positives (FP), false negatives (FN), sensitivity (SE) and positive predictivity (PP) were employed as the detection statistics. A breath beat in EDR signals that located in the time-match window corresponding to the reference breath will be counted as a TP, and an FP was that had no corresponding breath beat in reference respiration. An FN was a breath beat in the reference respiration that was not matched by a breath in EDR. SE and PP were described as follows:

$${\text{SE}}=\frac{{TP}}{{TP+FN}}$$
(11)
$${\text{PP}}=\frac{{TP}}{{TP+FP}}$$
(12)

Statistical analysis

Friedman Test is used for performance compared in sensitivity and positive predictivity among the PCA data fusion method and those for RR intervals and RS amplitudes. It is a nonparametric statistic that investigates whether multiple samples belong to the same overall. It is considered statistically significant when p < 0.05.

Result

Visual comparison

The ECG, reference respiratory and EDR signals of subject slp02b are shown in Fig. 2. The relationships among the reference signals and EDR signals are antiphase. All of the EDR methods can recover the surrogate signals, but visual evaluation of EDR-PCA performs better. In the rectangle of the figure, there is a false wave in EDR-RS signal because of the noise in S wave of ECG. However, the performance of the EDR-PCA is still good, which proves that the PCA data fusion method has a better ability to resist noise.

Fig. 2
figure 2

ECG and reference respiratory signal from the subject slp02b along with the three EDR signals. The figure shows the data from 0 to 40 s [from top to bottom: the ECG signal; the reference respiratory signal; EDR signal based on PCA data fusion method; EDR signal based on RS amplitudes; EDR signal based on RR intervals]. The rectangular zone shows the ability of three EDR methods to resist noise in ECG. To be convenient for comparison, the EDR signals’ amplitudes are normalized

The morphological differences in three EDR signals in Figs. 3 and 4 show that the PCA data fusion method outperforms the other two methods not only in avoiding noise, also the appearance of the EDR-PCA is superior.

Fig. 3
figure 3

ECG and reference respiratory signal from the subject slp66 along with the three EDR signals. The figure shows the data from 0 to 40 s [from top to bottom: the ECG signal; the reference respiratory signal; EDR signal based on PCA data fusion method; EDR signal based on RS amplitudes; EDR signal based on RR intervals]. To be convenient for comparison, the EDR signals’ amplitudes are normalized

Fig. 4
figure 4

ECG and reference respiratory signal from the subject slp16 along with the three EDR signals. The figure shows the data from 0 to 80 s [from top to bottom: the ECG signal; the reference respiratory signal; EDR signal based on PCA data fusion method; EDR signal based on RS amplitudes; EDR signal based on RR intervals]. The rectangular zone shows the ability of three EDR methods to detect the apnoea in subject. To be convenient for comparison, the EDR signals’ amplitudes are normalized

Quantitative comparison

The comparison results from the three methods for extracting respiration from ECG are shown in Table 1. The number of TPs, FNs, FPs, SE and PP are shown for each record. For quantitative comparison across the whole database, the gross statistics for each algorithm are also calculated.

Table 1 Comparison of all the records

The comparison of the three different algorithms over all subjects in SE and PP are shown in Figs. 5 and 6. Friedman Test displays significant differences in SE of the three EDR methods (p < 0.05), which proves that EDR-PCA is significantly better than EDR-RR and the EDR-RS. However, no statistically significant results are obtained in PP though EDR-PCA is also better than EDR-RS and EDR-RR.

Fig. 5
figure 5

Comparison of EDR signals obtained with PCA data fusion method, RS amplitudes and RR intervals over all subjects, expressed in terms of the sensitivity (SE). a The boxplots of the three methods. b The mean rank of different algorithms in Friedman Test. c The test statistics in Friedman Test (p = 0.000)

Fig. 6
figure 6

Comparison of EDR signals obtained with PCA data fusion method, RS amplitudes and RR intervals over all subjects, expressed in terms of the positive predictivity (PP). a The boxplots of the three methods. b The mean rank of different algorithms in Friedman Test. c The test statistics in Friedman Test (p = 0.092)

Discussion

In general, PCA is a data dimension reduction method. In this article, we applied it to EDR analysis and obtained better results than the RS-based and RR-based algorithm. There was a significant difference among the three methods in SE but no significant difference was found in PP. The PCA data fusion algorithm also had the advantage that the EDR-PCA was relatively noise free and the appearance of the EDR was more similar to the reference respiration.

In fact, we considered PCA as an approach of data fusion. We can see that, the EDR signal was a linear combination of ECG features such like PA, QA, RA, SA, TA and RR from the formula (28). The essence of PCA was to obtain excellent coefficients of the linear combination. So, the method based on RS amplitudes can be considered as a particular case of PCA whose coefficients of RA and SA were 1 and − 1 respectively with the coefficients of other features were 0. The RR intervals algorithm was similar to the method of RS amplitudes. As we know, the theories of EDR methods based on RR intervals and RS amplitudes were RSA and mechanical interaction respectively which were proposed in “Introduction” section. From this point of view, the PCA data fusion method took advantage of all information in single-lead ECG influenced by respiration. Hence, the PCA data fusion method had better robustness and resistance to noise as shown in Figs. 2 and 3. Therefore, it was reasonable that the EDR-PCA outperformed the EDR-RS and EDR-RR.

The coefficients of the linear combination obtained by PCA approach is shown in Table 2. We can see that the coefficients of R, S and T were bigger than the other three coefficients generally. This phenomenon showed that R, S and T sequences were the three most valuable factors to construct EDR signals and proved that these three sequences contained more information of respiration. It was easily to be understood as three articles had obtained the EDR signal based on one of the three sequences separately [8, 10, 11]. The P, Q and RR intervals signals were equally important for modifying the details of EDR signals and resisting noise.

Table 2 The coefficients of the linear combination for all records

Sleep apnoea occurred in the rectangle region of Fig. 4. It was able to more clearly identify sleep apnoea in EDR-PCA than other EDR signals which showed that the PCA data fusion EDR algorithm had potential in distinguishing sleep apnoea. This will improve the comfort in sleep monitoring for patients without cumbersome devices.

Here, we applied PCA to the whole record. Maybe, we can improve our algorithm by cutting the whole record into several segments to which the PCA will be applied. But this will increase the computation time in turn. The tradeoff between accuracy and time needed more tests. We confirmed the ratio in formula (28) to 60% and the ratio in histogram denoising to 98% based on several experiments. The value of the parameters of filters at pre-processing and post-processing sections was fixed in the same way. It required more experiments to get the optimal values for all the records. Nevertheless, the PCA method outperformed the other two methods, even though the ratios were not optimal.

Conclusion

At present, almost all EDR methods obtained the EDR signals based on a single feature from the ECG like R wave or S wave. In this study, we presented a new method for obtaining the ECG-derived respiration signal which combined the ideas of data fusion and PCA technique. The PCA method was applied as a data fusion method to take all of the respiratory-induced variabilities of ECG features into consideration. The results of the algorithm were compared with other two methods. All tests were conducted using MATLAB and the results proved PCA data fusion method to be a promising algorithm to obtain surrogate respiratory signal. It was computationally simple, and applicable to single lead ECG. It acquired excellent ECG-derived respiratory signals without the need for additional transducers or hardware which was suitable for home monitoring and ambulatory monitoring.