Open access peer-reviewed chapter

Detection of Epileptic Seizure Using STFT and Statistical Analysis

Written By

Furkan Kalin, T. Cetin Akinci, Deniz Türkpence, Serhat Seker and Ufuk Korkmaz

Submitted: 30 April 2019 Reviewed: 06 August 2019 Published: 09 September 2020

DOI: 10.5772/intechopen.89026

From the Edited Volume

Advances in Neural Signal Processing

Edited by Ramana Vinjamuri

Chapter metrics overview

618 Chapter Downloads

View Full Metrics


In this study, EEG data from two volunteer individuals, a healthy individual and a patient with epilepsy, were investigated with two different methods in order to distinguish healthy and patient individuals from each other. The data were obtained from a healthy individual and from a patient with epilepsy at the time of epileptic seizure and of seizure-free interval. The data are those of which validity and reliability were proven and were supplied from the data bank records of University Hospital of Bonn in Germany. In the study, the statistical parameters of the collected data were calculated, then the same data were analysed using short-time Fourier transform (STFT) method, and then they were compared. Both statistical parameter results and spectrum analysis results are compatible with each other, and they can successfully detect healthy individuals and epileptic patients at the time of epileptic seizure and seizure-free interval. In this sense, the results were mathematically highly compatible, which offers significant information for the diagnosis of the disease. In the analysis, the variance values were determined as 253.203 for the healthy individual, 806.939 for the patient at seizure-free interval and 6985.755 for that patient at the time of seizure. Accordingly, standard deviation can be said to be quite distinctive in the designation of values. The frequencies of all three cases resulted in 0, 0–5 and 0–20 Hz, respectively, as a result of conducted STFT analysis, which is quite consistent with the results of the statistical analysis parameters.


  • electroencephalogram
  • statistical analysis
  • epilepsy
  • STFT
  • seizure

1. Introduction

Temporary clinical conditions, including loss of consciousness, sensory, autonomic and mental disorders, arising from excessive electrical discharges in the nerve cells in the brain, with certain intervals are called as seizure. The condition which becomes chronic with the repetition of these seizures is called as epilepsy. Epilepsy is a chronic disorder that affects the brain and that can be encountered in people of all age groups. It is a neurological disease, most commonly seen in childhood and adolescence periods, and is the second most common disease in adults, followed by brain vessel diseases [1, 2, 3]. According to the World Health Organization data, 50 million people around the world are patients with epilepsy [4, 5]. EEG is also used as an auxiliary diagnostic method in the diagnosis of epilepsy, in addition to clinical information, and EEG analysis is performed on patients who are considered to have epileptic seizures [6, 7, 8]. Mathematical and spectral methods are used very effectively for the diagnosis of the disease during the analysis of EGG data [9, 10, 11].

EEG method establishes the basis of epilepsy science, and its history dates back to the 1940s and is used since then. In principle, it is based on the recording of fluctuations of electrical activity of neurons in the brain, and the main contributions of EEG for epileptic cases can be summarized as follows: supports a clinically identified diagnosis; is used as a confirmatory test; helps to make diagnosis correctly; directly and indirectly identifies seizure type and epilepsy syndrome, together with some findings; and informs about the location of focus [12].

Delta (δ) waves are those with frequencies of 1–4 Hz and amplitudes of 20–400 μV. They are seen in cases when the brain has very low activity, such as deep sleep, general anesthesia, immune system, natural recovery.

Theta (θ) waves are those with frequencies of 5–7 Hz and amplitudes of 5–100 μV. They are seen in cases when the brain has low activity, such as sleep with dream, middle anesthesia, stress, emotional commitment.

Alpha (α) waves are those with frequencies of 8–13 Hz and amplitudes of 2–10 μV. They are seen in cases when awake individuals are physically and mentally full resting, there is no any external stimulant, in relaxed positions and when eyes are closed. They are most prominently observed in records obtained from the occipital region.

Beta (β) waves are those with frequencies of 14–30 Hz and amplitudes of 1–5 μV. They are seen in cases, including focused attention, mental work, problem solving, memory, sensory information processing, rapid eye movements phase of sleep [13, 14, 15, 16].

The EEG signals used in this study are registered at the University Hospital of Bonn in Germany [17]. The dataset consists of five subsets (denominated as A, B, C, D and E) that are recorded with the same 128-channel amplifier system and 12-bit analog-to-digital converter. Each of the subsets contains 100 segments with a sampling frequency of 173.61 Hz and a duration of 23.6 s, i.e. 4096 sample points; the corresponding frequency bandwidth is 86.8 Hz. Subsets B, D and E were analysed in this study. While EEG samples in set B were obtained from five healthy volunteers via external surface electrodes, for closed eye condition, set D consisted of EEG segments recorded from patients with epilepsy using intracranial electrodes to monitor epileptic activity, obtained at the time without seizure. Set D data were obtained from epileptic area, and they were recorded. Set E contains EEG data, obtained from patients with epilepsy, recorded at the time of seizure. Strip electrodes were used while recording set E data.


2. Statistical and mathematical background

EEG signals are not deterministic. Since EEG signals do not have a specific shape as electrocardiogram (ECG) signals do, statistical and parametric methods are used in the analysis of EEG signals [18, 19, 20]. Spectral methods are used for the classification and characterization of EEG signals [21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35].

2.1 Statistical analysis methods

Statistical parameters are used to obtain necessary properties, in most of the analyses performed in time domain. Although the mean and median values of signal are expected to result in pretty near zero when the signals have a periodical and sinusoidal structure, these values can get away from zero by taking positive or negative values in non-periodical signals. In the analyses, the most basic mean value, μ, and the standard deviation, σ, can produce distinctive results on non-periodic signals [19]. For a given data set {xi}, these are defined as follows:


where N is the number of the data points.

Knowing the standard deviation value for a given series of numbers and understanding this concept mean knowing to what extent this series is distributing around an average. The bigger standard deviation indicates that datapoints get further away from the average; a small standard deviation indicates that data points form more close groups around the average.

In practice, data often correspond to normal probability distribution (Gaussian), which is actually due to the central limit theorem. According to the central limit theorem, the sum of random variables, which are independent of each other and all have the same distribution, tends to follow a normal distribution at the limit. Here, skewness (α) and kurtosis (β), two functions obtained from the Gaussian distribution, are given in the following Equations [20]:


Here, when α equals zero, it means a perfect normal distribution, and when α takes negative or positive values, it means symmetry is deflected towards the right or left side. In statistical calculations, if the skewness is negative, the tail of the curve will extend to the left, and the distribution will densify on the right side of the graph. If the skewness is positive, the tail of the curve will extend to the right, and the distribution will densify on the left side of the graph. The kurtosis (β) is very close to 3 for the normal distribution. These statistical parameters can be used to quickly check the changes in the statistical behaviour of a signal [18, 19, 20].

2.2 Fourier transform and STFT

The Fourier transform (FT) method is one of the most effective methods used to process signals, in order to obtain information in the signal. In the Fourier transform method, a signal is expressed as the sum of the fundamental cosine and sinus components at different amplitudes, frequencies, and phases. The tabulation of each component with its frequency and amplitude provides convenience during data processing through computers. The equations for Fourier transform are given below in Eq. (5) and Eq. (6) [23, 26, 29, 30, 33]:


Similarly, based on the Fourier transform method, short-time Fourier transform (STFT) and spectrogram were developed by Gabor in 1946. This method most clearly reveals time and frequency localization [17]. STFT provides very decisive results in the analysis of signals. Here, a x(t) signal is used in a fixed window size and in frequency resolution. To define the STFT, let us consider a signal x(t) with assumption that it is stationary when it is windowed through a fixed dimension window g(t), cantered at time location τ. The Fourier transform of the windowed signal yields the STFT [23, 25, 26, 33, 34, 35].


Similarly, for two-dimensional, discretely timed signals, this time-frequency function (t, f) is given in Eq. (8). Here, window g(t) is chosen; the STFT resolution is fixed over the entire time-frequency plane [23, 24, 25, 26, 27, 28, 29, 30]:


The spectrogram is given in Eq. (9):


3. Analysis and application

In this study, the data from two different volunteers were used in the analysis of EGG data. One of these individuals is healthy and the other one is a patient with epilepsy. The healthy individual’s eyes are closed (Figure 1a). The data of the patient with epilepsy were collected when he did not suffer a seizure, and these data were taken from the epileptic area (Figure 1b).

Figure 1.

(a) Healthy (his eyes closed), (b) EEG signal from epileptic area, with seizure-free intervals and (c) EEG signal from the epileptic region at the time of seizure.

When the data of two individuals, healthy and patient with epilepsy, given in Figure 1, are examined, it is seen that while the graphical amplitude of the healthy individual changes in the range of 0–40 μV as shown in Figure 1a, the graphical amplitude of the patient with epilepsy rises up to 125 μV as shown in Figure 1b. As is understood from this graph, the amplitudes of two individuals, healthy and patient with epilepsy, are sufficient to clearly diagnose the disease. The graphical amplitude gets maximum value despite the absence of seizure as shown in Figure 1b. However, the moment when the same individual has a seizure shown in Figure 1c), the amplitudes are seen to increase much. These graphs clearly indicate whether the individual is a patient with epilepsy and whether those patients with epilepsy suffer a seizure (Table 1).

Mean (μ)Standard deviation (σ)VarianceSkewness(α)Kurtosis(β)
Free seizure−5.2428.406806.9391.4375.738

Table 1.

Statistical analysis of healthy individual’s and patient with epilepsy’s EEG signal.

When the statistical parameters of the data from the healthy individual and of the epileptic area of the patient with epilepsy are examined, it is seen that there are significant differences both in the mean value and in the standard deviation. The mean value yields −1.347 in the healthy individual, −5.24 in the patient with epilepsy and − 2.521 when the patient with epilepsy suffers a seizure. As a result of the analysis, standard deviation values can be said to be quite decisive in the diagnosis of the disease. However, while healthy individual and the patient with epilepsy can be distinguished from each other in histograms, the histogram shows a normal distribution at the time of seizure.

In this context, histogram graphs can only be used in the diagnosis of epilepsy, but not in detecting seizure moments. The histograms of the healthy individual and of the patient with epilepsy are given in Figures 2 and 3. Figure 4 shows histograms of the data of the patient with epilepsy at the time of seizure.

Figure 2.

Set E histogram (healthy volunteer).

Figure 3.

Set E histogram (seizure-free intervals).

Figure 4.

Set E histogram (epileptic seizure).

The spectrum analysis of data received from individuals is given in Figures 57. The frequency values were limited to 50 Hz, considering general characteristics of EEG frequency values. At the spectral analysis of the data of the healthy individual, the frequency values were seen to be about 10 Hz, and this corresponds to the alpha waves. When the spectrogram of the patient with epilepsy was examined at the time of free seizure, it was observed that the frequency values corresponded to the range of 0.5–4 Hz (delta wave), and when the data of the same patient were examined at the time of seizure, the frequency values were seen to distribute in the range of 0–20 Hz.

Figure 5.

Spectrogram of healthy individual with closed eye.

Figure 6.

Spectrogram for seizure-free epileptic patient.

Figure 7.

Spectrogram of a patient with epilepsy during epileptic seizure.


4. Discussion

First of all, it should be noted that the data used in the study provide validity and reliability conditions. In this sense, the data used in this study were used in many articles and obtained from the records of the database of University Hospital of Bonn in Germany [11]. Time-frequency-based techniques have been used in many studies using EEG data [36]. In most of these studies, anomalies in the brain can be determined from the high-frequency difference [36, 37, 38, 39, 40, 41, 42]. In this study, the EEG data of individuals with different conditions (non-patient, sick and seizure patient) were analysed. The analyses were compared. This comparison makes it easy to classify the patients. In this study, EEG analysis was approached from different perspectives compared to other studies. Traditionally, basic linear analyses and statistical approaches have been used in time and frequency fields. In this sense, it can be said that the study contains more definite, distinctive results than other analyses. In the literature, the amplitude of the signal, the distance between seizure and non-seizure intervals and the energy ratio of EEG have been investigated. These studies have been used as a criterion for the evaluation of epileptic activity [43, 44, 45, 46, 47]. Today, many mathematical methods are used in the analysis of EEG data [48, 49, 50]. Data collection systems are constantly changing with the developing technology. In the future, it is predictable that the data will be made by remote sensing. Furthermore, the analysis of EEG data with artificial intelligence methods can be developed as a tool. With this tool, neurofeedback applications can be considered as the most important method in the treatment and development.


5. Conclusions

In this study, the data from healthy individual and from the patient with epilepsy were examined. The collection and analysis of data of the patient with epilepsy at both the time of seizure and of seizure-free interval are important for the diagnosis of the disease. In this study, first of all, statistical analyses were performed, and as a result of the analysis, the mean and standard deviation values of the healthy individual and the patient with epilepsy suggest very decisive results. Figure 8 shows the comparison of the histograms of the individuals.

Figure 8.

Comparison of the histograms.

Variance, one of the statistical parameters, also produces meaningful results in distinguishing patient and healthy individuals. In this study, variance value yields 253.203 for the healthy individual, 806.939 for the patient with epilepsy at seizure-free interval and 6985.755 for that patient at the time of seizure. Other statistical parameters also revealed very clear results in distinguishing patient and healthy individuals. However, the results of the STFT analyses support the statistical parameters. In this study, the frequency values of the healthy individual were seen to distribute around 10 Hz, in the range of 0–5 Hz for the patient with epilepsy at seizure-free interval and in the range of 0–20 Hz for that patient at the time of seizure. Accordingly, it can be said that the statistical and spectral analyses made are quite decisive for the diagnosis of the disease.


  1. 1. Nathan SK, Brahme IS, Kashkoush AI, Anetakis K, Jankowitz BT, Thirumala PD. Risk factors for in-hospital seizures and new-onset epilepsy in coil embolization of aneurysmal subarachnoid hemorrhage. World Neurosurgery. 2018;115:e523-e531
  2. 2. Claassen J, Jette N, Chum F, Green R, Schmidt M, Choi H, et al. Electrographic seizures and periodic discharges after intracerebral hemorrhage. Neurology. 2007;69:1356-1365
  3. 3. Lin CL et al. Characterization of perioperative seizures and epilepsy following aneurysmal subarachnoid hemorrhage. Journal of Neurosurgery. 2003;99(6):978-985
  4. 4. World Health Organization Epilepsy. Available from: [Accessed: April 2018]
  5. 5. Goldenberg MM. Overview of drugs used for epilepsy and seizures etiology, diagnosis, and treatment. Pharmacy and Therapeutics. 2010;35(7):392-415.
  6. 6. Tekeli H, Yasar H, Kendirli MT, Senol MG, Ozdag F, Saracoglu M. The prevalence of epilepsy in young Turkish males. Epilepsi: Journal of The Turkish Epilepsy Society. 2012;18(1):1-6
  7. 7. Blume WT. Current trends in electroencephalography. Current Opinion in Neurology. 2001;14:193-197
  8. 8. Haas LF. Hans Berger (1873-1941), Richard Caton (1842-1926), and electroencephalography. Journal of Neurol Neurosurg Psychiatry. 2003;74(1):9. DOI: 10.1136/jnnp.74.1.9
  9. 9. Singh P, Joshi SD, Patney RK, Saha K. Fourier-based feature extraction for classification of EEG signals using EEG rhythms. Circuits, Systems, and Signal Processing. 2016;35(10):3700-3715
  10. 10. Uthayakumar R, Easwaramoorthy D. Epileptic seizure detection in EEG signals using multi fractal analysis and wavelet transform. Fractals. 2013;21(2):24. Article ID: 1350011.
  11. 11. Available from: [Accessed: May 2018]
  12. 12. Neurology: Clinical textbooks of Istanbul Medical Faculty. 2004. İstanbul: Istanbul University Istanbul Medical Faculty
  13. 13. Britton JW, Frey LC, Hopp JL, et al. Electroencephalography (EEG): An Introductory Text and Atlas of Normal and Abnormal Findings in Adults, Children, and Infants. In: Louis EKS, Frey LC, editors. Chicago: American Epilepsy Society; 2016. pp. 8-76.
  14. 14. Malow BA, Passaro E, Milling C, Minecan DN, Levy K. Sleep deprivation does not affect seizure frequency during inpatient video-EEG monitoring. Neurology. 2002;59:1371-1374
  15. 15. Claassen J, Mayer SA, Kowalski RG, Emerson RG, Hirsch LJ. Detection of electrographic seizures with continuous EEG monitoring in critically ill patients. Neurology. 2004;62:1743-1748
  16. 16. Al-Kadi MI, Reaz MBI, Ali MAM. Evolution of electroencephalogram signal analysis techniques during anesthesia. Sensors (Basel). 2013;13(5):6605-6635
  17. 17. Epileptologie Bonn/Forschung/AG Lehnertz/EEG Data Download. 2018;64:061907. DOI: 10.1103/PhysRevE.64.061907. Retrieved from:
  18. 18. Singh P, Pachori RB. Classification of focal and nonfocal EEG signals using features derived from Fourier-based rhythms. Journal of Mechanics in Medicine and Biology. 2017;17(07):1740003.
  19. 19. Kaur J, Kaur A. A review on analysis of EEG signals. IEEE International Conference on Advances in Computer Engineering and Applications. 2015:957-960. DOI: 10.1109/ICACEA.2015.7164844.
  20. 20. Pradhan N, Dutt DN. Data compression by linear prediction for storage and transmission of EEG signals. International Journal of Biomedical Computing. 1994;35(3):207-217.
  21. 21. Ramadan R, Vasilakos A. Brain computer interface: Control signals review. Neurocomputing. 2017;223:26-44
  22. 22. Tzallas AT, Tsipouras MG, Fotiadis DI. Epileptic seizure detection in EEGs using time-frequency analysis. IEEE Transactions on Information Technology in Biomedicine. 2009;13(5):703-710
  23. 23. Vaseghi VS. Advanced Signal Processing and Digital Noise Reduction. New York: Wiley; 1996
  24. 24. Stoica P, Moses R. Spectral Analysis of Signals. Upper Saddle River, New Jersey, USA: Prentice Hall; 2005, ISBN 0-13-113956-8. pp. 15-33
  25. 25. Taylor JK. Statistical Techniques for Data Analysis. London: Lewis Publishers; 1990
  26. 26. Gröchenig K. Foundations of Time-Frequency Analysis. Birkhäuser Boston: Springer Science; 2001. pp. 37-58
  27. 27. Shaker MM. EEG waves classifier using wavelet transform and Fourier transform. World Academy of Science Engineering and Technology. 2007;3:723-728
  28. 28. Şengür A, Guo Y, Akbulut Y. Time-frequency texture descriptors of EEG signals for efficient detection of epileptic seizure. Brain Informatics. 2016;3:101-108
  29. 29. Stoica P, Moses RL. Introduction to Spectral Analysis. Prentice hall: Upper Saddle River, NJ, USA; 1997
  30. 30. Ramos-Aguilar R, Olvera-López JA, Olmos-Pineda I. Analysis of EEG signal processing techniques based on spectrograms. Research in Computing Science. 2017:145;151-162.
  31. 31. Langton C, Levin V. The Intuitive Guide to Fourier Analysis and Spectral Estimation. Ist edition, USA: Mountcastle Company; 2017
  32. 32. Walker JS. Fast Fourier Transform. USA: CRC Press; 1996, ISBN: 9780849371639
  33. 33. Herman RL. An Introduction to Fourier Analysis. NY, USA: Chapman and Hall, CRC Press; 2016
  34. 34. Davis SP, Abrams MC, Brault JW. Fourier Transform Spectrometry 2001. pp. 41-66
  35. 35. Zabidi A et al. Short-time Fourier transform analysis of EEG signal generated during imagined writing. International Conference on System Engineering and Technology (ICSET). Elsevier, Academic Press; 2012. DOI: 10.1016/B978-0-12-042510-5.X5000-8. ISBN: 978-0-12-042510-5.
  36. 36. Faust O, Acharya UR, Adeli H, Adeli A. Wavelet-based EEG processing for computer-aided seizure detection and epilepsy diagnosis. Bandung, Indonesia: Seizure. 2015;26:56-64.
  37. 37. Martis RJ, Acharya UR, Lim CM, Mandana KM, Ray AK, Chakraborty C. Application of higher order cumulant features for cardiac health diagnosis using ECG signals. International Journal of Neural Systems. 2013;23(4):1350014
  38. 38. Adeli H, Zhou Z, Dadmehr N. Analysis of EEG records in an epileptic patient using wavelet transform. Journal of Neuroscience Methods. 2003;123(1):69-87
  39. 39. Litt B, Echauz J. Prediction of epileptic seizures. The Lancet Neurology. 2002;1(1):22-30
  40. 40. Päivinen N, Lammi S, Pitkänen A, Nissinen J, Penttonen M, Grönfors T. Epileptic seizure detection: A nonlinear viewpoint. Computer Methods and Programs in Biomedicine. 2005;79:151-159
  41. 41. Giannakakis G, Sakkalis V, Pediaditis M, Tsiknakis M. Methods for seizure detection and prediction: An overview. In: Sakkalis V, editor. Modern Electroencephalographic Assessment Techniques. Vol. 91 of Neuromethods. Vol. 2015. New York: Springer. pp. 131-157
  42. 42. Uhlhaas PH, Singer W. High-frequency oscillations and the neurobiology of schizophrenia. Dialogues in Clinical Neuroscience. 2013;15(3):301-313
  43. 43. Paul Y. Various epileptic seizure detection techniques using biomedical signals: A review. Brain Informatics. 2018;5(2):2-19
  44. 44. Tessy E, Shanir PPM, Manafuddin S. Time domain analysis of epileptic EEG for seizure detection. In: 2016 International Conference on Next Generation Intelligent Systems (ICNGIS). Kottayam, India
  45. 45. Ilaslan MF. The multiresolution wavelet analysis of the brain signals of epilepsy patients. The Journal of Cognitive Systems. 2018;3(2):30-33
  46. 46. Meng QF, Chen Y. A novel feature extraction method for epileptic EEG based on degree distribution of complex network. WSEAS Transactions on Information Science and Applications. 2015;12:51-60. ISSN: E-ISSN: 2224-3402. Available from:
  47. 47. Bajaj V, Pachori RB. Epileptic seizure detection based on the instantaneous area of analytic intrinsic mode functions of EEG signals. Biomedical Engineering Letters. 2013;3(1):17-21
  48. 48. Doschoris M, Kariotou F. Electroencephalography-mathematical foundation of electroencephalography, chapter 4, Intech Publication; 2017. pp. 35-54
  49. 49. Rashid M, Bari BS, Sadeque G. Mathematical principals and modeling of EEG signal exploration. In: Sittiprapaporn P, editor. Electroencephalography. IOSR Journal of VLSI and Signal Processing. InTech. 2016;6(6):5-9.
  50. 50. Svozilova V, Mezl M. Modeling of the EEG signal. Elektrorevue. 2016;18(2):44-51

Written By

Furkan Kalin, T. Cetin Akinci, Deniz Türkpence, Serhat Seker and Ufuk Korkmaz

Submitted: 30 April 2019 Reviewed: 06 August 2019 Published: 09 September 2020