Detecting abnormality in heart dynamics from multifractal analysis of ECG signals

The characterization of heart dynamics with a view to distinguish abnormal from normal behavior is an interesting topic in clinical sciences. Here we present an analysis of the Electro-cardiogram (ECG) signals from several healthy and unhealthy subjects using the framework of dynamical systems approach to multifractal analysis. Our analysis differs from the conventional nonlinear analysis in that the information contained in the amplitude variations of the signal is being extracted and quantified. The results thus obtained reveal that the attractor underlying the dynamics of the heart has multifractal structure and the variations in the resultant multifractal spectra can clearly separate healthy subjects from unhealthy ones. We use supervised machine learning approach to build a model that predicts the group label of a new subject with very high accuracy on the basis of the multifractal parameters. By comparing the computed indices in the multifractal spectra with that of beat replicated data from the same ECG, we show how each ECG can be checked for variations within itself. The increased variability observed in the measures for the unhealthy cases can be a clinically meaningful index for detecting the abnormal dynamics of the heart.


Detrending of the signals
The ECG signals often contain global trends as shown for a typical data in the top panel of Fig. S1. These trends usually are result of the body movement by the subject while the ECG is being taken. As part of the pre processing, we first remove these trends as described below. The de-trended data thus obtained after removing the global trends is shown in the bottom panel of the To remove the undesirable trends, we fit a polynomial of a certain degree to the signal, which is then subtracted from the actual signal to get the de-trended signal. To choose the appropriate value of the degree n to be used for the fitting polynomial, we define a deviation δ (n) of the original signal from the detrended signal as:  Figure S1: Time series of a randomly chosen subject before detrending (top panel) and after detrending (bottom panel). As explained in the text, the global trend is removed by fitting a polynomial to the original data.
It is important here to choose the right degree for the polynomial to be fit to remove the trend. If the degree of the polynomial is small, it won't be able to remove the higher order trends. Thus, we try different order polynomials to see how they affect the resulting time series. Figure S2 shows the variation of the deviation δ as a function of n, the degree of the polynomial for a few randomly selected ECG time series. As is clear from the plot, values of the deviations saturate for sufficiently high n. Based on this, for all the datasets we use n = 20 to detrend them.  Figure S2: Deviations as a function of the degree of the detrending polynomial for a few randomly selected ECG waveforms. It can be seen that for high values of the degree, deviations saturate.
shown in Figure S3. It is almost impossible to quantify the difference between the variations in these waveforms visually. To resolve this problem, we turn towards a dynamical systems' framework and use these waveforms to reconstruct the dynamical attractors of these systems. By comparing the properties of these reconstructed attractors, we can quantify the differences between the original waveforms. The details of the embedding technique are given below. For uniformity, all the values in the time series c(t k ) are first scaled between 0 and 1 by using a transformation of "compression": where c min and c max are minimum and maximum values in the time series c(t k ) respectively. Each time series s(t k ) is then embedded into an M dimensional space, by constructing vectors as: Here a time delay τ is the time, measured in units of sampling rate = t i+1 − t i , at which autocorrelation of the signal falls to 1/e of its original value [2]. It is easy to see that there are in total N − (M − 1)τ embedded vectors. As mentioned in the main text, the value of M is chosen from the saturation values of the correlation dimension. Taken's embedding theorem dictates that the phase space trajectories or attractor obtained from these vectors have the same topological properties as that of the original system [3]. The distribution of the points on the attractor thus reconstructed, is usually non-uniform and determines the multifractal properties of the attractor. Figure S4 shows the multifractal spectra for the time series given in Figure S3. Our method uses four parameters α 1 , α 2 , γ 1 and γ 2 to characterize a given multifractal spectrum uniquely. As explained in the main text, the difference α 2 − α 1 or the width of the multifractal spectrum, is a measure of the complexity of the attractor since it represents the range of the scales required to characterize the attractor fully. The other two indices γ 1 and γ 2 represent the functional form (in the Eq.(3) from the main text) of the multifractal curves and are required for the complete characterization. It can thus be seen from Figure S4 that the waveform for the healthy heart is more complex than that of the unhealthy heart.
To see this in detail for many datasets together, one can visualize the various parameter planes to see if the healthy and unhealthy groups cluster in the different regions of these planes. As an example, we show the results for α 1 -α 2 planes in Figure S5 and almost all healthy cases are seen to be more complex than the unhealthy cases.

f(α)
Healthy Unhealthy Figure S4: Multifractal spectra for the two time series shown in Figure S3. The spectrum for the healthy case can be seen to be broader than the unhealthy case.
As explained in the main text, the α 2 values have larger numerical errors for the datasets used in the study. Hence for further characterization, we rely on α 1 -γ 1 and α 1 -α 0 planes and show how they can be effectively used to group the datasets as healthy and unhealthy.

Extracting a single beat from an ECG time series
Identifying a single beat in an ECG signal is tricky since a beat cannot be defined as a pattern that repeats with  Figure S5: α 1 -α 2 planes for different channels. The red squares represent the patients and green circles represent the healthy subjects.
exact periodicity in the ECG signal. However, it is easy to see that ECG signals do have a certain approximate periodicity because of the presence of beats. For the data used, in units of milliseconds, the individual beats are seen to repeat with a period T ∈ (600, 1500). To find the exact value of the period, we calculate the autocorrelation of the time series as a function of the lag τ . The resulting plot for a typical ECG time series is shown in Figure S6. The τ value corresponding to the highest peak in this range is then taken to be the period of the signal and the same is used to extract a single beat from the time series. The beats thus extracted are used for generating the beat replicated data used in the analysis.