0% found this document useful (0 votes)
94 views9 pages

An Algorithm To Measure The Stress Level From EEG, EMG and HRV Signals

This work proposes the analysis in time and frequency of EEG and EMG waves with the purpose of obtaining stress states in 5 levels. Due to the advance and evolution of technology, it is possible to obtain low-cost brain-computer interfaces with greater ease in neurofeedback sessions, which, in turn, helps to reduce stress levels in individuals and this requires a deeper analysis due to a scarce investigation...
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
94 views9 pages

An Algorithm To Measure The Stress Level From EEG, EMG and HRV Signals

This work proposes the analysis in time and frequency of EEG and EMG waves with the purpose of obtaining stress states in 5 levels. Due to the advance and evolution of technology, it is possible to obtain low-cost brain-computer interfaces with greater ease in neurofeedback sessions, which, in turn, helps to reduce stress levels in individuals and this requires a deeper analysis due to a scarce investigation...
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

See discussions, stats, and author profiles for this publication at: https://www.researchgate.

net/publication/340400142

An Algorithm to Measure the Stress Level from EEG, EMG and HRV Signals

Conference Paper · November 2019


DOI: 10.1109/INCISCOS49368.2019.00061

CITATIONS READS

0 282

4 authors, including:

Carlos A Almenara
Universidad Peruana de Ciencias Aplicadas (UPC)
48 PUBLICATIONS   188 CITATIONS   

SEE PROFILE

Some of the authors of this publication are also working on these related projects:

THINLINE View project

The Breast Size Satisfaction Survey: An International, Collaborative Project View project

All content following this page was uploaded by Carlos A Almenara on 23 July 2020.

The user has requested enhancement of the downloaded file.


Please cite:
Ugarte, D. E., Linares, D., Kemper, G., & Almenara, C. A. (2019). An algorithm to measure the stress level from EEG, EMG and HRV signals. In 2019 International Conference on Information Systems and Computer
Science (INCISCOS) (pp. 346–353). Quito, Ecuador: IEEE. https://doi.org/10.1109/INCISCOS49368.2019.00061

An Algorithm to Measure the Stress Level from


EEG, EMG and HRV Signals
Diego E. Ugarte1, David Linares2, Guillermo Kemper3 and Carlos A. Almenara4
1,2,3Faculty of Engineering - School of Electronic Engineering
4Faculty of Health Sciences

Universidad Peruana de Ciencias Aplicadas, Lima, Peru


[email protected], [email protected], [email protected], [email protected]

Abstract— This work proposes the analysis in time and Subhani et al. proposes for example an algorithm in [1]
frequency of EEG and EMG waves with the purpose of obtaining oriented to differentiate between a state of stress and a state
stress states in 5 levels. Due to the advance and evolution of of relaxation by analyzing brain waves in two channels. In
technology, it is possible to obtain low-cost brain-computer
this case, an accuracy of 93.4% was achieved. However, the
interfaces with greater ease in neurofeedback sessions, which, in
turn, helps to reduce stress levels in individuals and this requires a method is limited to discerning two states (stressed and
deeper analysis due to a scarce investigation. Different studies are relaxed) and does not allow results to be obtained at
limited to only obtaining binary results, that is to say, if an multiple levels.
individual is in a state of stress or not, but they do not present Similarly, the paper presented by Richer et al. in [2]
results in a scale of levels. We analyzed 6 EEG channels with a proposes an algorithm that analyzes the power of the
sampling frequency of 250 Hz following the 10-20 standard and 1 frequency bands of brain signals. However, they achieve an
EMG channel decomposed in the time and frequency domain
accuracy no greater than 83% by differentiating between a
obtaining parameters with the discrete wavelet transform and
energy per band. The parameters obtained from each signal were state of stress and a state of relaxation.
entered into a k-NN classifier. In the same way, for the validation, Amores et al., on the other hand, proposes in [3] a method
the stress level was established by the graphic analysis of the heart to detect the level of relaxation of an individual on several
rate variability following Baevsky's method, following with the scalesby the analysis of electroencephalogram waves (EEG).
measurement of the relaxation and stress of differents students However, they do not specify the precision of the proposed
while subjecting them to psychotechnical tests. The proposed method and use subjective relaxation perception methods
algorithm was able to differentiate in most cases and quantify the for the validation of the stress leve lof an individual.
states, reaching an accuracy level of 92%.
Wang et al. in [4] proposes an algorithm to differentiate
Keywords— EEG, EMG, HRV, stress, wavelet transform, k-NN, between a state of relaxation or meditation and a state of
Baevsky stress index. stress using a brain-computer interface. In this case, an
accuracy of 90.3% was achieved. However, like some of the
I. INTRODCTION above methods, it is limited to differentiating only two
states.
Stress in people is caused by work, studies, economic
Liu et al. on the other hand proposes in [5] a method to
problems and family problems among others, and it affects
detect between a state of attention or relaxation obtained by
their welbeing causing deterioration in mental and physical
brain waves of students. However, this study was less than
health of the individual.
80% accurate and is limited to only two states of mind.
For this reason, it is becoming increasingly necessary to
The studies conducted by Al-Shargie et al. in [6] and [7]
develop methods, procedures and technological tools to
propose a method for determining the stress level of an
quantify the level of stress of people, so that specialists,
individual quantified at multiple levels from EEG waves. In
through biofeedback sessions, can obtain more reliable
the first study, an accuracy of 86.3% was achieved by
information to achieve a more efficient control of the
differentiating three stress levels, and in the second study,
problem and thus achieve greater welbeing of the individual.
accuracy was improved to 94.79%. However, this method is
At present, the procedure used by specialist and
limited to an analysis with few levels to differentiate.
psychologists to determine a person's state of mind is
Karthikeyan et al. in [8] presents a novel algorithm to
carried out by means of perceptual tests that are subjective,
determine a person's stress level from electromyographic
since they depend on the experience of the specialist and the
(EMG) signals measured in the trapezium muscle,
willingness of the patient to collaborate. This method can
differentiating between four levels with an accuracy of
cause an erroneous diagnosis of the patient's condition and,
90.7%. However, the proposed method does not specify the
therefore, a treatment that does not generate improvement
procedure or the index used to measure the accuracy
and well-being.
obtained and only works with four levels of stress.
In the scientific literature several proposed methods have
Finally, the process carried out by Ahani et al. in [9] used
also been found with limitations in the precision and the lack
2 physiological signals to measure a person's stress level,
quantifitaction levels of the stress level.
obtaining an accuracy of 85% for 2 states and an accuracy of
78% when differentiating in multiple levels. This novel
method uses the analysis of EEG and breathing signals to module allows the simultaneous measurement of different types
determine the degree of stress presented by the person. of biomedical signals such as EEG, EMG and ECG; it also
However, the low accuracy of this method prevents a correct works with a resolution of 24 bits per sample or 0.02235 µV per
analysis for specialists and quantifies stress on a scale of level.

Fig. 1. Block diagram of the presented algorithm

three levels at most. In the acquisition process, data was obtained from 20
The method proposed in this work presents the novelty volunteers in the age range of 20 to 30 years who practice
of using parameters extracted simultaneously from EEG and meditation at a basic, intermediate or advanced level. The
EMG signals in order to find the stress level of an individual process is based on a protocol that consists of closing the eyes
while meditating. The EMG signals are obtained from the for 15 minutes by adapting an upright posture while seated (see
involuntary movements of the left trapezium in order to Fig. 2). The meditation period is delimited by the use of a tingsha
detect the stress level on a five-level scale. In addition, in the at the beginning and at the end of the session. Because the
present work the five levels established by the stress index objective is to measure involuntary movements caused by stress
were used, extracted from the graphical analysis of the on the trapezium muscle, the patient is asked to avoid moving
variation of the cardiac pulse (HRV), which is an objective the arms. In addition, the measurement of the heart rate is also
measure to quantify the stress of an individual. affected by the movement, so this requirement is essential.
All this solves the subjectivity in obtaining the stress level, Data collection is performed (measuring brain signals)
which is obtained by traditional methods, such as surveys or following the international 10-20 standard at points Fp1, Fp2,
long term examinations. T6, T7, O1 and O2 with Ag-AgCl dry electrodes. The
The 2 types of signals are processed and analyzed offline reference and ground are placed at points A1 and A2 as shown
through the algorithm proposed in this paper. The algorithm in Fig. 3 [11].
extracts characteristic parameters from both signals and Frontal points are chosen because of their large variation in
then submits them to a classifier to obtain the stress level. beta waves which increase with a state of stress and relaxation
The computational tool developed can be used by specialists [9]. The temporal and occipital points represent great
variation of theta waves as shown in [9] and finally, alpha
in order to improve the effectiveness of their diagnoses and
waves are reflected with greater intensity in the temporal and
know if the method used is the right one.
occipital points as concluded in [12].
The results obtained were validated using the reference
stress level obtained from the HRV. The results show an
accuracy in the detection of the stress level of 92%.

II. DESCRIPTION OF THE PROPOSED ALGORITHM


The present algorithm employs the use of biomedical
signals to determine a scale of stress in people while
meditating with the mindfulness method, which consists of
a meditation that involves the perception internal and
external factors of an individual. Fig. 2. Data acquisition diagram
Fig. 1 illustrates the block diagram of the proposed
algorithm. Its parts will be described in the following To facilitate data collection, an elastic band was designed
sections. with electrodes in the established points to obtain good contact
with different head sizes. Previous measurements with the
A. EEG data acquisition OpenBCI UltraMark IV helmet had errors due to an unreiable
The OpenBCI Cyton module [10] was used for data contact.
acquisition. It has 8 measurement channels with a sampling
frequency of 250 samples per second. It also has a wireless
connection to a computer through an RFduino module. This
B. EMG data acquisition Each resulting wavelet coefficient is defined as 𝑣𝑖,𝑗 (𝑛),
To acquire EMG signals, two gold electrodes [13] with where i is the level of decomposition and j is the number of
conductive gel are placed on the left trapezium to measure the the sub-band obtained at level 𝑖.
energy present in the muscle at rest (the same position used in Table I shows the mapping of the EEG signals and the sub-
[8] is applied). This muscle was chosen because it has favorable bands obtained with the decomposition tree.
results in the classification of stress states. As specified in [16] the best method to determine the
The 6 EEG signal electrodes and the 2 EMG signal threshold is by absolute deviation of the median, which is
electrodes are connected to the Cyton module and are configured normalized to the value 0.6745 to scale the numerator and
so that the acquisition of EMG waves are in differential mode thus 𝛿𝑖,𝑗 is a suitable estimator of the white Gaussian additive
between the two electrodes. This allows the signals to be noise. This is expressed as [16]:
decoupled from the reference, so that it does not interfere with
the EEG waves that are of lower voltage. Like brain signals, 𝑚𝑒𝑑𝑖𝑎𝑛{|𝐯𝑖,𝑗 |}
EMG waves are acquired with a sampling frequency of 250 Hz. 𝛿𝑖,𝑗 = (1)
0.6745
C. EEG signal improvement
The EEG signals obtained present noise caused by the Where 𝐯𝑖,𝑗 represents the wavelet coefficient vector of the
induction of the 60Hz component of the electrical network. It 𝑖, 𝑗 sub-band.
also has a DC component on which the acquired signals are
mounted (see Fig. 4). To reduce this interference, the wavelet
denoising method was applied.
In this case the wavelet transform breaks down a signal into
its components in time and frequency. Unlike the Fourier
transform, this type of transformation has a lower resolution in
frequency and in time, but more accurately describes non-
stationary signals.
.

(a)

Fig. 3. 10-20 system for EEG. Source: Adapted from [11]

According to the experiments and results obtained in [14],


the best wavelet to eliminate induction noise in EEG signals (b)
is the Daubechies 8 ("db8"). Fig. 4. EEG signal from Fp1 position without. (a) Extract of the EEG
The procedure of the denoising method is described signal. (b) Zoomed EEG signal from the black box in graph (a)
below:
• The wavelet wave type and the decomposition level TABLE I. OBTAINED SUB-BANDS AND EEG BANDS MAPPING
are chosen. Coeficiente Wavelet Banda de frecuencia Onda EEG
𝒗𝟓,𝟎(𝒏) 0 – 3.91 Hz Delta
• The type and the threshold rule are chosen and 𝒗𝟓,𝟏(𝒏) 3.91 – 7.81 Hz Theta
implemented. 𝒗𝟒,𝟏(𝒏) 7.81 – 15.63 Alpha
• The thresholded signal is reconstructed with the 𝒗𝟑,𝟏(𝒏) 15.63 – 31.25 Hz Beta
inverse wavelet transform. 𝒗𝟐,𝟏(𝒏) 31.25 – 62.5 Hz Gamma
The decomposition tree for obtaining the wavelets sub- 𝒗𝟏,𝟏(𝒏) 62.5 – 125 Hz Gamma
bands of interest for the wavelet denoising procedure is shown
in Fig. 5 [15]. In this case 𝑥(𝑛) represents the signal that is
subject to decomposition.
Fig. 5. Decomposition tree [15]

From (1) the threshold 𝑇𝐸𝐸𝐺𝑖,𝑗 is determined for each For the elimination of the DC component and the baseline
sub-band resulting from the decomposition tree: wandering, the coefficients of the sub-band 7.0 were set to zero
i.e. 𝑤7,0 (𝑛) = 0. This sub-band corresponds to the frequency
range from 0 to 0.98 Hz.
𝑇𝐸𝐸𝐺𝑖,𝑗 = 𝛿𝑖,𝑗 √ln⁡(𝑁𝑖,𝑗 ) (2) Then the signal is finally reconstructed with the
corresponding reconstruction tree [16].
Where 𝑁𝑖,𝑗 is the total number of samples from sub-band Subsequently, in order to reduce the noise, a threshold was
𝑖, 𝑗. applied to the sub-band coefficients of the second level 𝑤2,1 (𝑛)
Finally, the threshold coefficients are obtained from the since this corresponds to the frequency band in the range
following expression: [31.25Hz, 62.5Hz] and therefore contains the 60 Hz component
induced by the electrical network.
𝑣𝑖,𝑗 (𝑛)⁡; |𝑣𝑖,𝑗 (𝑛)| ≥ 𝑇𝐸𝐸𝐺𝑖,𝑗 The type of threshold chosen is soft obtained from the
𝑣 ′ 𝑖,𝑗 (𝑛) = { (3) following expression:
0⁡;⁡|𝑣𝑖,𝑗 (𝑛)| < 𝑇𝐸𝐸𝐺𝑖,𝑗
𝑤 ′ 𝑖,𝑗 (𝑛)
The coefficients 𝑣 ′ 𝑖,𝑗 (𝑛) other than zero are estimated to be
𝑠𝑖𝑔𝑛(𝑤𝑖,𝑗 (𝑛)) ∙ (|𝑤𝑖,𝑗 (𝑛)| − 𝑈𝑖,𝑗 )⁡; 𝑤𝑖,𝑗 (𝑛) ≥ 𝑈𝑖,𝑗 (4)
free of noise and distortion. Therefore, they more reliably ={
0⁡;⁡𝑤𝑖,𝑗 (𝑛) < 𝑈𝑖,𝑗
reflect the characteristics of EEG signals.
It is important to note finally that the sub-band 𝑣5,0 (𝑛) was
In this case 𝑤′𝑖,𝑗 (𝑛) is the threshed wavelet coefficient,
not taken into account in all the processing that was applied
to the EEG signals. This is because this sub-band contains the 𝑤𝑖,𝑗 (𝑛) is the wavelet coefficient of the sub-band to be threshed
unwanted DC component that is present in the acquired EEG and 𝑈𝑖,𝑗 the value of the threshold.
signals. The threshold value is obtained from the rigorouse SURE
(rigrsure) algorithm which generates an adaptive threshold
based on the Stein risk estimation principle [17]. This method
D. EMG signal improvement was chosen because it gives the best results compared to other
Like the EEG signals, these signals have induction noise from types of thresholds [18].
the mains and a DC component. The wavelet denoising method
was also used to solve this problem.
In this case the decomposition tree to obtain the wavelets sub- E. EEG feature extraction
bands of interest is similar to the one shown in Fig. 5 with 7 The EEG classification parameters are obtained from the
levels of decomposition. normalized energies of the sub-bands using the following
The wavelet used in this case was the wavelet "coif5". expressions:
The wavelets coefficients of the resulting sub-bands are 𝜃𝑙
𝜃𝑙′ =
defined in this case as 𝑤𝑖,𝑗 (𝑛). 𝜃𝑙 + 𝛼𝑙 + 𝛽𝑙 (5)
𝛼𝑙 Russian astronauts before and after performing emotionally
𝛼𝑙′ =
𝜃𝑙 + 𝛼𝑙 + 𝛽𝑙 (6) demanding missions [20].
After the analysis of the HRV, the parameters explained in the
𝛽𝑙 previous points are obtained and stored in a matrix of the same
𝛽𝑙′ = (7) size as the vector of the level obtained by the stress index that
𝜃𝑙 + 𝛼𝑙 + 𝛽𝑙
are obtained in the same instants of time.
Once the parameters and the corresponding level are obtained,
In this case𝜃𝑙 , 𝛼𝑙 , and 𝛽𝑙 correspond to the energies of theta a k-NN classifier is used to determine the stress value from the
waves (𝑣5,1 (𝑛)), alpha (𝑣4,1 (𝑛)), and beta (𝑣3,1 (𝑛)) EEG and EMG signals.
respectively. The subscript 𝑙 indicates the position of the For each person, a classifier is trained so that the level obtained
measured EEG points: Fp1 (𝑙 = 1), Fp2 (𝑙 = 2), T6 (𝑙 = 3), T7 corresponds to the unique changes an individual present.
(𝑙 = 4), O1 (𝑙 = 5), and O2 (𝑙 = 6). This implies that the The 20 trained classifiers present an accuracy of 92% in the
parameter extraction procedure is applied on the EEG wave determination of the 5 levels. The levels that represented the
obtained from each of the 6 points. This resulted in a total of 18 greatest error are 1 and 5 because they are at the extremes of the
EEG parameters for classification. normal distribution. Figs. 6 and 7 show the stress index obtained
by the HRV analysis and the index obtained with the classifier
for one of the participants. It is observed that the index found by
F. EMG feature extraction the proposed method has a high correlation with Baevsky's
In this process, the 4-level decomposition proposed in [8] was reference index.
used as a reference. However, since this method uses a sampling
frequency of 500Hz which is twice the frequency used in the
present work (250Hz), we opted for a 2-level balanced tree
wavelet packets decomposition.
This decomposition verifies that the most important
information is in the range of 0 - 32.5 Hz.
To characterize the information located in that band, the
minimum, maximum, mean, standard deviation, power, energy
and entropy are extracted from the corresponding coefficients.
G. Classification
A k-NN classifier (k-nearest neighbors) is used in which 25
EEG and EMG parameters are introduced as inputs to obtain the
stress level. The order of the classifier with which the best result
was obtained in terms of precision was 3. The classifier was
trained following the mindfulness protocol. This protocol
establishes that the participant must meditate for 15 minutes in
a seated position with closed eyes. During this time, the left arm Fig. 6. Stress level obtained with HRV analysis.
should not be moved because the aim is to measure the
involuntary movements of the trapeium.
Together with the EEG and EMG electrodes, a pulse sensor
is placed on the index finger of the left arm to measure the
variability of the heart rate. As stated in [19], the minimum time
to obtain the stress level from the heart pulse is 100 seconds, so
we opted for a window that covers that time and consists of a
number of samples that is a power of two for optimization of the
algorithm. That is why a window of 32768 samples is chosen,
equivalent to 131 seconds with a sampling frequency of 250 Hz.
After obtaining the data with the OpenBCI software, the
generated file is analyzed and the features corresponding to each
signal is extracted. First, the cardiac pulse is analyzed and the
time between pulses is obtained. These values are stored to
obtain the variability of the HRV heart rate and then analyzed
graphically to obtain the Baevsky’s index (which will be
Fig. 7. Stress level obtained with the classifier.
explained in detail in the validation process). The use of this
index is due to the objectivity of the physiological signals as
opposed to the values obtained through perceptual tests. That is
why it has been used in studies to detect the presence of stress in
III. RESULTS To find the accuracy of the proposed algorithm, SVM and k-
The level of stress in people is reflected in signals from the NN classifiers were trained. In this case, a higher percentage of
sympathetic and parasympathetic nervous system that regulate accuracy was obtained with the k-NN classifiers, so this type of
the changes in the different bioelectric waves. classifier was chosen.
In this context, heart rate variability (HRV) is an important
reference measure as it directly reflects the level of stress from
the graphical analysis of the RR intervals of the ECG wave (time
period between R waves). Histograms with bin widths of 50 ms
and RR time periods of 0.4 and 1.3 seconds [21] are used for the
analysis. The relationship between height in percent and width
of the intervals establishes the stress index 𝑆𝐼 proposed by R. M.
Baevsky in [22]. This index is expressed as:

𝐴𝑀𝑜
𝑆𝐼 = (8)
2 × 𝑀𝑜 × 𝑀𝑥𝐷𝑀𝑛

Where 𝐴𝑀𝑜 is the amplitude of fashion in percent, 𝑀𝑜 is the Fig. 8. Accuracy percentage of each patient.
fashion expressed in seconds and 𝑀𝑥𝐷𝑀𝑛 is the range of the
interval of RR values expressed in seconds. All these values are The accuracy of the classifier is obtained from the following
obtained from the histogram of the RR periods [22]. expression:
For a normal state of rest the value of 𝑆𝐼 is between 50-150 𝑇𝑃 + 𝑇𝑁
𝐴𝑐𝑐 = (9)
c.u. (arbitrary units) [22]. 𝑇𝑃𝑂𝑃
Table II shows the range of stress index values for each level.
Each of them is associated with a state of the person's emotional Where 𝑇𝑃 is the number of true positives (representing the
state: state of relaxation (low level), normal state (normal level), number of hits), 𝑇𝑁 is the true negatives (representing the
state of medium emotional stress caused by a low mental or number of correct rejections of the classifier), 𝑇𝑃𝑂𝑃 is the total
physical load (moderate level), state of high stress caused by number of tests performed and 𝐴𝑐𝑐 is the accuracy of the stress
significant mental or physical loads (high level) and a state of level in the test. Since the confusion matrix is multivariable, then
very high stress caused by very high emotional or physical loads the true positives and negatives correspond to the diagonal
that could trigger illnesses if kept in that state for a prolonged where the predicted and expected values coincide. Finally, in
time (very high level) as specified by R. M. Baevsky in [23]. order to find the total accuracy of the classifier per person, the
average of the 5 levels is obtained.
TABLE II. STRESS INDEX (𝑆𝐼) INTERVALS Fig. 8 shows a graph of the accuracy obtained by each patient.
Level 𝑺𝑰 Note that an average percentage of 92% is obtained in the
Very High ≥500
accuracy of the classifier.
High 300 – 500
Moderated 150 – 300
In the cases in which the measurement presents a low
Normal 50 – 150 accuracy, it is due to the fact that the individual had some
Low ≤50 movement during the data acquisition.
Tables III, IV, V, VI and VII take as an example the confusion
matrices of 5 of the 20 participants. The columns represent the
To determine the stress level, HRV values are used as
expected values obtained from the HRV analysis and the rows
reference values. These values are then mapped to the 5 levels
represent the results obtained from the classifier with the EEG
shown in Table II. This involves moving from quantitative to
and EMG parameters. As it can be seen, the diagonal of
qualitative valuation.
coincidences is where the classification stress levels is applied
The process seeks to obtain objective values rather than using
correctly and the other cells represent the classification errors.
perception tests based on subjective interpretation. The analysis of the diagonal of coincidence in relation to the
The PulseSensor module, which emits an analog signal and a other cells shows the efficiency of the classifier used, for
green light to measure the variation of blood volume changes, example, if the great majority of values are in this diagonal, it
was used to measure the heart rate. This equipment was modified can be said that the method used can correctly predict the
with a thin layer of silicone on the conductive tracks of the green expected values.
LED, as the contact of the 5V signal with the skin interfered with As mentioned above, the diagonal of hits corresponds to the
the measurement of the other signals. true positives. The true negatives, in this case, are not present in
The sensor is placed on the index finger of the left hand and the matrix, since we want to find the accuracy of all levels.
immobilized with a velcro strap attached to the finger. The Therefore, the accuracy in the classification of the stress level in
sensor output is placed on an auxiliary analog input of the Cyton patients 4, 8, 12, 18 and 19 is 94%, 96%, 85%, 96% and 94%
with a resolution of 16 bits per sample. respectively.
• The validity of the classifier is tested with 30% of the
remaining data with Cohen's kappa index and accuracy.

TABLE III. CONFUSION MATRIX OF PARTICIPANT 4


Values obtained from HRV
(Stress Index)
1 2 3 4 5
1 14 5 0 0 0
2 8 326 9 0 0

Predicted

(k-NN)
Values
3 0 12 1415 19 0
4 0 0 15 310 14
Fig. 9. Kappa coefficient of each patient. 5 0 0 0 3 30

Cohen's kappa coefficient is another statistical measure that TABLE IV. CONFUSION MATRIX OF PARTICIPANT 8
represents the concordance between predicted and expected
Values obtained from HRV
values. The equation for finding the kappa coefficient is defined (Stress Index)
in (10). Where ∑𝑉𝐸 is the sum of the expected values of each 2 3 4 5
1
level, which is defined in (11), and 𝑘𝑎 is Cohen's Kappa 81 15 0 8 0
1
coefficient. The 𝑉𝐸 value is a measure of the expected number 2 4 310 38 2 0

Predicted

(k-NN)
of hits and is calculated in each of the cells of the hit diagonal.

Values
3 0 26 1667 32 0
In (11) it is defined as finding the expected value of hits for each
4 0 0 20 340 2
level, where ∑𝑅𝑜𝑤 is the sum of all the values in the row of the
5 0 0 0 1 53
cell of the level to be measured and ∑𝐶𝑜𝑙 corresponds to the sum
of the values of the column. In the same way as in the case of
TABLE V. CONFUSION MATRIX OF PARTICIPANT 12
accuracy, the kappa coefficient is calculated for each patient and
the values 0.89, 0.92, 0.67, 0.91 and 0.89 respectively are Values obtained from HRV
(Stress Index)
obtained. Fig. 9 shows a graph of the kappa coefficient for each
participant and obtains an average value of 0.83, which indicates 1 2 3 4 5
that the values predicted by the classifier have high concordance 1 18 8 0 0 0
with the values obtained with the 𝑆𝐼, the value of 1 being a 2 10 294 16 0 0
Predicted

(k-NN)
Values

perfect concordance. 3 0 9 1422 21 0


4 0 0 18 316 9
(𝑇𝑃 + 𝑇𝐹) − ∑𝑉𝐸 5 0 0 0 4 35
𝑘𝑎 = (10)
𝑇𝑃𝑂𝑃 − ∑𝑉𝐸
TABLE VI. CONFUSION MATRIX OF PARTICIPANT 18
Values obtained from HRV
∑Row × ∑Col⁡ (Stress Index)
𝑉𝐸 = (11)
𝑇𝑃𝑂𝑃 1 2 3 4 5
1 96 12 0 0 0
In synthesis, the steps to follow to find the values chosen for 2 8 302 41 2 0
Predicted

(k-NN)
Values

the validation of the classifier and the algorithm used are 3 0 15 1649 41 0
summarized in the following points: 4 0 0 28 356 2
• The band with the 6 dry electrodes is placed around the 5 0 0 0 1 38
head, 2 gel electrodes are placed on the left trapezium,
and finally the pulse sensor is attached to the index of the TABLE VII. CONFUSION MATRIX OF PARTICIPANT 19
left hand. Values obtained from HRV
• The data is stored while the individual meditates by (Stress Index)
taking an upright, sitting posture without movement for 1 2 3 4 5
15 minutes. 120 18 2 0 0
1
• The data is processed, and 18 EEG wave parameters and 2 39 107 17 0 0
Predicted

(k-NN)
Values

7 EMG wave parameters are extracted. In addition, the 3 2 17 1309 135 10


stress index is found by analyzing the heart rate. 4 0 0 44 142 16
• 70% of the collected data is used to train the classifier. 5 0 0 2 1 3
The EEG and EMG wave parameters are taken as inputs
and the stress index is set as the desired output of the
classifier.
CONCLUSIONS [14] I. Johnstone and B. Silverman, "Wavelet Threshold Estimators for Data with
Correlated Noise", Journal of the Royal Statistical Society: Series B
An algorithm was developed to quantify the level of stress in (Statistical Methodology), vol. 59, no. 2, pp. 319-351, 1997. Available:
people on a 5-level scale based on EEG and EMG signals and 10.1111/1467-9868.00071.
find its consistency with the stress index obtained by HRV [15] G. Kemper and Y. Iano, "An Audio Compression Method Based on
Wavelets Subband Coding", IEEE Latin America Transactions, vol. 9, no.
analysis. In addition, an accuracy of 92% was obtained in the 5, pp. 610-621, 2011. Available: 10.1109/tla.2011.6030967.
results, which is superior to many of the methods found in the [16] M. Mamun, M. Al-Kadi and M. Marufuzzaman, "Effectiveness of Wavelet
literature and with a scale of levels higher than previous Denoising on Electroencephalogram Signals", Journal of Applied Research
research. and Technology, vol. 11, no. 1, pp. 156-160, 2013. Available:
10.1016/s1665-6423(13)71524-4.
It is concluded that parallel extraction of biomedical signal [17] D. Valencia, D. Orihuela J. Salazar, and J. Valencia, " Comparison analysis
parameters (EEG and EMG) increases the accuracy in between rigrsure, sqtwolog, heursure and minimaxi techniques using hard
recognizing a person's stress level. and soft thresholding methods", Symposium on Signal Processing, Image
A larger database could establish a global classifier to work and Artificial Vision, 2016. Available: 10.1109/STSIVA.2016.7743309.
[18] P. Karthikeyan, M. Murugappan and S. Yaacob, "ECG Signal Denoising
with any type of person within a homogeneous group as opposed Using Wavelet Thresholding Techniques in Human Stress Assessment",
to establishing a classifier per person. International Journal on Electrical Engineering and Informatics, vol. 4, no.
In the future, a portable equipment developed in an embedded 2, pp. 306-319, 2012. Available: 10.15676/ijeei.2012.4.2.9.
system could be designed to analyze the data in real time with [19] P. Fulpatil and Y. Meshram, “Analysis of EEG Signals with the Effect of
Meditation”, International Journal of Engineering Research & Technology
the proposed method for integral neurofeedback and (IJERT), vol. 3, no. 6, 2014.
biofeedback sessions in which a virtual environment is [20] F. Shaffer and J. Ginsberg, "An Overview of Heart Rate Variability Metrics
established from the variations of the state of stress in which a and Norms", Frontiers in Public Health, vol. 5, 2017. Available:
meditation practitioner is found. 10.3389/fpubh.2017.00258.
[21] R. Baevsky and A. Chernikova, “Heart rate variability analysis:
physiological foundations and main methods”, Cardiometry, pp. 66-76,
REFERENCES 2017. Available: 10.12710/cardiometry.2017.10.6676.
[1] A. R. Subhani, W. Mumtaz, M. N. B. M. Saad, N. Kamel, and A. S. Malik, [22] R. Baevsky, B. Bennett, M. Bungo, J. Charles, A. Goldberger and G.
“Machine Learning Framework for the Detection of Mental Stress at Nikulina, “Adaptive responses of the cardiovascular system to prolonged
Multiple Levels,” IEEE Access, vol. 5, pp. 13545–13556, 2017. spaceflight conditions: assessment with Holter monitoring”, Journal of
[2] R. Richer, N. Zhao, J. Amores, B. M. Eskofier, and J. A. Paradiso, “Real- Cardiovascular Diagnosis and Procedures, vol. 14, no. 2, pp. 53-57, 1997.
time Mental State Recognition using a Wearable EEG,” 2018 40th Annual [23] R. Baevsky and A. Berseneva “Use of Kardivar System for Determination
International Conference of the IEEE Engineering in Medicine and Biology of the Stress Level and Estimation of the Body Adaptability”, 2008.
Society (EMBC), 2018.
[3] J. Amores, R. Richer, N. Zhao, P. Maes, and B. M. Eskofier, “Promoting
relaxation using virtual reality, olfactory interfaces and wearable
EEG,” 2018 IEEE 15th International Conference on Wearable and
Implantable Body Sensor Networks (BSN), 2018.
[4] H. Wang, Q. Song, T. Ma, H. Cao, and Y. Sun, “Study on brain-computer
interface based on mental tasks,” 2015 IEEE International Conference on
Cyber Technology in Automation, Control, and Intelligent Systems
(CYBER), 2015.
[5] N.-H. Liu, C.-Y. Chiang, and H.-C. Chu, “Recognizing the Degree of
Human Attention Using EEG Signals from Mobile Sensors,” Sensors, vol.
13, no. 8, pp. 10273–10286, 2013.
[6] F. M. Al-Shargie, T. B. Tang, N. Badruddin, and M. Kiguchi, “Mental Stress
Quantification Using EEG Signals,” IFMBE Proceedings International
Conference for Innovation in Biomedical Engineering and Life Sciences,
pp. 15–19, 2015.
[7] F. Al-Shargie, T. B. Tang, N. Badruddin, and M. Kiguchi, “Towards
multilevel mental stress assessment using SVM with ECOC: an EEG
approach,” Medical & Biological Engineering & Computing, vol. 56, no. 1,
pp. 125–136, 2017.
[8] P. Karthikeyan, M. Murugappan, and S. Yaacob, “EMG Signal Based
Human Stress Level Classification Using Wavelet Packet
Transform,” Communications in Computer and Information Science Trends
in Intelligent Robotics, Automation, and Manufacturing, pp. 236–243, 2012.
[9] A. Ahani, H. Wahbeh, H. Nezamfar, M. Miller, D. Erdogmus, and B. Oken,
“Quantitative change of EEG and respiration signals during mindfulness
meditation,” Journal of NeuroEngineering and Rehabilitation, vol. 11, no.
1, p. 87, 2014.
[10] OpenBCI, Cyton Biosensing Board (8-channels). 2019.
[11] G. Rojas, C. Alvarez, C. Montoya, M. de la Iglesia-Vayá, J. Cisternas and
M. Gálvez, "Study of Resting-State Functional Connectivity Networks
Using EEG Electrodes Position as Seed", Frontiers in Neuroscience, vol.
12, 2018. Available: 10.3389/fnins.2018.00235.
[12] Sharma, A. and Singh, M. (2015). Assessing alpha activity in attention and
relaxed state: An EEG analysis. 2015 1st International Conference on Next
Generation Computing Technologies (NGCT).
[13] OpenBCI, Gold Cup Electrodes. 2019.

Please cite:
Ugarte, D. E., Linares, D., Kemper, G., & Almenara, C. A. (2019). An algorithm to measure the stress level from EEG, EMG
and HRV signals. In 2019 International Conference on Information Systems and Computer Science (INCISCOS) (pp. 346–
353). Quito, Ecuador: IEEE. https://doi.org/10.1109/INCISCOS49368.2019.00061

View publication stats

You might also like