Computational Algorithms Underlying the Time-Based Detection of Sudden Cardiac Arrest via Electrocardiographic Markers

Featured Application: This study explores the potential use of supervised machine learning for the early detection of sudden cardiac arrest using electrocardiographic markers, such as heart rate, R-R interval duration, and heart rate variability. Abstract: Early detection of sudden cardiac arrest (SCA) is critical to prevent serious repercussion such as irreversible neurological damage and death. Currently, the most effective method involves analyzing electrocardiogram (ECG) features obtained during ventricular ﬁbrillation. In this study, data from 10 normal patients and 10 SCA patients obtained from Physiobank were used to statistically compare features, such as heart rate, R-R interval duration, and heart rate variability (HRV) features from which the HRV features were then selected for classiﬁcation via linear discriminant analysis (LDA) and linear and ﬁne Gaussian support vector machines (SVM) in order to determine the ideal time-frame in which SCA can be accurately detected. The best accuracy was obtained at 2 and 8 min prior to SCA onset across all three classiﬁers. However, accuracy rates of 75–80% were also obtained at time-frames as early as 50 and 40 min prior to SCA onset. These results are clinically important in the ﬁeld of SCA, as early detection improves overall patient survival


Introduction
Sudden cardiac arrest (SCA) is the sudden unexpected loss of heart function less than 1 h from the onset of symptoms [1,2].SCA arises when a triggering factor that is either acquired or genetically-determined affects an anatomical or physiological substrate, manifesting into an abnormal heart rhythm such as ventricular tachycardia, which ultimately degenerates into the fatal ventricular fibrillation (VF) rhythm [3].
SCA can occur at any age in a patient with or without a detectable heart disease [4].Approximately 15,000 Australians per year experience SCA and only 6-13% of patients survive more than one year after the event [5].SCA is one of the major causes of cardiovascular mortality and is a major public health issue both nationally and globally, with the annual cost of SCA amounting to approximately $33 billion USD [6].This economic and health burden of SCA poses to society can be reduced with the improvement of patient outcomes through better detection systems [7].
Appl.Sci.2017, 7, 954 2 of 16 However, the main challenge associated with SCA detection lies in the fact that SCA can manifest in the complete absence of symptoms.Various methods have been investigated for the detection of SCA, each demonstrating strengths in various patient populations.Cardiac imaging modalities such as cardiac magnetic resonance imaging, echocardiography and cardiac positron emission tomography were found to be useful in patients with a suspected structural heart disease [8].However, there are many cases in which SCA may arise as a result of a non-cardiac cause.Electrophysiology study had also been investigated as a potential detection method, however, there is limited data on its prognostic value for SCA and it is limited due to its poor negative predictive value and its decrease in sensitivity with polymorphic ventricular tachycardia rhythms [9].The current most commonly explored detection method for SCA is electrocardiography (ECG).Early studies had already established the clinical importance of ECG detection, as 95% of SCA patients were found to have abnormal ECG readings [10].These early studies have highlighted the usefulness of ECG monitoring for SCA detection as it can aid in understanding the changes preceding the VF rhythm and have identified potential markers that may trigger SCA.The ECG markers that have been currently explored include: QTc interval, QRS duration, R-R interval, ST segment elevation, T-wave amplitude, and T-peak-to-T-end [11][12][13][14].Though its efficacy as a detection method has been well established, the field is still developing and future large cohort studies on specific patient populations still need to be conducted.Overall, although a majority of both invasive and non-invasive tests have been employed and evaluated, there is currently no optimal detection method nor criteria specific for SCA [15].
Currently, computer algorithms have been developed and utilized in the clinical setting for the quick detection of critical events such as ventricular fibrillation, in the case of SCA.These pattern recognition methods aim to either assign an individual heartbeat to a specific class or to detect the underlying pathology using information obtained from measurable features of the ECG, such as the R-R interval duration.The assumption is that features of individuals in the same class have similar values and, thus, occupy a specific region in the multidimensional feature space separated from other classes [16].Early studies on pattern recognition algorithms utilized linear classification methods, such as linear discriminant analysis, which assumed that biological signals were linear in nature.Although these methods provided reasonable results, the underlying non-linear features of these signals were ignored.As a majority of biological signals are non-linear in nature, this led to the need for further classification and, thus, research interest had shifted to non-linear classification methods, such as support vector machines [17].However, limitations lie in the current literature as time-frames of only up to 5 min prior to the onset of SCA have been thoroughly investigated, which, when applied to the clinical setting, does not provide enough time for a patient to respond with sufficient time to reach the hospital.The overall survival rate decreases by 10% each minute the patient remains in VF, thus, high importance is placed on detection as early identification and management is critical.
Since the early detection of SCA is highly important yet not well established, the aim of this study is to, first, statistically compare the importance of various ECG features, such as heart rate and R-R interval related markers, between normal and patients at risk of SCA and, secondly, and most importantly, to determine the ideal time-frame spanning up to three hours prior to the onset of VF in which electrocardiographic changes alluding to SCA can be detected and accurately classified.

Materials and Methods
Two databases from the physiological signal online archive Physiobank were utilized in this study: the Sudden Cardiac Death Holter Database (SDDB) and the MIH-BIH Normal Sinus Rhythm Database (NSRDB).The normal patient cohort consisted of 10 records selected from the NSRDB (four males, aged 32 to 45 and six females, aged 35 to 50).The SCA cohort consisted of 10 records selected from the SDDB (five males, aged 34 to 74, four females, aged 62 to 82, and one patient of unknown gender, aged 62).Each ECG dataset consisted of 24-h Holter ECG recordings before and after the SCA event [18].The full methodology of this study has been outlined in Figure 1

Data Preprocessing
Each dataset in the SCA cohort was first segmented into one-minute intervals every hour, three hours prior to the onset of the SCA event (3 h, 2 h, and 1 h), then partitioned into one-minute intervals every 10 min prior to SCA onset (50 min, 40 min, etc.) and from 10 min into one-minute intervals every minute until the onset of SCA (10 min, 9 min, etc.).For the normal cohort, five random oneminute intervals were selected from the fourth hour of recording and isolated (See Figure 2   Both the normal and SCA cohort datasets were then converted from a double-channel ECG recording to a single-channel recording (see Figure 3).All ECG recordings were then subjected to baseline wander removal; a Butterworth band-pass filter with cutoff frequencies between 0.5 Hz and

Data Preprocessing
Each dataset in the SCA cohort was first segmented into one-minute intervals every hour, three hours prior to the onset of the SCA event (3 h, 2 h, and 1 h), then partitioned into one-minute intervals every 10 min prior to SCA onset (50 min, 40 min, etc.) and from 10 min into one-minute intervals every minute until the onset of SCA (10 min, 9 min, etc.).For the normal cohort, five random one-minute intervals were selected from the fourth hour of recording and isolated (See Figure 2

Data Preprocessing
Each dataset in the SCA cohort was first segmented into one-minute intervals every hour, three hours prior to the onset of the SCA event (3 h, 2 h, and 1 h), then partitioned into one-minute intervals every 10 min prior to SCA onset (50 min, 40 min, etc.) and from 10 min into one-minute intervals every minute until the onset of SCA (10 min, 9 min, etc.).For the normal cohort, five random oneminute intervals were selected from the fourth hour of recording and isolated (See Figure 2   Both the normal and SCA cohort datasets were then converted from a double-channel ECG recording to a single-channel recording (see Figure 3).All ECG recordings were then subjected to baseline wander removal; a Butterworth band-pass filter with cutoff frequencies between 0.5 Hz and Both the normal and SCA cohort datasets were then converted from a double-channel ECG recording to a single-channel recording (see Figure 3).All ECG recordings were then subjected to baseline wander removal; a Butterworth band-pass filter with cutoff frequencies between 0.5 Hz and 45 Hz was applied to remove both baseline drift and high-frequency noise.The filtered ECG was then used in all subsequent steps with a sampling rate of 250 Hz (see Figure 3).All data preprocessing steps were conducted in MATLAB R2016a.
Appl.Sci.2017, 7, 954 4 of 16 45 Hz was applied to remove both baseline drift and high-frequency noise.The filtered ECG was then used in all subsequent steps with a sampling rate of 250 Hz (see Figure 3).All data preprocessing steps were conducted in MATLAB R2016a.

ECG Feature Extraction
Following preprocessing the R wave of the filtered ECG signal was then detected using MATLAB for feature extraction.As the ECG signals utilized in this study did not consistently exhibit the normal ECG waveform even after signal preprocessing (either due to the underlying condition of the patient or due to external noise interference), there was difficulty in detecting and extracting features pertaining to the P, Q, R, S, and T waves.Since the R wave was easily detectable, a set of time-domain-related R-wave features were selected.The following features were then extracted and analyzed: (1) the mean resting heart rate (beats per minute); and (2) the mean R-R interval duration (ms), the duration between two successive R waves [19]: 1 Two measures of heart rate variability (HRV): (3) RMSSD (ms), the square root of the mean of differences between all adjacent R-R intervals: and ( 4) SDSD (ms), the standard deviation of differences between all adjacent R-R intervals: 1 A one-way analysis of variance (ANOVA) with repeated measures was then conducted to determine if there were statistically significant differences between the normal and SCA cohort for each feature, as well as differences between each time interval prior to, and during, the onset of SCA.The statistical significance used in this study was 0.05 (95% confidence interval).Post-hoc analysis

ECG Feature Extraction
Following preprocessing the R wave of the filtered ECG signal was then detected using MATLAB for feature extraction.As the ECG signals utilized in this study did not consistently exhibit the normal ECG waveform even after signal preprocessing (either due to the underlying condition of the patient or due to external noise interference), there was difficulty in detecting and extracting features pertaining to the P, Q, R, S, and T waves.Since the R wave was easily detectable, a set of time-domain-related R-wave features were selected.The following features were then extracted and analyzed: (1) the mean resting heart rate (beats per minute); and (2) the mean R-R interval duration (ms), the duration between two successive R waves [19]: Two measures of heart rate variability (HRV): (3) RMSSD (ms), the square root of the mean of differences between all adjacent R-R intervals: and ( 4) SDSD (ms), the standard deviation of differences between all adjacent R-R intervals: Appl.Sci.2017, 7, 954 5 of 16 A one-way analysis of variance (ANOVA) with repeated measures was then conducted to determine if there were statistically significant differences between the normal and SCA cohort for each feature, as well as differences between each time interval prior to, and during, the onset of SCA.The statistical significance used in this study was 0.05 (95% confidence interval).Post-hoc analysis was performed using Tukey's honest significant difference (HSD) test in instances where statistical significance has been reached.

Classification and Machine Learning
Once all data had been imported into MATLAB for classification, all three R-R-related SCA features (mean R-R interval duration, RMSSD and SDSD) were then compiled into a singular 1200 × 3 matrix based on the time window (e.g., "3 h prior to SCA").The data was then subjected to statistical classification via various classifiers using the Classification Learner App in MATLAB, in order to discriminate between the features extracted from a normal patient to that of a patient at risk of SCA.Each classifier generates a pattern recognition model based on a given set in order to classify future input datasets for SCA risk detection [20].The data was first subjected to linear discriminant analysis via a linear classifier, which aims to separate input vectors into classes through the use of linear decision boundaries.The within-class scatter matrix (S w ) is modelled as: where C denotes the number of classes, C i is the set of data belonging to a class and m i denotes the mean of the class.The between-class scatter matrix (S B ) is modelled as: where m denotes the mean of all classes.The criterion function is defined as: The overall result is a transformation matrix that maximizes the ratio of between class variance to within class variance so that adequate class separability is obtained [20].
Linear classification was then followed by binary support vector machine (SVM) classification with both a linear SVM and a non-linear fine Gaussian SVM.A support vector machine creates a decision surface by constructing an optimal hyperplane which separates two classes which, in this case, are normal patients and patients at risk of SCA.The optimum hyperplane is found by maximizing the distance between two hyperplanes: w•x + b = +1 and w•x + b = −1 which is 2/ w .A slack variable ξ i is then introduced and the optimal hyperplane is then determined by minimizing: where C denotes a cost-constant involving margin size and error.The Langrange multiplier α i is then used to find the optimal hyperplane by maximizing: As the data in this study is non-linear, it can be linearly classified using the RBF function [21]: Appl.Sci.2017, 7, 954 6 of 16 Performance measurement was then conducted using the performance indicators, accuracy, sensitivity and specificity which were calculated via the confusion matrix generated by MATLAB [19]: The accuracy for each time-frame and each classification method were obtained and recorded in order to determine the earliest time-frame in which SCA can be accurately detected.All classifiers were subjected to five-fold cross-validation.The most accurate time-frame and the earliest time-frame exhibiting reasonable accuracy (relative to the values obtained in the preceding time intervals) across all classifiers were then isolated and subjected to further testing to evaluate the sensitivity and specificity across the three different classification methods.
Sensitivity or True Positive Rate (%), the ability of the classifier to correctly identify a sudden cardiac arrest patient is calculated as follows: × 100 (10) Specificity (%), the ability of the classifier to correctly identify a normal patient is calculated as follows: Speci f icity = TN (TN + FP) × 100 (11) where true positive (TP) indicates the number of data inputs that are correctly identified as SCA patients.False positive (FP) denotes the number of data inputs that identify normal patient as at risk of SCA.True negative (TN) is the number of data inputs that are correctly identified as normal patients.
False negative (FN) indicates the number of data inputs that identify SCA patients as normal patients.

Feature Selection
During SCA, the mean resting heart rate was observed to continuously fluctuate from 3 h prior to the onset of SCA to 1 min before the onset of SCA.However, a sudden decrease in heart rate between 1 min prior to SCA and during the onset of SCA was observed (See Figure 4).Compared to the normal patients, SCA patients exhibited a higher mean resting heart rate, with an 18.7 ± 3.5 bpm difference observed between the two cohorts (See Table A1, Appendix A).Overall there was no statistically significant difference in mean resting heart rate between normal and SCA patients with the exemption of 3 h prior to SCA, F(1,18) = 4.70, p = 0.04 and 6 min prior to SCA, F(1,18) = 4.23, p = 0.05 (See Table A2, Appendix B).Post-hoc analyses using Tukey Honestly Significant Difference (Tukey HSD) indicated that there was a significant difference in mean resting heart rate observed between both patient cohorts at 3 h prior to SCA (p = 0.04), but however found no significant difference in mean resting heart rate observed between the two patient cohorts at 6 min prior to SCA onset (p = 0.06) (See Table A4, Appendix B).Similarly, there was no statistically significant difference in heart rate between each time-frame and the onset of SCA (See Table A3, Appendix B). 0.05 (See Table A2, Appendix B).Post-hoc analyses using Tukey Honestly Significant Difference (Tukey HSD) indicated that there was a significant difference in mean resting heart rate observed between both patient cohorts at 3 h prior to SCA (p = 0.04), but however found no significant difference in mean resting heart rate observed between the two patient cohorts at 6 min prior to SCA onset (p = 0.06) (See Table A4, Appendix B).Similarly, there was no statistically significant difference in heart rate between each time-frame and the onset of SCA (See Table A3, Appendix B).Similarly, the heart rate of patients in the SCA cohort exhibited a higher mean R-R interval duration compared to the normal patients (See Table A1, Appendix A).The mean R-R duration was observed to fluctuate in a similar fashion to heart rate prior to the onset of SCA before exhibiting a sudden increase between 1 min prior to SCA and during the onset of SCA (See Figure 5).There was a statistically significant difference in the mean R-R interval duration at 3 h, F ( A2, Appendix B).Post-hoc analyses using Tukey's HSD indicated that mean R-R interval duration was significantly higher in the SCA patient cohort compared to the normal patient cohort (See Table A4, Appendix B).Similarly, the heart rate of patients in the SCA cohort exhibited a higher mean R-R interval duration compared to the normal patients (See Table A1, Appendix A).The mean R-R duration was observed to fluctuate in a similar fashion to heart rate prior to the onset of SCA before exhibiting a sudden increase between 1 min prior to SCA and during the onset of SCA (See Figure 5).There was a statistically significant difference in the mean R-R interval duration at 3 h, F ( A2, Appendix B).Post-hoc analyses using Tukey's HSD indicated that mean R-R interval duration was significantly higher in the SCA patient cohort compared to the normal patient cohort (See Table A4, Appendix B).For the HRV features, both the RMSSD and SDSD obtained from the SCA cohort were larger compared to the normal cohort (See Table A1, Appendix A).There was gradual increase in RMSSD observed which peaked at 50 min prior to SCA before fluctuating in a similar fashion to heart rate and R-R interval duration.Similarly, SDSD was observed to fluctuate prior to the onset of SCA, peaking at 3 min prior to SCA.Both RMSSD and SDSD, then exhibited a sudden increase between 1min prior and during the onset of SCA (See Figure 6).There was a statistically significant difference For the HRV features, both the RMSSD and SDSD obtained from the SCA cohort were larger compared to the normal cohort (See Table A1, Appendix A).There was gradual increase in RMSSD observed which peaked at 50 min prior to SCA before fluctuating in a similar fashion to heart rate and R-R interval duration.Similarly, SDSD was observed to fluctuate prior to the onset of SCA, peaking at 3 min prior to SCA.Both RMSSD and SDSD, then exhibited a sudden increase between 1-min prior and during the onset of SCA (See Figure 6).There was a statistically significant difference in RMSSD observed at 3 min prior to SCA between normal and SCA patients, F(1,18) = 4.28, p = 0.05 (See Table A2, Appendix B).However, post-hoc analysis using Tukey's HSD indicated that there was no significant difference in RMSSD observed between the two patient cohorts (p = 0.05) (See Table A4, Appendix B).There was no statistically significant difference in SDSD observed at any time point between normal and SCA patients (See Table A1, Appendix A).
Appl.Sci.2017, 7, 954 8 of 16 Figure 6.Time series plot of the changes in heart rate variability (HRV): the square root of the mean of differences between all adjacent R-R intervals (RMSSD) and the standard deviation of differences between all adjacent R-R intervals (SDSD) (n = 10).ECG recordings were taken from patients in the SCA cohort and subjected to processing via MATLAB.The results were recorded as mean RMSSD (±standard deviation) and SDSD (±standard deviation) denoted by the error bars.

Classifier Selection and Statistical Significance
Linear discriminant analysis was first conducted in order to statistically classify patients based on the R-R-interval derived features (mean R-R interval duration, RMSSD, and SDSD) obtained at each time-frame before SCA onset.The best accuracy was obtained at 8 min prior to SCA which exhibited an accuracy of 72.8%.On the other hand, the earliest time-frame which exhibited the best accuracy was 30 min, which produced an accuracy rate of 72.3%.The highest sensitivity was exhibited at 20 min prior with a rate of 70.2%, while the highest specificity rate was observed at 3 min prior at a rate of 83.8% (See Table 1). .Time series plot of the changes in heart rate variability (HRV): the square root of the mean of differences between all adjacent R-R intervals (RMSSD) and the standard deviation of differences between all adjacent R-R intervals (SDSD) (n = 10).ECG recordings were taken from patients in the SCA cohort and subjected to processing via MATLAB.The results were recorded as mean RMSSD (±standard deviation) and SDSD (±standard deviation) denoted by the error bars.

Classifier Selection and Statistical Significance
Linear discriminant analysis was first conducted in order to statistically classify patients based on the R-R-interval derived features (mean R-R interval duration, RMSSD, and SDSD) obtained at each time-frame before SCA onset.The best accuracy was obtained at 8 min prior to SCA which exhibited an accuracy of 72.8%.On the other hand, the earliest time-frame which exhibited the best accuracy was 30 min, which produced an accuracy rate of 72.3%.The highest sensitivity was exhibited at 20 min prior with a rate of 70.2%, while the highest specificity rate was observed at 3 min prior at a rate of 83.8% (See Table 1).Two support vector machine (SVM) classifiers were implemented in this study: linear SVM and a non-linear fine Gaussian SVM.For the linear SVM.The highest accuracy was obtained at two time-frames: 10 min and 8 min prior, both of which exhibited an accuracy rate of 78.9%.The earliest time-frame with reasonable accuracy was at 40 min, which exhibited a rate of 77.1%.The highest sensitivity was exhibited at 8 min prior with a rate of 83.2%, while the highest specificity rate was exhibited at 50 min prior with a rate of 79.0% (See Table 2).For the non-linear SVM, the highest accuracy was obtained at 2 min prior, which exhibited an accuracy rate of 83.9%.The earliest time-frame with reasonable accuracy was at 50 min prior, which had a rate of 80.6%.The highest sensitivity was exhibited at 2 min prior with a rate of 91.5% while the highest specificity was observed at 50 min prior with a rate of 82.5% (See Table 2).Across all classifiers, the time-frames that yielded the best accuracy rates were 2 min and 8 min prior to SCA.The earliest time-frames that exhibited the best accuracy rates relative to adjacent time-frames across all classifiers were 50 min and 40 min prior to SCA (See Tables 1 and 2).

Discussion
As the early detection of SCA is critical, yet not well established, the overall intention of this study was to determine the earliest time-frame prior to the onset of SCA in which ECG changes pertaining to SCA can be detected.Statistical comparison of the importance of each feature in comparison to a normal patient population, with a focus on time-based detection was also pertinent to this study.
Heart Rate.The first feature investigated in this study was mean resting heart rate, where patients in the SCA cohort exhibited a higher mean resting heart rate compared to the normal patient cohort.This correlated with literature findings, however, a larger difference between the SCA and normal cohort was observed in this study compared to previously conducted studies (18.9 vs. 7.5 bpm increase in the SCA cohort) [22].The mean heart rate was then found gradually increase and decrease between 3 h prior to SCA onset before exhibiting a sudden drop during SCA onset.There was a statistically significant difference in the mean resting heart rate observed between the two cohorts at 3 h and 6 min prior to SCA onset.However, after further statistical analysis statistical significance was only achieved at 3 h prior to SCA onset and as the p-value obtained was close to the cutoff value of 0.05, the findings should be considered as only marginally significant.
The mean resting heart rate is an important marker as it both contributes to and reflects cardiovascular pathophysiology [23].Heart rate is controlled by neural influences, where under normal physiological conditions the resting heart is under parasympathetic control, as proven in studies involving the pharmacological blockade of the autonomic influences with atropine [24].The initial increase in heart rate observed occurs as a result of the patient's underlying cardiovascular disease, where there is a chronic imbalance between the sympathetic and parasympathetic control of the heart.The late decrease observed just prior to SCA onset may be attributed to two mechanisms.The first suggested mechanism is vagal withdrawal, which occurs as a result of contraction-perfusion mismatch and, consequently missed baroreflex input.A high heart rate results in a decrease in the diastolic perfusion time resulting in hemodynamically-insufficient ventricular contractions [25].Overall, it leads to deleterious effects on the overall cardiac output and ultimately results in hemodynamic collapse and the functional deterioration of the heart.The second suggested mechanism is due to premature ventricular contraction-mediated disturbance of the cardiac cycle.The increased sympathetic output due to CVD results in the heightened electrical instability of the heart.This in turn gives rise of premature ventricular contractions (PVC), which are early depolarizations originating from the ventricle [26].PVCs result in the delayed activation of the ventricular myocardium as depolarizations from the sinoatrial node are unable to reach the ventricles.As a result, there is a full compensatory pause before the next successive heartbeat following a PVC which, in turn, may contribute to the late decrease in heart rate [27].
It has been widely reported across various large cohort studies, such as the Framingham heart study, that a higher mean resting heart rate is associated with an increase in cardiovascular mortality.Studies have exhibited that an increase in SCA risk was observed in heart rates exceeding 75 bpm [14,22,27].However, the mechanisms underlying the relationship between elevated resting heart rate and SCA risk are still poorly understood and remain to be elucidated.
Mean R-R Interval Duration.In a similar fashion to resting heart rate, the mean R-R interval duration was longer in SCA patients compared to normal patients.This observation aligns with early studies conducted on ambulatory ECGs of SCA patients, where long R-R interval cycles ranging between 640-1110 ms were observed in approximately 90% of patients prior to SCA [14,28].These studies have suggested that this prolongation in the R-R interval observed during SCA occurs as a result of PVCs.As stated in the preceding section, PVCs are followed by a full compensatory pause as the depolarizations from the sinoatrial node fail to reach the ventricles [14].This, consequently, results in disturbances in the cardiac cycle, characterized by the shortening followed by the lengthening of the R-R cycle intervals [29].These early studies have also exhibited that the frequency of PVCs increase significantly from 1-h prior to SCA until the onset of SCA, which may explain the statistically significant differences in the mean R-R interval duration observed between a single time-frame prior to SCA and SCA onset observed in 50% of the SCA cohort [14,28].It is also important to consider that external factors, such as the patient's underlying etiology and medication, may also contribute to R-R interval prolongation.

Heart Rate Variability (RMSSD and SDSD).
The final two features investigated in this study were two time-domain measures of heart rate variability (HRV); the square root of the mean of differences between adjacent R-R intervals (RMSSD) and the standard deviation of the differences between adjacent R-R intervals (SDSD).Studies have shown that beat-to-beat changes in the R-R interval may accurately reflect any variability in sinoatrial node activity and features that utilize the difference between adjacent R-R intervals are ideal for long term measurements of HRV [30].Both the RMSSD and the SDSD of the SCA cohort obtained in this study were higher compared to the normal cohort, although not to a statistically significant extent.Since these features utilize the R-R interval, the difference observed between the SCA and normal patient cohort may be attributed to the mechanisms related to the increase in PVC frequency, as previously discussed in the preceding section.However, the values obtained in this study do not correlate with literature findings which found lower HRV indices in SCA patients [19].Other literature studies have associated low HRV values as a marker of cardiac dysfunction, while high HRV on the other hand is associated with efficient cardiac autonomic mechanisms [31,32].Thus, a high HRV index while the patient is at rest is deemed favorable as it indicates that the body is either able to tolerate stress or is strongly recovering from prior accumulated stress [32].However, it is important to note that a majority of patients in the SCA cohort possess underlying cardiovascular conditions and, as the patients in this study are older than the normal cohort, their hearts have been exposed to stress for a period of time.As a result, their heart may have already acclimatized to these stressful conditions, thus resulting in the high HRV values.
Statistical Classification and Machine Learning.The data was then subjected to statistical classification with the use of various classifiers.The first classifier tested was the linear classifier, which utilized linear discriminant analysis.The best accuracy was yielded at 8 min prior to SCA onset and was found to correlate with literature findings [33,34].However, the values obtained in this study were slightly lower than the values obtained in similarly-conducted studies (72.80% vs. 74.36%)[33].This may be attributed to the signal quality, as the accuracy of a classifier depends on two factors; signal quality and the extracted features [35].SVM classification was then conducted on the dataset and there was an improvement in the accuracy values obtained for both the linear and non-linear SVM classifiers, both of which yielding higher accuracy rates compared to the linear classifier (72.8% vs. 78.9%both obtained at the 8 min prior time-frame).The values obtained from the non-linear SVM classifier were found to correlate with findings obtained from a similar study conducted using the same two ECG database, although the findings obtained for accuracy (83.9% vs. 88.0%),sensitivity (91.5% vs. 92.0%),and specificity (82.5% vs. 84.0%)were slightly lower compared to the literature [34].This slight variation in values may be due to interpatient variation, as in the literature only five patients each were used for the normal and SCA cohort, whereas the cohort numbers in this study were almost double for both the normal and SCA population.
As time starts to approach the onset of SCA, the overall risk of SCA increases and, thus, the percentage at which the classifier will correctly classify a patient at risk of SCA would consequently increase [19].Overall, the experimental results exhibited an increase in accuracy with each time window approaching SCA onset, particularly in the findings obtained from the non-linear SVM classifier.
The performance of each classifier based on the isolated time-frames were then quantitatively evaluated by calculating the area under the receiver operating characteristic (ROC) curve.The higher the AUC, the better the classifier performance [36].The highest overall AUC was obtained by the non-linear SVM classifier in the 2-min time-frame which exhibited an AUC of 0.88.However, there is an approximately 0.02 difference observed between the early time-frames (50 and 40 min prior) and the later time-frames (8 and 2 min prior), suggesting that the risk of SCA can be detected at an earlier time-frame with reasonable accuracy (See Table 3).Overall, the non-linear SVM had the best performance across all time-frames compared to its linear counterparts, which may be due to the fact that it takes into account the non-linearity of ECG signals.Across all three classifiers, the highest overall accuracy was obtained at 2 min prior to SCA onset.This is a time-frame in which a significant difference between the ECG recordings obtained from a patient at risk of SCA differing from a normal patient would be expected.This is due to the increase in the frequency of PVCs over time.Thus, more frequent PVCs at 2 min prior would result in larger compensatory pauses which, in turn, affects the HRV features of patients at risk of SCA, resulting in higher accuracies in classifying SCA and normal patients.A similar conclusion was made across various similarly conducted studies which also discovered that the 2-min time window provided the most useful information for SCA detection [19,[33][34][35].However, it is important to note that the overall aim of SCA detection is to identify patients at risk as early as possible in order to prevent serious repercussions, such as irreversible neurological damage, and even death.Thus, 2 min prior to the onset of SCA is not enough time to allow a patient to respond and seek management.
However, it was also observed that reasonable accuracy rates of 70-80% can be obtained across all three classifiers as early as 50 min prior to the onset of SCA.This, in turn, may provide sufficient time for a patient to respond and reach the hospital to immediately undergo SCA management, in turn reducing the risk of serious complications such as neurological damage, organ failure and, most importantly, death.These time-frames, however, are yet to be explored in the current literature as time-frames spanning only up to 5 min prior to SCA onset have been explored, which does not provide sufficient time for optimal patient response.

Conclusions
The present study explored the detection of SCA through the statistical comparison of ECG features, such as heart rate and R-R interval related markers, between normal and patients at risk of SCA and the identification of the ideal time-frame for detection spanning up to three hours prior to the onset of SCA.Overall, there was a statistically significant change in heart rate 3 h and 6 min prior to SCA onset.There was also a statistically significant change in R-R interval duration the observed 9 min to 3 h prior to SCA onset and for RMSSD at 3 min.Conversely, there was no statistically significant change observed in SDSD at any time-frame.Following classification, the 2-min time-frame exhibited the highest accuracy across all three classifiers.However, reasonable accuracies were obtained at the 40 and 50-min time-frames which, in turn, may provide sufficient time for optimal patient response.The main limitation presented in this study was the small cohort numbers.As only 10 patients were used in each cohort, this may have attributed to the low performance measurement values.This can be addressed through further testing on a larger cohort prior to clinical application.Future studies may also aim to explore ECG feature detection specifically in the SCA patient cohort through the analysis and comparison of time-frames prior to, during, and possibly after the onset of SCA.Overall, the present study further contributes to the growing field of SCA detection by analyzing time-frames three hours prior to SCA onset, in which clinically-useful information can be obtained and utilized in the clinical setting to improve overall patient survival. below.

Figure 2 .
Figure 2. Block diagram of the data segmentation process for the ECG recordings obtained from the SCA cohort.

Figure 2 .
Figure 2. Block diagram of the data segmentation process for the ECG recordings obtained from the SCA cohort.

Figure 2 .
Figure 2. Block diagram of the data segmentation process for the ECG recordings obtained from the SCA cohort.

Figure 3 .
Figure 3. Raw double channel ECG signal, raw single channel ECG signal prior to pre-processing and ECG signal after pre-processing with baseline wander removal.

Figure 3 .
Figure 3. Raw double channel ECG signal, raw single channel ECG signal prior to pre-processing and ECG signal after pre-processing with baseline wander removal.

Figure 4 .
Figure 4. Time series plot of the change in heart rate prior to the onset of sudden cardiac arrest (n = 10).ECG recordings were taken from patients in the SCA cohort and subjected to processing via

Figure 4 .
Figure 4. Time series plot of the change in heart rate prior to the onset of sudden cardiac arrest (n = 10).ECG recordings were taken from patients in the SCA cohort and subjected to processing via MATLAB.The results were recorded as mean heart rate (±standard deviation) denoted by the error bars.The asterisk denotes the statistical significance by repeated measures ANOVA where * p < 0.05.

Figure 5 .
Figure 5.Time series plot of the change in R-R Interval duration prior to the onset of sudden cardiac arrest (n = 10).ECG recordings were taken from patients in the SCA cohort and subjected to processing via MATLAB.The results were recorded as mean R-R interval duration (±standard deviation) denoted by the error bars.Asterisks denote statistical significance by repeated measures ANOVA where * p < 0.05 and ** p < 0.01.

Figure 5 .
Figure 5.Time series plot of the change in R-R Interval duration prior to the onset of sudden cardiac arrest (n = 10).ECG recordings were taken from patients in the SCA cohort and subjected to processing via MATLAB.The results were recorded as mean R-R interval duration (±standard deviation) denoted by the error bars.Asterisks denote statistical significance by repeated measures ANOVA where * p < 0.05 and ** p < 0.01.

Table 1 .
Tabular summary of the accuracy, sensitivity, and specificity of the linear classifier.

Table 1 .
Tabular summary of the accuracy, sensitivity, and specificity of the linear classifier.

Table 2 .
Tabular summary of the accuracy, sensitivity, and specificity of the support vector machine classifiers (SVM): linear SVM and a non-linear Fine Gaussian SVM.

Table 3 .
Area under the receiver operating characteristic (ROC) curves generated for each classifier.

Table A3 .
Tabular summary of the repeated measures ANOVA conducted on the ECG features obtained from time-frames prior to SCA vs. during the onset of SCA (n = 10).

Table A4 .
Tabular summary of post-hoc Tukey's HSD conducted on ECG feature extracted from the normal patient cohort vs. the SCA patient cohort at time-frames which have reached statistical significance (n = 20).denote statistical significance by Tukey's HSD where 1 * p < 0.05 and 2 ** p < 0.01. Asterisks