A Novel Method of QRS Detection Using Time and Amplitude Thresholds With Statistical False Peak Elimination

Heartbeats are important aspects for the study of heart diseases in medical sciences as they provide vital information on heart disorders and abnormalities in heart rhythms. Each heartbeat provides a QRS complex in the electrocardiogram (ECG) which is centered at the R-peak. The analysis of ECG is hindered by low-frequency noise, high-frequency noise, interference from P and T waves, and changes in QRS morphology. This paper presents a new peak detection algorithm that can suppress the noise and adapt to changes in ECG signal morphology for better detection performance. The proposed algorithm is based on median and moving average (MA) filtering, segmentation, time and amplitude thresholds, and statistical false peak elimination (SFPE). The filters are first used in preprocessing to reduce unwanted noise and interference. The data is then divided into smaller segments and each segment is then analyzed using two distinct thresholds, a time axis (x-axis) threshold and an amplitude (y-axis) threshold. Next, the false peaks are eliminated resulting from any residue of noise using an average value of peak-to-peak interval. A post-processing stage is added to eliminate any peak that is detected twice and to search for missed low-amplitude peaks. The proposed method is tested on MIT-BIH arrhythmia and Fantasia databases and provides better results in comparison to several state-of-the-art methods in the field. The mean sensitivity, positive predictivity, and detection error rates for the proposed method are 99.82%, 99.88%, and 0.31%, respectively, for the MIT-BIH arrhythmia database and 99.92%, 99.90%, and 0.18%, respectively, for the Fantasia database.


FIGURE 1. ECG and QRS complex.
of the QRS intact as the information of the R-peaks is also a high-frequency component whose frequency coincides with some of the biomedical signals such as electromyography (EMG). To achieve this, bandpass and derivative filtering are used in [4]- [7]. However, band-pass filters cannot adapt to the sudden variations in the bandwidth in the frequency domain of the QRS [8]. To solve this problem, continuous wavelet transform (CWT) is used in [8] which gives rise to the problem of high complexity and extensive usage of memory. Therefore, further enhancements to reduce those problems would be by using discrete wavelet transform (DWT).
At high frequencies, the wavelet decomposition provides good time resolution and at low frequencies, it provides good frequency resolution. Such types of decomposition are used in [9]- [13] for denoising purposes while the work in [14] presented an overview of the types of wavelets suitable for ECG noise reduction. The process is further enhanced in [15] by making DWT tunable which is a great way to account for records from different databases. However, using wavelet transform requires several filters and that will make the process computationally challenging. Another method that is quite effective in envelope detection is Hilbert transform (HT). This was used in [16] and [17] with each having a separate preprocessing and decision stage. This method was good as it adapts to morphological changes in the ECG signal but was susceptible to high amounts of noise. A combination of both HT and DWT is found in [18], [19], while the work in [20] has used least-mean-squares (LMS) adaptive filtering along with DWT to reduce noise and detect Rpeaks. An overview of adaptive filters was given in [21] that compares different varieties of LMS and recursive-leastsquares (RLS) filters based on their abilities to detect R peaks by adaptively reducing the noise while the work in [22] presents two different modes of adaptive filters which are used for extraction purposes. Empirical mode decomposition (EMD) is another outstanding method to reduce noise. It was used in [23], [24] and was highly effective in minimizing all categories of noise to simplify the detection stage. EMD can adapt effectively to all the changes of morphologies of a wide variety of signals but is a highly complex and memory consuming transformation.
An upgrade of EMD is called the Hilbert-Huang transformation [25] which uses Hilbert transform along with EMD to achieve better noise suppression but at the cost of increasing the overall complexity of the algorithm. A better enhancement to this method was presented in [26] in the form of complete ensemble empirical mode decomposition which uses approximately half the number of shifting operations and therefore can minimize the computational cost of the algorithm [26]. However, the baseline wander is not corrected and must be processed further.
Moving median filters were used in [27] and mean-median filtering along with DWT was used in [28] to remove the baseline wander. This yields better results for noise cancellation than other methods. The use of moving average filters was presented in [29] to suppress powerline interference. Apart from these, machine learning approaches to detect QRS are found in [30]- [35]. These algorithms use deep learning and convolution neural networks to classify the beats and the noise. In [36], [37], algorithms are based on simple learning and transformations that can be easily implemented without machine learning usage.
Kalman filters were used for QRS detection in [38] while they were used along with adaptive thresholding to detect peaks in [39]. Since all these methods rely on heavy-duty processing to reduce noises and then adaptive thresholding to detect peaks, the relation between computational complexity and performance is quite the opposite. The performance may suffer when the record is not clean and in this case, costly processes are considered for better detection.
In this paper, we present a simple statistical approach for detecting QRS without using any computationally intensive filtering or transformations. Here, we propose a novel technique based on median and moving average (MA) filters along with considering the mean of R-R, as a portion of the segment, as a threshold. The use of median filters stabilizes the baseline wander and minimizes the amplitudes of the P and T waves while moving average filtering gets rid of high amplitude electrical noise. Segmentation and Statistical False Peak Elimination (SFPE) are used to detect true R-peaks and remove falsely detected noise peaks. Search back is used to detect any low amplitude true R-peaks missed during the detection.
The rest of the paper is assembled with the summary of the material and data obtained in Section II, the details proposed technique in Section III, and the results of evaluating the proposed method on two standard databases in Section IV along with figures illustrated to show its effectiveness for some challenging ECG records. In addition to this, Section IV also contains the comparison of the results of the proposed method with several others and finally, the conclusion is provided in Section V.

II. MATERIALS AND DATA
The proposed method is evaluated on two distinct databases, namely, the MIT-BIH arrhythmia database [40], and the Fantasia database [41] from PhysioNet [42] which is an open source for physiological signals. The MIT-BIH arrhythmia database has a variety of records with diversity in 46080 VOLUME 9, 2021 morphological changes that better suit the evaluation. The records contain both high and low-frequency noise and artifacts and P and T wave interferences. The database provides 48 ECG records of length 30 minutes each with a sampling frequency of 360 Hz and an 11-bit resolution over ±5 mV range [40]. The records were collected from 25 male and 22 female individuals between the age of 23 to 89. Five leads have been used to collect the data which are MLII, V1, V2, V3, and V4. Now, each record would use two of the five leads to collect the data that has two channels in each record that can be used for evaluation purposes. For our research, we have focused on channel MLII which is widely used and is used to record directly from the chest. The annotations for the database are decided and placed by cardiologists. The Fantasia database consists of forty recordings from 32 individuals between the age of 21 to 85. Here, channel I records the breathing rhythm and so channel II is used for the purpose of this study. The sampling frequency is 250 Hz and each record is two hours long [42]. The annotations for this database are checked by visual inspection. To demonstrate the performance of the proposed method and compare that to the-sateof-the-art methods, we have also included 20 records from the European ST-T Database. This database contains 90 records from 79 individuals with a sampling frequency of 250 Hz over ± 10 mV range [43]. The annotations in this database are verified by two cardiologists separately.

III. PROPOSED METHODOLOGIES
Unlike most algorithms in the literature, this method is formulated using three different stages. Firstly as shown in Fig. 2 the first stage is the preprocessing stage to filter out the unwanted noise and artifacts and minimize the effects of P and T waves. The function of the second stage is to break down the ECG record into smaller segments and to perform peak detection on each of those segments, separately. This stage is referred to as peak detection in Fig. 2. Each record is divided into equal segments of maximum 25000 samples per segment and an amplitude axis threshold is used to eliminate very low amplitude peaks. The mean of the difference between adja-cent peaks is now calculated and used as a time axis threshold to eliminate any peaks resulting from any residue of highfrequency noises. Lastly, the post-processing stage in Fig. 2 is used to link together the smaller segments in the order of their original structure, to cancel any repeated peaks resulting from one peak detected twice at the edge of adjoint segments. A search back sub-stage is finally used to detect any missed peaks by learning from the R-R difference throughout the entire ECG record. Here, x(k) is the input ECG signal, x 1 (k) is the signal after passing through the first median filter, x 2 (k) is the signal after being passed through the second median filter, x 3 (k) is the signal after passing through moving average filter and after absolution, d(k) is the segmented signal, w(k) is the signal that contains false peaks which are eliminated due to high-frequency noise, y(k) is the signal from which false peaks are removed due to one peak being detected twice as the signal was divided into smaller segments and z(k) is the final peak detected signal. To reduce the processing time and to improve detection accuracy, we have considered each segment to be less than or equal to 25000 samples which are automatically decided in the algorithm itself. The entire work can be classified as being a simple first-order statistical analysis of ECG signals. The proposed method is evaluated over two standard databases and compared with existing state-of-the-art methods.

A. PREPROCESSING
This stage contains two steps to suppress noise and other artifacts in the ECG record. It is constructed out of two median filters and a moving average filter of 20 samples.

1) MEDIAN FILTERING
The preprocessing stage starts with processing the entire record with two median filters with a window size of the second filter being twice that of the first filter. The window sizes can be selected to be either, 50 ms and 100 ms, or 100 ms and 200 ms, respectively. This is because P waves occur between 50 to 100 ms before the QRS complex and T waves occur between 50 to 100 ms after the QRS complex. Combining these two median filters in cascade not only diminishes the P and T waves but also eliminates the baseline wander. Any other low-frequency noise that might be in the record will also be minimized if not being fully eliminated. To illustrate this effect, Fig. 3(a) shows the original ECG signal from records 228 of MIT-BIH arrhythmia database with noise and Fig. 3(b) shows the effects of median filtering.

2) MOVING AVERAGE FILTERING
A moving average (MA) filter is employed to suppress the high-frequency noises in the ECG record. Conventional methods use a variety of filters for this purpose. However, using FIR band-pass filters can reduce the peak information significantly [8]. To avoid this, a moving average (MA) filter of 20 samples is utilized. Figure 3(c) shows the signal after passing the signal through the moving average filter. The filter reads 10 samples to the left of the designated sample and 9 samples to the right and calculates the average of these 20 samples to replace it at the position of the designated sample. A MA filter is a low-pass filter that is better at reducing high frequency noise and interference. The MA filter of 20 samples or 55 ms is used to remove frequencies above 18 Hz. This reduces the EMG and other high-frequency noises significantly without distorting the QRS peak. The EMG signal falls between 20 to 200 Hz range and so if a cut off frequency of 18 Hz is used then the EMG signal is completely eliminated. The filter also provides a smooth envelope for the ECG signal which makes the R-peaks prominent. The absolute value of each of the samples is then found to account for premature ventricular contraction (PVC) which lay below the x-axis for most signals. PVCs are extra beats produced by the ventricles of the heart that interferes with the rhythm of the heart. They are the main reason for the heart to initiate ventricular flutter or to skip a beat. The detection of the PVCs is very important as by looking at their negative amplitudes, doctors can predict the abnormality of the sequence of heartbeats and therefore, diagnose a disease properly. In our algorithm, the PVCs are also considered as beats replacing R-peaks when the heart struggles to beat properly.

B. PEAK DETECTION
This stage consists of two steps, segmentation, and false peak elimination where the ECG signal is divided into smaller segments depending on how many samples it consists of. Each segment is processed separately to detect peaks. Figure 4(a) shows a portion of the ECG signal from record 228. Figure 4(b) shows peaks detected on the absolute value of the mean envelope, where the red circles show the peak position and Fig. 4(c) shows the detected peaks on the raw ECG signal, where the circles display the peak locations.

1) SEGMENTATION
After preprocessing is done, the record is now divided into segments of M samples each. This can vary according to the length of the record but for better accuracy and low processing time, the number of samples should not be more than 25000. The notion is to process smaller segments to better adapt to the change in morphology of the ECG signal. To make the division of samples automatic, the algorithm is initialized with R = [2,6,20,26,40,60,72,74], where R is the number of total segments to be produced. If the length of the record is equal to 50000 or less, then the number of segments chosen is 2 from vector R. Similarly, for records with sample numbers less than or equal to 150000, 500000, 650000, 1000000, 1500000, 1800000, and 1850000, the number of segments selected would be 6, 20, 26, 40, 60 72, and 74, respectively. For example, the MIT-BIH arrhythmia database has 650000 samples for each record and so is divided into 26 smaller segments of 25000 each for our experiment. For the databases we have used in our work, no record with more than 1850000 samples was found.

2) STATISTICAL FALSE PEAK ELIMINATION
In this step, each segment is processed individually. First, a fiducial mark vector, W, is created which is a vector consisting of all the local peaks in the segment with a minimum peak separation of 200 ms between peaks. Once this is done, the average amplitude, A, of all these peaks is calculated using the formula, where Q is the number of total peaks, W (n) is the weight of the vector at position n and n is the position of the peaks in vector W. We use upper and lower case boldface to denote vectors. Now, the segment is again processed to detect all the possible peaks with a minimum peak-to-peak interval of 320 ms and an amplitude (y-axis) threshold of C. It is found that C is a value proportional to A and lies between 70% and 125% of the value of A. This is due to the fact that the algorithm depends on learning the peak-to-peak intervals and a huge number of false peaks in the initial detection can downgrade the peak detection operation. So, we try to minimize false detections from the beginning to achieve better results. Once all the local peaks above the amplitude threshold C is found, it is time to select the true positives and eliminate any peak resulting from high frequency noises. ] be formed that contains all the peak-to-peak intervals calculated from vector L, such that, recalling that n is the position of the values in each vector. Now, the average proportional value, G of the mean of the values in vector D is formulated using the equation, where, k is a constant of 0.8 for low morphological change and 0.5 for high changes, and n is the position of the peak values and peak locations in P and L respectively. It is important to note that there is a minimum interval of 320 ms between peaks because it is hard to achieve a beat rate of over 200 beats/minute [44]. This is because a normal person can only achieve a minimum beat rate of 60 beats/minute when awake [45]. If a person has a beat rate of 190 beats/minute which means approximately 3.15 beats/s the minimum separation between beats will come at approximately 320 ms between two beats. Furthermore, if the beat rate goes above this threshold, it signifies ventricular flutter and not heartbeats. For example, if a person experiences around 1 beat per second, there cannot be more than two false positives between two adjacent true positives as each peak will be at least 320 ms away from each other. This is shown in Fig. 5. Considering this, our false peak elimination was proposed where we compare each value in vector D with an instantaneous position i, with G. If it is found that D(i) is less than G, then D(i + 1) is also compared to G. If D(i + 1) is also found to be smaller, then the algorithm guarantees that there is a false peak at position D(i). The location corresponding to D(i), that is L(i + 1), will be removed along with P(i + 1) and a new interval between the peaks will be established using formula, For example, in Fig. 5, it is seen that there are two false peaks, (a) and (b) between true positives at 6000 and 7000 ms time marks. The algorithm calculates all the R-R differences and stores them in vector D. Then G is calculated using equation 3 and used to eliminate the false peaks. The interval between (c) and (a) are compared to G and found lesser than G. At this point, the interval between (a) and (b) will also be compared with G and will also be found to be smaller than G. Thus peak (a) will be eliminated from vectors L and P. Then the algorithm again compares the interval between (c) and (b) with G and finds it smaller than G. This initiates the comparison of the interval between (b) and (d) with G again. Now, the value of the interval is again found to be less than G and so peak (b) is eliminated. This goes on for each of the peak-to-peak intervals in the segment and is quite efficient in removing falsely detected peaks. However, very high amplitude peaks are excluded from this procedure as PVCs are high in amplitude but closer to their preceding peak than G. The step is repeated for each segment and finally, all the peak locations from all the segments together are obtained and stored in vector U and their corresponding amplitudes in vector V. Figure 6 shows the effect of using this stage on a segment of record 104. The record contains high frequency noise on some parts and a section of 25000 samples are shown which contain high amounts of noise. Figure 6(a) displays a peak falsely detected due to highfrequency noise while Fig. 6(b) shows the false peak that was eliminated. VOLUME 9, 2021

C. POST PROCESSING
The post-processing stage has two steps which are false peak elimination due to overlapping and search back to detect any missed peaks. This stage is important because when the ECG record is divided into segments, there could be a peak at the end or beginning of each adjacent segment that might be detected twice. Also, because some of the records are inconsistent in terms of amplitude (i.e., amplitudes that might be too high for one part of the record and too low for another part) it is essential to pass these records through the postprocessing stage to maximize true detection and minimize false positives.

1) PEAK ELIMINATION DUE TO OVERLAPPING
After the peak detection stage is complete, the entire record is now analyzed. The vector T now represents all the peakto-peak intervals in vector U where, Here, T (i) and U (i) are the weights of their respective vectors T and U. Again a time axis threshold is created by using the formula, where T (n) is the weight of the vector at position n and n is the position of the peaks in vector T. H is the time axis threshold, e is the number of locations in U. The full record is processed at a time using this threshold. If an instantaneous peak-to-peak difference, T (i) is less than H then it is regarded as a repeated peak and this peak will be eliminated. Thus, any peak detected twice is now detected only once and so the number of false positives will be reduced further. Table 1 provides an overview of the roles of different vectors in the method.

2) SEARCH BACK
Finally, when most of the true positives have been detected, there might be a few peaks that the algorithm had failed to detect earlier due to their low amplitudes. So, the segments obtained in the segmentation stage is once again analyzed.
Here it is noted that several peaks have been eliminated already as false peaks. Those values are removed from vectors L and P for the corresponding segments and so the new length of these two vectors are now f . Now, vector D is again formulated but this time using the new weights in vector L and equation 2. This time, the amplitude threshold is taken to be B and the mean peak-to-peak interval is taken to be Z for a particular segment, The vector L is further analyzed to find the standard deviation of the peaks. The search back stage will be only triggered if the standard deviation is less than or equal to 100 samples. This is to ensure there is no false trigger as some records are multiform meaning that they have frequent changes in the intervals between peaks. The equation for the standard deviation, S is given by, Now, the algorithm will account for each peak-to-peak interval and then compare it with the value of the amplitude threshold B and time axis threshold Y , where, If the interval between two adjacent detected peaks exceeds the value of Y , then the algorithm confirms that there might be a missed peak in this part of the segment. Therefore, all local peaks with a value greater than B and a minimum interval between the adjacent peak of X is found, where, This will result in finding two or more peaks. Once these local peaks are found, they are then compared with another time axis threshold M where, Only the peaks that have an interval greater than M , compared to the established true positive immediately before them and immediately after them, will be selected as missed true positives (MTP). These MTP are thus added to the vectors U and V at their designated locations in the vectors. A segment of 25000 in Fig. 7 is used to display the results of using this stage. The segment is taken from record 109 where the peak amplitude is too low to be detected in the peak detection stage. Figure 7(a) shows the missed peaks in the segment while Fig. 7(b) shows the detected peaks resulting from the search back stage. Thus, using step-by-step learning and statistical analysis of smaller segments, the method can detect the maximum numbers of true peaks.

A. RESULTS
The proposed method has been implemented in MATLAB R2020a using 2.6 GHz Intel Core i7 CPU with 16 GB RAM and 64-bit Windows 10 operating system. As mentioned earlier the databases used were MIT-BIH arrhythmia and Fantasia databases with 48 records each with a duration of 30 minutes and 40 records each with a duration of 2 hours, respectively. To maintain peak detection logic, a total of 142.5 seconds of data of record 207 from the MIT-BIH database is excluded that contains ventricular flutter. Three merits of evaluation are used to measure the overall performance of the proposed method, and these are sensitivity (Se), positive predictivity (P+), and detection error rate (DER) which are represented by, where, TP is the true positive that is the number of annotated beats detected properly, FN is the false negatives that are the number of missed beats from the annotations, FP is the false positive that is the number of beats that are not annotated but still detected by the algorithm and TB is the total number of beats annotated in the record. The algorithm of the method is represented by Algorithm 1 and the results are represented in Table 2 for MIT-BIH arrhythmia database and Table 3 for the Fantasia database. The results displayed in the paper are better compared to most of the previous methods and show better performance especially for records with changes in morphology. The overall performance for the MIT-BIH database is classified to have a sensitivity (Se) of 99.82%, positive predictivity (P+) of 99.88%, and a very low detection error rate (DER) of 0.31%. The algorithm only faced problems with record 203 which is a difficult record even for humans to detect [40]. This record contains morphological changes, multiform PVCs, and a high amount of instrumental noise like baseline wander, muscle movement noise, and noise from unknown sources. As for the rest of the records, the performance is high compared to any other method mentioned in this paper. The Fantasia database shows even better performance for all records even for records with high noise. As for the rest of the records, the proposed method works well providing higher accuracy. The overall performance for the proposed algorithm on this database is classified to have a sensitivity (Se) of 99.92%, positive predictivity (P+) of 99.90%, and an even lower detection error rate (DER) of 0.18%.
The average time taken to run the algorithm on 30 minutes of a record is 3.5 seconds. Figures 8-11 illustrate the results of different stages in the proposed algorithm for detecting QRS complexes in various scenarios. A noisy segment of each of these records is displayed in these figures and along with the detection of peaks in the original signal. In Fig. 8, there are low amounts of noise with the baseline shift, which is fixed, and the peaks are detected properly. Figure 9 shows the PVCs which are there in the place of R-peaks and they are properly detected even with P and T waves surrounding them. Figure 10 shows a segment of record 104 with highfrequency EMG contaminating it. The noise is not completely filtered out, but the R-peaks are detected without any false negatives or positives. Lastly, Fig. 11 shows a segment of record 203 which contains both high-frequency and lowfrequency noises along with multiform PVCs. Therefore, not all peaks are detected correctly, and this results in some false positives and negatives. The pink circles show the detected  peaks on the preprocessed signal, x 3 (k), while the red circles display the peaks detected on the median filtered signal x 2 (k). The locations of the peaks on the raw ECG signal, x(k) are shown by using red circles for each figure.

B. DISCUSSION
The proposed method is compared to several state-of-theart techniques using different databases. The results of the comparison for MIT-BIH arrhythmia database are shown in Table 4. It contains eleven other methods over a vast timeline with eight of these methods being fairly recent in the field. It is seen that the proposed algorithm has superior performance in detecting QRS over all other methods in all aspects except for three, which are Sharma et al. [15], Sharma and Sharma [1], and Bouny et al. [13]. Thus, those methods are further compared to the proposed algorithm. Table 5 represents a detailed comparison between these three methods and the proposed method using noisy signals from the MIT-BIH database. The records selected are 104, 105, 108, 113, 201, 203, 205, 207, 208, 210 228, and 232 according to [13]. These   records contain either substantial noise or high amplitude P and T waves and so they are ideal for comparison. It is seen that out of the 12 records considered, the proposed method has overall better performance on 5 occasions which are records 104, 113, 208, 228 and 232, than any of the other three methods. In addition to that, the proposed method also shows better sensitivity for record 207 and positive predictivity for records 105, 108, 205, and 210 than other methods. However, Sharma and Sharma [1] shows better detection than all the algorithms including the proposed method on three occasions which are 108, 201, and 207 for both sensitivity and positive predictivity while Sharma et al. [15] shows better detection in only one occasion which is for record 205. The method of Bouny et al. [13] clearly does not show a better overall performance than the proposed method. That method shows better sensitivity on five occa- sions, however, the positive predictivity and detection error rate suffers and in most cases is lower than the proposed algorithm. The method of Sharma et al. [15] also shows better sensitivity than the proposed method on five occasions out of twelve, however, similar to Bouny et al. [13], the method has lower positive predictivity and detection error rate for ten out of twelve records than the proposed method. The method in Sharma and Sharma [1] shows better sensitivity on six records, better positive predictivity on three records, and a lower detection error rate on five records compared to the proposed algorithm. As a result, it can be stated that the proposed algorithm has higher overall positive predictivity than all three of the methods. The record 203 shows the least performance for the proposed method as it is a highly fluctuating record with high amounts of noise, multiform PVCs, and random morphological changes. Considering these statistics, it could easily be said that even if the proposed method Input segment number i of d(k). 9: Compute A by (1). 10: Compute C (Section III-B). 11: Process segment number i of d(k) with amplitude threshold C and 320ms minimum peak-to-peak interval. 12: Compute D by (2). 13: Compute G by (3). 14: Eliminate false peaks to obtain w by (4 Compute B by (7). 24: Compute Z by (8).

27:
Compute X by (11). 28: Compute M by (12). 29: if S <= 100 samples 30: Process segment number i of y(n) with amplitude threshold B and Y samples maximum peak-to-peak interval. 31: if any peak-to-peak interval in y(n) > Y • find peaks in that interval with minimum peak-topeak interval X and minimum amplitude threshold of B and store it in vector a.
• Select only the peaks that are more than M samples away from the true peak preceding it and the true peak after it. has an overall better performance than those of Sharma et al. [15] and Bouny et al. [13] but it is still inferior to the method  of Sharma and Sharma [1] in terms of sensitivity. Therefore, this method is selected for further comparison using Fantasia and European ST-T databases.
Twenty records from each database are selected according to [1] and each record is clipped to one million samples for a fair comparison. Table 6 presents the comparison results. It is seen that, in most cases, the proposed algorithm performs far better than that in [1] and produces far lower false positives. Even though the method of Sharma and Sharma [1] shows better accuracy for sensitivity in the European ST-T database, nevertheless, that method does not perform well in noisy conditions. The sensitivity of the proposed algorithm VOLUME 9, 2021  is slightly lower than that of the method of Sharma and Sharma [1], while the positive predictivity of the proposed algorithm is higher than that of [1]. The proposed method also shows a lower detection error rate using both databases which means more accuracy of true detection. Therefore, it can be verified that the proposed algorithm presents an overall better performance on average than the method in [1] and can better adapt to the changes in the morphology of the ECG signal. The reason behind this is that the proposed algorithm does not contain any non-linear transformations while it is based on the statistical detection of ECG records with two-dimensional thresholds.

V. CONCLUSION
In this paper, a novel method of QRS detection using a simple statistical analysis of the ECG signal has been presented. Median filtering, moving average filtering, segmentation, statistical false peak elimination, and search back have been considered in this paper for effective detection of QRS complexes. The number of segments selected for each record has been varied automatically over the course of two distinct databases. It has been seen that the use of median filters could minimize the P and T waves, and the baseline wander. Dividing the record into multiple segments resulted in low processing time and better accuracy. Furthermore, statistically eliminating false peaks, identified very few false positives and therefore have shown better positive predictivity than other methods mentioned in the paper. Similarly, the search back stage was able to identify missing low amplitude peaks by considering the standard deviations of each segment in a record. Simulation results have shown better performance in most of the records than other state-of-the-art methods. Thus, the proposed algorithm performs better in terms of automatic detection with a higher percentage of overall detection rate. In 2002, he joined Emirates Airlines/Emirates Aviation University. In 2009, he was promoted to the Assistant Professor rank and appointed as a Program Manager of electronics engineering. In January 2014, he was promoted to the Associate Professor rank. In 2017, he was appointed as a Sessional Instructor with the University of Windsor. From May 2019 to June 2020, he was appointed as a Postdoctoral Fellow to develop new algorithms in the biomedical signal separation of ECG signals using blind source separation techniques. He is currently an Assistant Teaching Professor of electrical engineering with Penn State Altoona, PA, USA. His research interests include programmable instrumentation, energy harvesting using piezoelectric and electrostatic approaches, biomedical signal processing, and blind source separation. He is also a member of the IEEE Signal Processing Society, the IEEE Circuits and Systems Society, and the IEEE Educational Activities.