In this study, we aim to determine the stress level in a non-invasive way to the maximum extent possible by analyzing behavioral and contextual data received from the only source being a smartphone containing the data gathered in real-life situations. The information collected includes audio, gyroscope and accelerometer features, light condition, screen mode (on/off), current stress level self-assessment, and the current activity type. Three stress analysis models have been built: two with the consideration of current activities of a participant and one without those. Classification of low- and high-stress conditions, which was executed for a separate model for a certain kind of activity only, enabled us to achieve 3.9 % higher accuracy than that under the conditions when those activities were neglected. Also, the Android application was developed as a means for the current activity-type identification.
Problems related to mental health are gradually moving to priority positions in the structure of public health of today’s world. Stress is one of the main reasons for this, and it causes activation of the sympathetic division of the autonomic nervous and the hypothalamo–hypophyseal portal systems. The result of this reaction is secretion of hormones, including cortisol which is responsible for neurotoxic damages, emotional and vegetative reactions, and ultimately, behavioral and mental disorders and somatic diseases [1–3].
Stress can be both a brief reaction to some events, and it can also have a prolonged/chronic effect on the body. Such prolonged impact on the human body is very dangerous, and it can cause various diseases. According to the report , stress as a basic reason can lead to more than 60 % of all human illnesses. Depression, anxiety, antisocial behavior, fatigue cognitive impairments, sleep and immunological disorders, and neurodegenerative diseases can be a result of a long-term stress impact .
The most common stress recognition methods are connected with determination of physical and physiological responses of the body to stress. According to researchers , the following body features can be used for these purposes: heart rate (HR), heart rate variability (HRV), electrodermal activity (EDA), electrocardiogram (ECG), electromyogram (EMG), skin temperature (ST), pupil dilation (PD), blood volume pulse (BVP), respiration, voice features, facial expression, eye gaze, and blink rates. Despite the progress and the potential of physiological and physical stress recognition, these methods also have its disadvantages: In order to gather data on body (physiological data) parameters, it is necessary to wear various wearable sensors (chest belts, wrist bands, head wearing devices, skin patches, and others).
Rapid growth in smartphone use, development of its technical capabilities, and increasing number of sensors built into them allow us to analyze various stress situations using the data received from smartphones as the only and sufficient source (behavioral pattern and contextual data). A smartphone is a device that we always carry with us. Smartphone data analysis method for stress recognition can replace the physical and physiological data analysis method and consequently reach maximal noninvasiveness and unobtrusiveness in the process of stress recognition.
Nevertheless, there are several critical tasks that have to be taken into account in the data analysis. Physiological and physical reactions of the human body vary depending on the type of activity; our behavioral pattern, and physical and mental sensibility to stress also vary depending on the current activity type. This research applies innovative technologies to stress recognition by analyzing behavioral and contextual data received from smartphones as the only and sufficient source. Additionally, we determined current activity types in this study by using an Android application with the purpose to evaluate the accuracy of the classifiers both with the consideration of current activities of the participant and without those.
The remainder of the paper is organized as follows: In Sect. 2, related work is presented. Section 3 describes the proposed approach to stress determination. The results are presented in Sect. 4. Finally, conclusions are made in Sect. 5.
2 Related work
2.1 Stress determination
Due to increased public interest to mental health, numerous researches have been recently published regarding the field of stress recognition. This fact approves the importance of the mentioned topic among researchers. For example, more than 1000 scientific articles were published in the first quarter of 2015 as compared to only 616 articles in the field of stress analysis for the entire year of 2000. Figure 1 demonstrates the number of publications available through the Google Scholar service, depending on the year. To find relevant studies, we performed a search query on the Web site at http://scholar.google.ru and sorted the data by year. In this search query, there were also negative keywords added from those areas that are not associated with stress or emotion recognition.
Authors of many studies evaluated changes in physical and physiological parameters of a human body depending on the stress impact. ECG, EMG, skin conduction (SC), and respiration data were used for determination of the driver stress level . The stress detection system based on BVP, PD, GSR, and ST data was developed  to recognize the stress level among computer users. It should be noted that high accuracy of classifications was achieved in these studies which amounts to 97.4 % in the first and 90.01 % in the second study, respectively.
When smartphones gained popularity in the world, there arose an issue of whether stress leads to changes in our behavior that are possible to be detected by means of a mobile phone, and whether there is a correlation between the stress level and contextual information. The authors  classified whether the participants were stressed or not with 75 % accuracy through the application of data combination received from wearable sensors (accelerometer (ACC) and SC), and from a smartphone [calls, short message service, location, and screen mode (on/off)]. The other study offered a solution for stress assessment of people based on the data derived from a chest belt (collected HRV data during sleep), and a smartphone (collected audio, physical activity, and communication data during a working day) with 61 % accuracy . Nevertheless, it should be noted that continuous stress monitoring means the same continuous wearing/carrying wearable sensors, which can be uncomfortable for participants. So, for example, according to the report , one-third of wearable fitness tracker owners stop wearing them after about 6 months. However, there is one device we cannot do without in modern life. The device we always take with us is a mobile phone. Through the analysis of behavioral and contextual data received from a smartphone, it becomes possible to receive noninvasive and unobtrusive stress recognition methods when necessary. In the last few years, researchers have put a lot of effort to achieve successful results by means of the above-mentioned methods.
2.2 Using a mobile phone for stress recognition
Changes in our behavior caused by stress can be determined through the analysis of the data received from a smartphone. The authors  detected behavioral changes among students during an examination period (considered as a stress-full time) and after an examination period (considered as a stress-less time) by using a mobile phone. They were able to detect an average behavior modification equal to 53 % between examination and non-examination periods. Experimental results in another study where researchers achieved 72.9 % accuracy for a two-class classification showed that human behavior metrics derived from the mobile phone activity can reliably recognize a daily stress . A short comparison of various stress recognition techniques applied in the use of a smartphone for stress recognition purposes is presented in Table 1.
3 The proposed approach to stress determination
Smartphone Nexus 5 was applied (behavioral and contextual data collection, provision of current stress level self-assessments) for the purpose of developing a solution for stress determination in an indirect way (noninvasive). No additional wearable sensors were applied. The following sections describe the proposed approach for data collection and analysis.
3.1 Behavioral and contextual data
Application based on framework Funf  gathered behavioral and context data. Then, these data were uploaded to a server in SQLite format upon availability of a WiFi connection. Once all the data were collected, it was imported to the database MySQL in separate tables, and the titles of the tables corresponded to the means of the collected information. The field “time stamp” was a primary key for every table, unique within a single table and corresponded to the time of occurrence of the event in the Unix format in 1-s increments. The schema of the main database storing information obtained from a variety of built-in smartphone sensors is depicted in Fig. 2.
Brief description and collected data properties are listed below.
Assess: current self-assessment of stress level based on a seven-scale questionnaire Nasa-TLX . An Android application “Stress Tracker” was developed for this purpose, the interface of which is depicted in Fig. 3. This application displayed a request to evaluate the current stress level of a participant from 09:00 to 19:00 every hour at a random time. The time interval between the requests could not be less than 30 min.
We used a binary classification; consequently, evaluation marked with “1, 2, 3” was classified as “low stress,” while the levels “4, 5, 6, 7” were classified as “high stress.” Self-reports about current stress level were used as ground truth to label the collected data into two above-mentioned classes. After the labeling process, the data from the “assess” table were submitted to the main database table “base_weka.” Following the initial preprocessing, the data from other tables were also submitted to the database table “base_weka.”
Audio: Ambient noise data were collected every 300 s. Time interval between measuring of ambient noise (and other parameters below) was chose with the condition that a smartphone could hold a charge for at least one full day, as the smartphone was planned to be simultaneously used for usual daily activities. The data included (1) MFCC (mel-frequency cepstral coefficients) which characterize the signal based on its spectrum and amplitude; (2) l1norm (least absolute deviations) and l2norm (least squares); (3) frequencybands, i.e., power spectral density across frequency bands; and (4) diffSecs, i.e., difference in seconds between records up to the twelfth decimal place; this parameter was not involved in the computation, but it was used to test the accuracy of event detection. After completion of the data collection, average values for 3-, 5-, and 10-min intervals were calculated for all the audio features in order to consider the short-term and medium-term impact of changes in audio features on the stress level.
Gyro: Gyroscope readings on X-, Y-, and Z-axes were recorded every 120 s. Then, average values for 10- and 15-min intervals were calculated.
Screen: Every case of changing the screen mode (on/off) was counted. Information on the number of the phone screen switching on and off for the last 10 and 20 min was submitted to the main database table.
Light: The values of the ambient light were detected every 300 s. The light values for the last 10, 20, and 30 min were submitted to the main database table.
Probe: Based on the data received from ACC, the activity level (none, low, or high) was determined. Values of the activity level for the last 30, 60, and 120 min were submitted to the main database table.
Activity: We developed an Android application for classification of the current activity (walking, standing still, on car, tilting), which is compatible with Google activity recognition API . The “tilting” activity corresponds to a sedentary or standing state of the user. This application shows the type of activity, confidence, date, and time in which the event was detected. The application interface is presented in Fig. 4. The current activity was recorded every minute for the purpose of receiving more detailed information. The detected activity was recognized as true if the confidence was more than 50 %. The data were further exported to.csv format, and then, it was submitted to the MySQL database.
The above data and its properties were selected for the stress analysis based on previous experience (according to Table 1).
3.2 Activity recognition
We decided to develop an application based on the Google activity recognition (GAR) for several reasons. Firstly, there is no need in Internet and GPS access for determination of the current activity, so such condition significantly reduces battery consumption. Secondly, this is a non-obtrusive method which does not require wearing any additional sensors by the user or any other interference due to the fact that only the data from smartphone ACC are used for the activity recognition. Thirdly, preliminary tests showed that the accuracy of determination of the mentioned activity types by this method was sufficiently high.
Nevertheless, it was necessary to interpret the resulting data on daily activities in the right way. It has been observed that in the process of data collection, there can appear several activities different from the activities block of one and the same type, not being a result of an error of the activity determination algorithm. For example, if a group of “car” blocks is followed by 1–2 units of “standing,” and then, the group of “car” blocks resumes the chain, it can be a result of stopping due to a traffic light or a traffic jam. Consequently, we could replace those 1–2 units of “standing” activity with “car” activity units, because while waiting for the enabling signal to turn on, the person is still in the car, and then continues movement. An example of such a situation is illustrated in Fig. 5 in row 999, where the fragment of the activity recognition application log is presented.
Thus, we will assume that the “car” activity ends if there are at least 3 units with activities other than “car” at the moment of its last detection. However, “standing”, “tilting” (the device angle relative to gravity changed significantly. This often occurs when a device is picked up from a desk or a user who is sitting stands up ), “walking” activities may have blocks of 1 and 2 units of an activity. An example of this can be a case of working on the computer followed by a short coffee break. To avoid motion artifacts that affect the data collected, it was important to understand whether the user is in a fixed position, which corresponds to the “standing” type of activity.
According to , to use stress models with physiological responses of body in practice, we must be able to correctly detect stress even during other activities that affect one’s physiology. In this study, we were interested in understanding the possibility of application of the behavioral pattern and contextual data to accurately detect stress even during various daily activities. And there also was a question to be answered, “Will information on the current user activity help build a more accurate classifier?” The question is reasonable because according to Table 1, the field of stress determination using the data received from a smartphone as the only and sufficient source with consideration of different types of activities is not fully understood yet.
A collection of algorithms for machine learning WEKA  was applied for data analysis. After collection and import of all the data to the software package WEKA, three models of classification were built:
Initial model based on the analysis of behavioral and contextual data derived from a smartphone.
Second model: The data on the activity type at a certain point of time were added to the initial model.
Finally, a separate model of classification for the “standing” activity type was built. We wanted to check that can we get advantages due to building separate models for certain type of daily activity.
The following four algorithms were applied for data analysis: random forest, simple logic, and J48 and REPTree (both are decision tree). Tenfold cross-validation was used for all algorithms. All data were divided into 10 different folds: one fold was used for testing and remaining nine were used for training. This procedure repeated while every fold was used for a testing. The average classification accuracy of four algorithms was calculated for each model (Table 2) for evaluation of the effectiveness of each model.
Figure 6 shows the results of the classification with the use of the above three models and various analysis algorithms.
Application of the second model of classification considering the current activity type made it possible to improve the accuracy of high- and low-stress state classifications by 2.3 % compared to the initial model. At the same time, when building a separate model for “standing” activity only, the classification accuracy was improved by 3.8 % compared to the initial model.
The results confirm our expectations that our behavioral pattern will vary for various activities. With due consideration to the current type of human daily activity and especially by building separate analysis models for each type of activity, we can create a more precise stress recognition system.
It must also be noted that when using the data received from a smartphone ACC only, the accuracy of 82.5 % was achieved for the second model considering daily activity, and the accuracy of 90.32 % was the result of a separate model for “standing” activity only.
5 Conclusion and future work
In this study, we presented preliminary results of an ongoing project on how to use smartphone sensors to detect stressful situations. For classification of high- and low-stress states, we used the data received in real life from a smartphone as the only and sufficient source. Our results showed the average accuracy of 73 % in a binary classification of high- and low-stress conditions using only behavioral and contextual data received from a mobile phone. And by application of a separate model for the “standing” activity only, we achieved the accuracy of 75.81 %. Thus, the information on daily activity can be used to build more precise separate classifiers for each type of activity.
Although these results are preliminary, they showed that the data received by smartphones can be applied for stress recognition. This method can replace widespread stress analysis methods based on physical and physiological responses of the human body to stress in cases where maximal noninvasiveness must be reached.
Our future plans include collection of more data for analysis, to execute extensions and optimizations of the algorithms, to build separate stress analysis models for various daily activities which can be determined by the application developed in this study.
Goodyer IM, Park RJ, Netherton CM, Herbert J (2001) Possible role of cortisol and dehydroepiandrosterone in human development and psychopathology. Br J Psychiatry 179(3):243–249
Lupien SJ, McEwen BS, Gunnar MR, Heim C (2009) Effects of stress throughout the lifespan on the brain, behaviour and cognition. Nat Rev Neurosci 10(6):434–445
Gotlib IH (ed) (1994) Stress and mental health: contemporary issues and prospects for the future. Plenum Press, NY, p 340
The American Medical Association (2013). http://www.ama-assn.org
Sysoev M, Kos A, Sedlar U, Pogacnik M (2014) Sensors classification for stress analysis: toward automatic stress recognition. In: 2014 International conference on identification, information and knowledge in the internet of things (IIKI). IEEE, pp 117–121
Sysoev M, Sedlar U, Kos A, Pogacnik M (2014) Stress-sensors classification and stress-analysis algorithms review. Elektrotehniski vestnik 81(5):263
Healey JA, Picard RW (2005) Detecting stress during real-world driving tasks using physiological sensors. IEEE Trans Intell Transp Syst 6(2):156–166
Zhai J, Barreto A (2006) Stress detection in computer users based on digital signal processing of noninvasive physiological variables. In: 28th Annual international conference of the IEEE Engineering in Medicine and Biology Society, 2006 (EMBS’06). IEEE, pp 1355–1358
Sano A, Picard RW (2013) Stress recognition using wearable sensors and mobile phones. In: 2013 Humaine association conference on affective computing and intelligent interaction (ACII). IEEE, pp 671–676
Muaremi A, Arnrich B, Tröster G (2013) Towards measuring stress with smartphones and wearable devices during workday and sleep. BioNanoScience 3(2):172–183
Endeavour Partners (2014) http://endeavourpartners.net/assets/Endeavour-Partners-Inside-Wearables-Part-2-July-2014.pdf
Bauer G, Lukowicz P (2012) Can smartphones detect stress-related changes in the behaviour of individuals? In: 2012 IEEE international conference on pervasive computing and communications workshops (PERCOM workshops). IEEE, pp 423–426
Bogomolov A, Lepri B, Ferron M, Pianesi F, Pentland AS (2014) Pervasive stress recognition for sustainable living. In: 2014 IEEE international conference on pervasive computing and communications workshops (PERCOM workshops). IEEE, pp 345–350
Wang R, Chen F, Chen Z, Li T, Harari G, Tignor S, Campbell AT (2014) Studentlife: assessing mental health, academic performance and behavioral trends of college students using smartphones. In: Proceedings of the 2014 ACM international joint conference on pervasive and ubiquitous computing. ACM, pp 3–14)
Peternel K, Pogačnik M, Tavčar R, Kos A (2012) A presence-based context-aware chronic stress recognition system. Sensors 12(11):15888–15906
Sanches P, Höök K, Vaara E, Weymann C, Bylund M, Ferreira P, Sjölinder M (2010) Mind the body! Designing a mobile stress management application encouraging personal reflection. In: Proceedings of the 8th ACM conference on designing interactive systems. ACM, pp 47–56
Alexandratos V, Bulut M, Jasinschi R (2014) Mobile real-time arousal detection. In: 2014 IEEE international conference on acoustics, speech and signal processing (ICASSP). IEEE, pp 4394–4398
FUNF, Open Sensing Framework (online). http://funf.org
Hart SG, Staveland LE (1988) Development of NASA-TLX (Task Load Index): results of empirical and theoretical research. Adv Psychol 52:139–183
Google activity recognition (online). https://developer.android.com/reference/com/google/android/gms/location/DetectedActivity.html
Google developers documentation (online). https://developers.google.com/android/reference/com/google/android/gms/location/DetectedActivity#TILTING
Hong JH, Ramos J, Dey AK (2012) Understanding physiological responses to stressors during physical activity. In: Proceedings of the 2012 ACM conference on ubiquitous computing. ACM, pp 270–279
Weka, The University of Waikato (online). http://www.cs.waikato.ac.nz/ml/weka
The work was supported by the Ministry of Education, Science and Sport of Slovenia, and the Slovenian Research Agency.
Rights and permissions
Open Access This article is distributed under the terms of the Creative Commons Attribution 4.0 International License (http://creativecommons.org/licenses/by/4.0/), which permits unrestricted use, distribution, and reproduction in any medium, provided you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons license, and indicate if changes were made.
About this article
Cite this article
Sysoev, M., Kos, A. & Pogačnik, M. Noninvasive stress recognition considering the current activity. Pers Ubiquit Comput 19, 1045–1052 (2015). https://doi.org/10.1007/s00779-015-0885-5
- Mobile Phone
- Heart Rate Variability
- Short Message Service
- Contextual Data
- Wearable Sensor