Abstract
Digital phenotypes are behavioral patterns inferred from digital data, which have significantly contributed to eHealth research. Machine learning has proven effective in tracking these patterns; however, psychophysiological variables are still underutilized in identifying digital phenotypes. The objective of this study was to test the machine learning algorithms XGBoost, AdaBoost, RFC, and GaussianNB in classifying digital phenotypes of severe anxiety. Data from 360 volunteers, aged between 18 and 68 years of both sexes, were collected through self-report scales via the Neuropesquisa app, which simultaneously captured psychophysiological data, such as response time, accelerometer, and gyroscope readings. Scores from the DAAS-21 scale were used to identify individuals with severe anxiety. The results indicated that all four algorithms detected the digital phenotype with an accuracy greater than 75%. The RFC and GaussianNB classifiers achieved the highest accuracies, 81.48% and 80.56%, respectively, with f1 scores of 44.4% and 60.38%, and AUCs of 79% and 83% on the ROC curves. We conclude that the GaussianNB algorithm was the most effective in predicting the digital phenotype of severe anxiety.
Key words
Anxiety; Data Analysis; Digital Phenotypes; Machine Learning; Psychophysiology
INTRODUCTION
The digital phenotype is defined as the observable expression of mental states and cognitive traits, inferred from individuals’ interactions with digital devices such as smartphones and mobile applications (Liu et al. 2025, Zulueta et al. 2018). Its application in mental health is based on the collection of behavioral and physiological data, which, when analyzed, can reveal patterns indicative of emotional disorders such as depression, stress, and anxiety (Ben-Zeev et al. 2015, Bourla et al. 2018). The analysis of such data provides a non-invasive and highly scalable approach for continuous psychological monitoring, promoting preventive and personalized interventions (Insel 2017, Shaban-Nejad et al. 2018).
Anxiety is one of the most prevalent mental health conditions globally, representing a significant burden on public health systems and severely impacting individuals’ quality of life (Ferrari et al. 2024, WHO 2022). This condition affects cognitive, motor, and emotional functioning and can alter fine motor behavior and hand stability—signals that are reflected in everyday use of digital devices (Cardinale et al. 2019, Hardin et al. 2007). Thus, behaviors such as changes in typing speed, response time, and the way one holds a smartphone become measurable indicators of anxiety, forming digital phenotypes that can be automatically tracked (Jacobson et al. 2020, Klepp et al. 2015, Torous et al. 2021).
The application of machine learning algorithms is crucial for categorizing digital phenotypes in mental health derived from smartphone sensors, as it allows for the analysis of large volumes of data with high precision and robustness (Beam & Kohane 2018, Heckler et al. 2022, Onnela 2021). Among the most commonly used algorithms are Random Forest, XGBoost, Gaussian Naive Bayes, and AdaBoost, all capable of handling imbalanced and heterogeneous data with good accuracy and interpretability (El Morr et al. 2024, Heckler et al. 2025). Random Forest is recognized for its stability in predicting relapses and treatment responses and is highly effective in classifying physiological data and self-reports. XGBoost, in turn, stands out for its ability to model complex interactions between variables and is effective in predicting symptom variability in anxiety with high accuracy (Jacobson & Feng 2022, Jang et al. 2024). Although Gaussian Naive Bayes is simple, it performs well in classifying anxious states in low-data environments, as evidenced during the COVID-19 pandemic. Finally, AdaBoost enhances overall performance by combining weak learners into a strong model and is effective in detecting anxiety based on behavioral and questionnaire data (El Morr et al. 2024). For a more comprehensive revision about the uses of machine learning in digital phenotype analysis see (Dos Santos et al. 2024).
The literature indicates that sensor-based digital phenotypes offer greater consistency and sensitivity in identifying emotional states such as anxiety, especially when combining multiple sensors with psychologically validated self-report scales (Ben-Zeev et al. 2015, Bourla et al. 2018). Smartphone sensors with high acquisition rates, such as accelerometers and gyroscopes, demonstrate levels of precision comparable to traditional physiological sensors, expanding their applicability in naturalistic contexts (Zulueta et al. 2018, Kanjo et al. 2019). When combined with scales such as the DASS-21, which demonstrates high reliability, the data acquired become psychophysiological, integrating behavioral and functional aspects of the nervous system (Vähäsarja et al. 2025, Zanon et al. 2021). Although the accelerometer is widely validated for identifying emotional states such as anger and sadness (Quiroz et al. 2017), response time remains underexplored, despite its potential as a psychophysiological marker of anxiety (Jacobson et al. 2020, Klepp et al. 2015). Research has shown that reaction time is a sensitive marker of altered emotional states, directly reflecting the impacts of anxiety on executive functions (Edwards et al. 2017, Zohar & Shamir 2016). However, these findings have not yet been replicated using data collected remotely through digital phenotype analysis.
Most digital phenotype studies rely on applications that continuously monitor users’ smartphones over extended periods—ranging from days to weeks or even months (Bufano et al. 2023). While such approaches allow for rich longitudinal data collection, they can also lead to participant attrition, as research apps running persistently in the background may impair device performance and battery life. This often results in users uninstalling the app before the end of the study period.
To address this limitation, we developed an application that captures digital phenotype data intensively within a single time window, precisely during the period when participants are completing an online questionnaire that includes an anxiety scale. Upon completion, the app automatically generates and transmits a file containing the questionnaire responses, along with detailed sensor-based data—including accelerometer recordings of device movements and keystroke response times for each item.
Our aim was to determine how accurately and precisely the Random Forest, XGBoost, Gaussian Naive Bayes, and AdaBoost algorithms could classify and predict participants’ levels of severe anxiety based on smartphone-derived features— reaction time, accelerometer, and gyroscope —which were simultaneously collected as participants typed their responses to the DASS-21. The simultaneous inclusion of these parameters enables a more precise characterization of anxious states by combining subjective and objective indicators of both physiological and behavioral nature (Ben-Zeev et al. 2015, Bourla et al. 2018). Additionally, the scarcity of studies employing reaction time to track digital phenotypes (Jacobson et al. 2020, Dos Santos et al. 2024) highlights the innovative approach of our proposal.
MATERIALS AND METHODS
Research design
The present study employed an observational, quantitative, and cross-sectional design with the objective of exploring the effectiveness of algorithmic models in predicting and monitoring anxiety symptoms. Participants were instructed to complete the scale spontaneously, without restrictions regarding time or environment, in order to obtain naturalistic data on device usage.
The sample consisted of 360 volunteers, aged between 18 and 68 years, of both sexes. Participants were recruited through a public call on social media platforms, which initially attracted 383 individuals who expressed interest in taking part in the study. However, 23 participants were excluded: 19 for being under the age of 18 and 4 for reporting that they had left their mobile devices stationary on fixed surfaces during questionnaire completion, thereby compromising the quality of the sensor-captured data (Figure 1).
Volunteers participated in the study via the NeuroPesquisa® application, which was designed to collect psychophysiological and psychometric data in a simplified manner and with higher user engagement. Unlike other applications that continuously track digital phenotypes over extended periods, NeuroPesquisa® aims to identify the user’s digital phenotype within a single usage session. This data collection model seeks to enhance participant engagement, as users are able to install the application, complete the required assessments (the DASS-21 scale and sensor data) in approximately 20 minutes, and subsequently uninstall the application from their smartphones. This approach minimizes user burden, making participation more accessible and less invasive, which may contribute to higher adherence rates and lower dropout rates.
This study was conducted in accordance with the guidelines of the Declaration of Helsinki and was approved by the Research Ethics Committee (Comitê de Ética em Pesquisa - CEP) in Brazil (approval number 4.735.002). Data collection took place between July and September 2021.
Materials and instruments
The NeuroPesquisa® app
NeuroPesquisa® is a free app for Android devices, developed by Meneses et al. (2023), aiming collecting information from Android smartphones through the completion of self-report psychological scales, while simultaneously gathering data from the device’s sensors, such as the accelerometer, gyroscope, and response time recorded as the participant answers the self-report questionnaires.
With the recording of information obtained through the accelerometer and gyroscope sensors, the app can capture the device’s movement every 10 milliseconds. The timestamp of each recording is also stored and uploaded in real-time to a cloud database (Meneses et al. 2023).
Self-report instrument
Through the app, the DASS-21 was completed, a self-report scale that measures the participant’s symptoms of anxiety, depression, and stress, subdivided into 3 subscales, with 7 questions for each type of symptom mentioned. Each subscale category is scored as normal, mild, moderate, or severe (Lovibond & Lovibond 1995). The instrument was validated for Brazilian Portuguese with adequate psychometric properties (Vignola & Tucci 2014). Its popularity is attributed to its unifactorial structural validity and high internal consistency, with Cronbach’s alpha coefficients exceeding 0.90, which establishes it as a reliable measurement tool (Vähäsarja et al. 2025).
Selection of Algorithmic Models
Algorithms such as Random Forest Classifier (RFC), Gaussian Naïve Bayes (GaussianNB), Extreme Gradient Boosting (XGBOOST), and Adaptive Boosting (AdaBoost) have been extensively studied across various domains of digital health and bioinformatics, demonstrating characteristics that make them promising candidates for digital phenotyping applications. The robustness and high predictive capacity of these methods—particularly RFC, XGBOOST, and AdaBoost—have been evidenced by classification accuracies exceeding 90% in complex biomedical tasks, frequently outperforming traditional techniques when applied to noisy datasets or those with imbalanced class distributions (Babajide Mustapha & Saeed 2016, Chaplot et al. 2023, Khalid et al. 2023, Xie et al. 2018, Fernández-Delgado et al. 2014, Nkemdirim Okere et al. 2025, Sai et al. 2023).
Moreover, these algorithms exhibit a lower tendency toward overfitting—a common challenge in machine learning with pathophysiological data—due to their architectures based on ensembles of decision trees and regularization strategies. This structural advantage enhances model generalizability to unseen data, thereby increasing their clinical applicability (Khalid et al. 2023, Xie et al. 2018, Fernández-Delgado et al. 2014).
Model interpretability is also a critical factor, particularly in healthcare, where identifying key predictors of a phenotype can influence clinical decision-making. Random Forest and AdaBoost allow for the analysis of variable importance, facilitating the understanding of underlying mechanisms and the validation of findings by domain experts (Nkemdirim Okere et al. 2025). Gaussian Naive Bayes has proven effective in predicting outcomes based on digital phenotypes in mental health treatment contexts (Heckler et al. 2025), and is recognized as the most commonly used algorithm in machine learning studies investigating smartphone usage (Dos Santos et al. 2024). Furthermore, AdaBoost demonstrates robustness against noise and outliers and addresses the issue of class imbalance—a frequent challenge in naturalistic data collection—thereby enhancing model sensitivity for detecting minority cases (Shivaiah et al. 2024, Wang & Sun 2021).
In practice, these algorithms have been successfully applied in predicting a range of health conditions, including genetic disorders, diabetes, and kidney diseases, as well as in the analysis of large clinical datasets, enabling efficient classification of complex patterns related to symptoms, diagnostic tests, and vital signs (Chaplot et al. 2023, Khalid et al. 2023, Shahidian et al. 2025, Nkemdirim Okere et al. 2025, Sai et al. 2023).
Accordingly, RFC, GaussianNB, XGBOOST, and AdaBoost have become established as key tools in digital phenotyping, offering a balance of high accuracy, resilience to complex and imbalanced data, and potential for clinical interpretability. These characteristics justified their selection in the present study to classify the digital phenotype of severe anxiety.
Data collection and analysis procedures
A relational database was developed to store volunteer information and optimize data analysis. The database (DB) was designed based on an Entity-Relationship Diagram (ERD) to represent the characteristics of the entities, the relationships between them, and their cardinalities (Figure 2).
Characteristics of the ER Diagram. Entity-relationship diagram that guided the construction of the database to optimize analysis.
Pentaho Data Integration (PDI) was employed to process the files and extract relevant data. Using PDI’s transformation tools, the total response time, response times for each questionnaire and individual question, as well as the scores for the 7 items of the DASS-21 anxiety subscale, were calculated. Based on these scores, 86 of the 360 participants were classified as having severe anxiety, while the remaining 274 did not exhibit extreme anxiety levels. The participants’ questionnaire responses, response times, DASS-21 scores, and corresponding classifications were consolidated into a single Excel spreadsheet.
The remaining procedures of this study were conducted in the Jupyter Notebook environment, using the Python programming language, with the support of the Anaconda distribution platform. The main packages applied included NumPy and Pandas, which focus on data manipulation, Scikit-Learn, a library for implementing machine learning techniques, and Matplotlib, used for creating graphical representations (Hill et al. 2024).
The Pandas library was used to load Excel spreadsheets and assign them to DataFrame objects. The NumPy library enabled the creation of multidimensional arrays and provided functions for calculating statistical measures, such as means and standard deviations, from these arrays.
Thus, using the Pandas library, DataFrames were created from the spreadsheet records, containing sensor data associated with each individual. Using NumPy, the means and standard deviations for each sensor axis were calculated. The resulting DataFrames were then structured into groups based on the questions and questionnaires, generating separate instances to allow the computation of means and standard deviations per question and per questionnaire in a similar manner (Bhardwaj et al. 2023). The data related to response times and DASS-21 scores were also loaded into a DataFrame. In order to optimize the handling of the variables, which were numerous, they were subdivided into 40 individual spreadsheets, each containing information on all participants.
Among the spreadsheets created, one included the questionnaire responses and classifications based on the DASS-21. Three spreadsheets recorded the total response times, organized by both individual questions and the entire questionnaire. The remaining six spreadsheets corresponded to the X, Y, and Z axes of both the accelerometer and gyroscope sensors. Of these, three provided the mean values for each axis, per question and per questionnaire, while the other three reported the standard deviations for each axis, per question and per questionnaire.
Choosing Machine Learning Models
The following models were identified in related works (Chikersal et al. 2022, Dlima et al. 2022, Jacobson & Feng 2022): Random Forest Classifier (RFC), GaussianNB, XGBoost, and AdaBoost. To implement these models, except for XGBoost, it was sufficient to import the existing algorithm implementations from Scikit-Learn. For the XGBoost model, the corresponding package had to be installed before its implementation could be instantiated.
The data was split into two separate datasets, one to be used for training the models and the other for testing them, with 70% and 30% of the data, respectively. This split was performed using the train_test_split method from Scikit-Learn, ensuring that the percentage of participants with severe anxiety levels was equal in both datasets.
Variable selection
The “selectFpr” method from Scikit-Learn was used, which performs an Analysis of Variance (ANOVA) on the variables to select significant results. From an initial set of 1791 variables, only 104 passed this test.
Even so, some of the algorithms did not deliver the expected results. To reduce the number of variables, Principal Component Analysis (PCA) was used. This multivariate analysis technique allows combining variable data, reducing the number of variables with minimal loss of information. This is achieved by using the eigenvectors of the covariance matrix to reduce the dimensionality of the original data, linearly converting correlated variables into a smaller number of uncorrelated variables. With the application of the PCA method, the initial set of 104 variables was reduced to just 88, which was then used in the final training of the models.
Performance analysis
Once the models were trained, they were used to predict the classification of participants in the test dataset. Then, a confusion matrix was created for each model with its predictions and the actual classes. To evaluate the effectiveness of the predictive models, the following metrics were extracted from these matrices to assess model performance: accuracy, sensitivity, specificity, precision, f1-score, and area under the curve (AUC) of the Receiver Operating Characteristic (ROC) curve.
RESULTS
A total of 1,859 predictor variables were identified, comprising one variable for total response time, 7 for questionnaire response times, 135 for individual question response times, 6 for the overall means of the sensor axes (MS), 6 for the overall standard deviations of the sensor axes (DPS), 42 for the mean values of each sensor axis per questionnaire, and 42 for the standard deviations of the sensor axes per questionnaire. Additionally, there were 135 variables representing the mean values per question for each sensor axis (MPES) and another 135 for the standard deviations per question of the sensor axes (DPES). The last two sets of means were then multiplied by the 6 MS means and 6 DPS means, resulting in 810 MPES and 810 DPES variables.
Phase 1: Confusion matrix
The results presented in this section were obtained during the testing phase, where the previously trained models were applied to classify the participants in the test group (Table I).
From Analysis of the data from the confusion matrices shows that a model is considered more effective when it yields a higher number of true positives and true negatives. The goal of an ideal confusion matrix is to maximize these values while minimizing false positives and false negatives (Valero-Carreras et al. 2023). Based on the confusion matrix results, the models were evaluated using specific metrics to assess the performance of each algorithm (Figure 3).
Performance Metric Equations. Accuracy = measures the rate of correct predictions made by the model, i.e., the percentage of correct classifications; Sensitivity = measures the model’s ability to classify positive cases; Specificity = is the opposite of sensitivity and measures the model’s ability to classify negative cases; Precision = reflects the percentage of cases classified as positive that are truly positive; F1-Score = is the harmonic mean of sensitivity and precision.
Phase 2: Effectiveness of predictive models
Based on the results presented in Table II, all models exhibited satisfactory accuracy levels (> 75%). Among these, the RFC model was the most efficient, achieving an accuracy rate of 81.48%. These findings suggest that all models were capable of accurately predicting the class to which the test group participants belonged.
Performance metrics of the four algorithms used. Percentage of accuracy, sensitivity, specificity, precision and F1-Score for the four algorithms used.
In terms of sensitivity, only the GaussianNB model demonstrated satisfactory performance, achieving an accuracy rate of 61.54%. The other models did not show the same efficiency in identifying individuals with severe anxiety symptoms. On the other hand, all models exhibited notable specificity rates, with the minimum value of 86.59% achieved by the GaussianNB. Therefore, these models demonstrated significant ability to accurately distinguish individuals who did not present severe anxiety symptoms.
The RFC algorithm achieved the highest precision, reaching 80%, while the other models ranged between 50% and 60%. This suggests that, although the RFC did not identify the majority of individuals in the severe anxiety category, those it did identify were largely from that group. In terms of the F1-score, which evaluates the algorithm’s balance between precision and recall in classifying severe anxiety cases, the GaussianNB model stood out, with a score of 60.38%.
The final performance metric used was the AUC of the ROC curve. The ROC curve plots the True Positive Rate (TPR) on the Y-axis against the False Positive Rate (FPR) on the X-axis, with both values ranging from 0 to 1. An ideal model achieves perfect class differentiation, with a TPR of 1 and an FPR of 0, resulting in an AUC of 1. Thus, the closer a model’s AUC is to 1, the better its performance. According to the ROC curves and AUC values shown in Figure 4, both the RFC and GaussianNB models demonstrated strong class differentiation capabilities.
ROC Curve Graph. The graph illustrates the comparison of the true positive rate with the false positive rate.
DISCUSSION
This study utilized smartphone sensor data, including accelerometer, gyroscope, and response times, combined with psychometric data from the DASS-21 scale to identify severe anxiety symptoms. Four machine learning algorithms were employed for classification and prediction: Random Forest Classifier (RFC), Gaussian Naive Bayes (GaussianNB), XGBoost, and AdaBoost. Considering the complexity of the dataset, characterized by high dimensionality and variability, these algorithms were essential for the classification and prediction of digital phenotypes of severe anxiety. The literature supports that models such as RFC, GaussianNB, and XGBoost have been widely used in digital health due to their robustness, generalization capability, and suitability for smartphone sensor data (Heckler et al. 2025, Dos Santos et al. 2024).
The analysis of performance metrics for the XGBoost and AdaBoost classifiers reveals that these models did not perform as well in classification terms, as their metrics were consistently among the least favorable. This outcome may be related to these algorithms’ higher sensitivity to variable selection and the nature of the dataset, which exhibits high dimensionality and possible class imbalance (Bhadra & Kumar 2022, Wang & Sun 2021).
In contrast, the RFC and GaussianNB classifiers exhibited strong performance, achieving high levels of accuracy, specificity, and AUC, as reflected in their respective performance curves (Chaplot et al. 2023, Fernández-Delgado et al. 2014, Heckler et al. 2025). Such results corroborate previous evidence that combining psychometric data with psychophysiological variables extracted from smartphone sensors significantly improves accuracy in identifying anxiety symptoms, surpassing methods based solely on self-report (Ben-Zeev et al. 2015, Bourla et al. 2018).
Regarding sensitivity and precision, both models demonstrated similar performance, with GaussianNB outperforming on one criterion and RFC on another. This suggests that the models may be complementary, offering different advantages depending on the clinical objective—for example, broad screening versus diagnostic confirmation (Heckler et al. 2025, Khalid et al. 2023). Considering the F1-score, GaussianNB emerged as the model with the best balance between sensitivity and precision. This balance is particularly relevant in clinical contexts, where both false negatives and false positives can have serious implications (Sau & Bhakta. 2019). Furthermore, previous studies suggest that reaction time—included in this study as a psychophysiological variable—may be a sensitive marker of anxious states, reflecting the impact of stress on cognitive and motor processing (Cardinale et al. 2019, Jacobson et al. 2020).
However, it is important to note that although GaussianNB achieved the highest F1-score, RFC demonstrated superior generalization ability, reflected in its high accuracy and precision. This finding reinforces the potential of RFC as a robust model in scenarios with greater variability in input data, making the objective choice of the best model between the two a challenging and context-dependent task (Xie et al. 2018). The combination of different sensors—such as accelerometer, gyroscope, and response time—in a single computational model is highlighted in the literature as a promising strategy for more accurate characterization of digital phenotypes, especially in anxiety contexts (Zulueta et al. 2018, Lee et al. 2023).
Machine learning models have consolidated as effective tools for classifying digital phenotypes of anxiety by integrating behavioral, physiological, and digital data collected from smartphones, wearable devices, and virtual environments. Recent evidence indicates that algorithms such as autoencoders, Random Forest, XGBoost, LightGBM, and CatBoost achieve high accuracy and F1-scores—ranging from 87% to 90%—in predicting the severity of social anxiety symptoms, especially when applied to multimodal datasets (Choi et al. 2024, Park et al. 2025, Aldayel & Al-Nafjan 2024, Zhang et al. 2025). Additionally, models trained with variables such as physical activity, heart rate, and sleep patterns have demonstrated high performance in predicting impending panic episodes, reaching areas under the ROC curve (AUC) above 0.90 (Jang et al. 2024). The use of data extracted from virtual reality sessions, including physiological and acoustic signals, has further enhanced the discriminative capability of models across different anxiety dimensions (Park et al. 2025). Supervised learning strategies, especially those employing ensemble techniques like Random Forest and Bagged Trees, have shown robust performance in both controlled experimental contexts and population-based applications, demonstrating their generalization capacity and clinical applicability (Aldayel & Al-Nafjan 2024, Zhang et al. 2025, Ihmig et al. 2020, Tabares et al. 2024).
In the study by Bhatnagar et al. (2023), which compared the performance of five algorithms for identifying anxiety and depression among maritime workers, Recursive Feature Elimination (RFE) was used for variable selection. The evaluated algorithms included Logistic Regression, GaussianNB, RFC, SVM, and CatBoost. The results identified CatBoost as the best-performing model, achieving a precision of 82.6% and accuracy of 84.1%. Although CatBoost was not tested in this work, its boosting-based architecture with native support for categorical variables may represent a promising alternative for future studies, especially in contexts with heterogeneous and unstructured data (Bhatnagar et al. 2023, Sau & Bhakta 2019).
A study that employed the DASS-21 to classify levels of anxiety, depression, and stress applied various algorithms, including Decision Tree (DT), Random Forest Classifier (RFC), Support Vector Machine (SVM), Gaussian Naive Bayes (GaussianNB), and K-Nearest Neighbors (KNN). GaussianNB achieved the highest precision, while RFC was considered the best overall model (Priya et al. 2020). These findings reinforce the suitability of these classifiers for psychometric data combined with smartphone sensor information, as in our approach.
In general, the results of this study demonstrate that RFC and GaussianNB classifiers stand out as the most effective approaches to identify severe anxiety symptoms from the combination of psychometric data and smartphone sensors. The complementarity between these models, considering their relative strengths in sensitivity, precision, and generalization capacity, suggests that hybrid or adaptive approaches could enhance the identification of digital phenotypes of severe anxiety. Moreover, the use of robust variable selection techniques is fundamental to optimizing classifier performance given the high dimensionality and variability of the data, reinforcing the promising role of these models in the digital screening of anxiety symptoms and consolidating smartphones as reliable platforms for passive and continuous collection of behavioral and physiological data (Sameh et al. 2024, Ben-Zeev et al. 2015).
LIMITATIONS
Despite the promising results, this study has limitations that should be considered when interpreting the findings. One of the main limitations concerns the way the mobile device is held during data collection. The literature indicates that using both hands may accelerate response time compared to using only one hand, particularly when the non-dominant hand is used (Azenkot & Zhai 2012). Although these differences occur in milliseconds, the participants’ manual laterality (right-handed or left-handed) may introduce variations in reaction time, even on a small scale (Draheim et al. 2019).
Another relevant factor is the environment in which participants completed the DASS-21 scale. The physical stability of the environment can affect the quality of sensor data, particularly from the accelerometer and gyroscope. While data from fixed surfaces were considered, it was not possible to completely exclude responses recorded in unstable locations, such as public transport or while in motion (Grouios et al. 2022), which may have introduced noise into the digital phenotype recordings.
Furthermore, the imbalance between the groups with and without severe anxiety symptoms in the sample represents a limitation. Although stratified sampling was applied to ensure proportionality between the training and testing sets, such asymmetry may have influenced model performance, particularly in terms of sensitivity.
Among the lessons learned, the value of combining statistical methods for feature selection (SelectFpr, based on ANOVA) and multivariate reduction techniques (PCA) stands out. This approach allowed for the reduction of the initial set of 1,859 variables to 88 relevant predictors with minimal loss of information. Another important observation was that simpler models, such as GaussianNB, may outperform more complex algorithms like XGBoost and AdaBoost in contexts with high collinearity or noisy data — as corroborated by Goel & Kumar (2023) and Obermeyer & Emanuel (2016).
Additionally, the findings of this study support previous investigations that also employed the DASS-21 instrument to identify symptoms related to mental health. Priya et al. (2020) demonstrated the effectiveness of the GaussianNB classifier in this context, while Dogrucu et al. (2020) and Zulfiker et al. (2021) highlighted the potential of digital phenotypes for inferring psychological conditions using predictive algorithms. It is important to note that although the algorithms used in this research have been successfully applied in studies with extended data collection periods for digital phenotype analysis, this is the first successful application aimed at detecting the digital phenotype of anxiety in a single intensive and short-duration online session (approximately 20 minutes). This approach offers significant advantages, such as reduced invasiveness, lower computational resource demand from mobile devices, and the ability to immediately uninstall the app after participation. These factors help reduce friction with participants, thereby increasing the adherence rate within the target population.
For future research, it is recommended to expand the sample size, ensuring greater balance between the classes, as well as exploring multicategory classifications that consider different levels of anxiety. It is also advisable to integrate additional variables related to digital behavior and environmental contexts in order to enhance the robustness and applicability of the models in real-world digital mental health settings.
CONCLUSIONS
This study investigated the effectiveness of four machine learning models—Random Forest Classifier (RFC), Gaussian Naïve Bayes (GaussianNB), XGBoost, and AdaBoost—in classifying digital phenotypes derived from smartphone-based sensors, including accelerometer, gyroscope, and touchscreen reaction time data, collected during the administration of the DASS-21 scale. The aim was to identify severe cases of anxiety. Following the application of statistical techniques for feature selection (SelectFpr) and dimensionality reduction (Principal Component Analysis), 88 relevant predictors were selected for model training and evaluation.
The results demonstrated that the RFC and GaussianNB models outperformed the others. RFC achieved the highest accuracy (81.48%), strong precision (80%), and substantial discriminative capacity, as indicated by the area under the ROC curve (AUC = 0.79). The GaussianNB model stood out by achieving the highest sensitivity (61.54%), F1-score (60.38%), and the highest AUC (0.83), highlighting its effectiveness in identifying participants with severe anxiety symptoms.
These findings underscore the central role of psychophysiological data in the detection of digital phenotypes, illustrating how its integration with machine learning techniques can significantly enhance the reliability of self-report scales. In the context of digital mental health, RFC and GaussianNB emerge as promising approaches for automated initial screening. Furthermore, these models can be adapted for continuous monitoring systems, preventive strategies, and as auxiliary tools to clinical diagnosis in primary care settings and digital health platforms.
Acknowledgements
The authors acknowledge the Coordenação de Aperfeiçoamento de Pessoal de Nível Superior (CAPES), Brazil, for the provision of a scholarship (Process No. 88887.964930/2024-00; Program No. 13179; PDPG – Pós-Doutorado Estratégico). The authors also thank Luciana Urtiga for her contribution to the design of the figures in this article.
Data availability
References
- ALDAYEL M & AL-NAFJAN A. 2024. A comprehensive exploration of machine learning techniques for EEG-based anxiety detection. PeerJ Comput Sci 10: e1829.
- AZENKOT S & ZHAI S. 2012. Touch behavior with different postures on soft smartphone keyboards. In: Proceedings of the 14th international conference on Human-computer interaction with mobile devices and services, p. 251-260.
- BABAJIDE MUSTAPHA I & SAEED F. 2016. Bioactive Molecule Prediction Using Extreme Gradient Boosting. Molecules 21: 983.
- BEAM AL & KOHANE IS. 2018. Big Data and Machine Learning in Health Care. JAMA 319: 1317.
- BEN-ZEEV D, SCHERER EA, WANG R, XIE H & CAMPBELL AT. 2015. Next-generation psychiatric assessment: Using smartphone sensors to monitor behavior and mental health. Psychiatr Rehabil J 38: 218-226.
- BHADRA S & KUMAR CJ. 2022. An insight into diagnosis of depression using machine learning techniques: a systematic review. Curr Med Res Opin 38(5): 749-771.
- BHARDWAJ P, CHOUDHURY C & BATRA P. 2023. Automating Data Analysis with Python: A Comparative Study of Popular Libraries and their Application. In: 2023 3rd International Conference on Technological Advancements in Computational Sciences (ICTACS): 1243-1248.
- BHATNAGAR S, AGARWAL J & SHARMA OR. 2023. Detection and classification of anxiety in university students through the application of machine learning. Procedia Comput Sci 218: 1542-1550.
- BOURLA A, FERRERI F, OGORZELEC L, GUINCHARD C & MOUCHABAC S. 2018. Évaluation des troubles thymiques par l’étude des données passives: le concept de phénotype digital à l’épreuve de la culture de métier de psychiatre. L’Encéphale 44: 168-175.
- BUFANO P, LAURINO M, SAID S, TOGNETTI A & MENICUCCI D. 2023. Digital Phenotyping for Monitoring Mental Disorders: Systematic Review. J Med Internet Res 25: e46778.
- CARDINALE EM, SUBAR AR, BROTMAN MA, LEIBENLUFT E, KIRCANSKI K & PINE DS. 2019. Inhibitory control and emotion dysregulation: A framework for research on anxiety. Dev Psychopathol 31: 859-869.
- CHAPLOT N, PANDEY D, KUMAR Y & SISODIA PS. 2023. A Comprehensive Analysis of Artificial Intelligence Techniques for the Prediction and Prognosis of Genetic Disorders Using Various Gene Disorders. Arch Comput Methods Eng 30: 3301-3323.
- CHIKERSAL P, VENKATESH S, MASOWN K, WALKER E, QURAISHI D, DEY A, GOEL M & XIA Z. 2022. Predicting Multiple Sclerosis Outcomes During the COVID-19 Stay-at-home Period: Observational Study Using Passively Sensed Behaviors and Digital Phenotyping. JMIR Ment Health 9: e38495.
- CHOI H, CHO Y, MIN C, KIM K, KIM E, LEE S & KIM JJ. 2024. Multiclassification of the symptom severity of social anxiety disorder using digital phenotypes and feature representation learning. Digit Health 10: 20552076241256730.
- DLIMA SD, SHEVADE S, MENEZES SR & GANJU A. 2022. Digital Phenotyping in Health Using Machine Learning Approaches: Scoping Review. JMIR Bioinform Biotech 3: e39618.
- DOGRUCU A, PERUCIC A, ISARO A, BALL D, TOTO E, RUNDENSTEINER EA, AGU E, DAVIS-MARTIN R & BOUDREAUX E. 2020. Moodable: On feasibility of instantaneous depression assessment using machine learning on voice samples with retrospectively harvested smartphone and social media data. Smart Health 17: 100118.
- DOS SANTOS MP, HECKLER WF, BAVARESCO RS & BARBOSA JLV. 2024. Machine learning applied to digital phenotyping: A systematic literature review and taxonomy. Comput Hum Behav 161: 108422.
- DRAHEIM C, MASHBURN CA, MARTIN JD & ENGLE RW. 2019. Reaction time in differential and developmental research: A review and commentary on the problems and alternatives. Psychol Bull 145(5): 508.
- EDWARDS MS, EDWARDS EJ & LYVERS M. 2017. Cognitive trait anxiety, stress and effort interact to predict inhibitory control. Cogn Emot 31: 671-686.
- EL MORR C, JAMMAL M, BOU-HAMAD I, HIJAZI S, AYNA D, ROMANI M & HOTEIT R. 2024. Predictive Machine Learning Models for Assessing Lebanese University Students’ Depression, Anxiety, and Stress During COVID-19. J Prim Care Community Health 15: 21501319241235588.
- FERNÁNDEZ-DELGADO M, CERNADAS E, BARRO S & AMORIM D. 2014. Do we Need Hundreds of Classifiers to Solve Real World Classification Problems? J Mach Learn Res 15: 3133-3181.
- FERRARI AJ, SANTOMAURO DF, AALI A, ABATE YH, ABBAFATI C, ABBASTABAR H & BELL ML. 2024. Global incidence, prevalence, years lived with disability (YLDs), disability-adjusted life-years (DALYs), and healthy life expectancy (HALE) for 371 diseases and injuries in 204 countries and territories and 811 subnational locations, 1990-2021: a systematic analysis for the Global Burden of Disease Study 2021. The Lancet 403(10440): 2133-2161.
- GOEL H & KUMAR D. 2023. Data Mining in Healthcare using Machine Learning Techniques. In: 2023 International Conference on Sustainable Computing and Smart Systems (ICSCSS) IEEE: 25-29.
- GROUIOS G, ZIAGKAS E, LOUKOVITIS A, CHATZINIKOLAOU K & KOIDOU E. 2022. Accelerometers in our pocket: Does smartphone accelerometer technology provide accurate data? Sensors 23(1): 192.
- HARDIN MG, SCHROTH E, PINE DS & ERNST M. 2007. Incentive-related modulation of cognitive control in healthy, anxious, and depressed adolescents: development and psychopathology related differences. J Child Psychol Psychiatry 48: 446-454.
- HECKLER WF, DE CARVALHO JV, & BARBOSA JLV. 2022. Machine learning for suicidal ideation identification: A systematic literature review. Comput Hum Behav 128: 107095.
- HECKLER WF, FEIJÓ LP, DE CARVALHO JV & BARBOSA JLV. 2025. Digital phenotyping for mental health based on data analytics: A systematic literature review. Artif Intell Med 163: 103094.
- HILL C, DU L, JOHNSON M & MCCULLOUGH BD. 2024. Comparing programming languages for data analytics: Accuracy of estimation in Python and R. Wiley Interdiscip Rev Data Min Knowl Discov: e1531.
- IHMIG FR, NEUROHR-PARAKENINGS F, SCHÄFER SK, LASS-HENNEMANN J & MICHAEL T. 2020. On-line anxiety level detection from biosignals: Machine learning based on a randomized controlled trial with spider-fearful individuals. PLoS ONE 15(6): e0231517.
- INSEL TR. 2017. Digital Phenotyping: Technology for a New Science of Behavior. JAMA 318: 1215.
- JACOBSON NC & FENG B. 2022. Digital phenotyping of generalized anxiety disorder: using artificial intelligence to accurately predict symptom severity using wearable sensors in daily life. Transl Psychiatry 12: 336.
- JACOBSON NC, SUMMERS B & WILHELM S. 2020. Digital Biomarkers of Social Anxiety Severity: Digital Phenotyping Using Passive Smartphone Sensors. J Med Internet Res 22: e16875.
- JANG S, SUN TH, SHIN S, LEE HJ, SHIN YB, YEOM JW, PARK YR & CHO CH. 2024. A digital phenotyping dataset for impending panic symptoms: a prospective longitudinal study. Sci Data 11: 1264.
- KANJO E, YOUNIS EMG & ANG CS. 2019. Deep learning analysis of mobile physiological, environmental and location sensor data for emotion detection. Info Fusion 49: 46-56.
- KHALID H, KHAN A, ZAHID KHAN M, MEHMOOD G & SHUAIB QURESHI M. 2023. Machine Learning Hybrid Model for the Prediction of Chronic Kidney Disease, In: Ali F (Ed), Comput Intell Neurosci, p. 9266889.
- KLEPP A, NICCOLAI V, BUCCINO G, SCHNITZLER A & BIERMANN-RUBEN K. 2015. Language–motor interference reflected in MEG beta oscillations. NeuroImage 109: 438-448.
- LEE HY ET AL. 2023. Internet of medical things-based real-time digital health service for precision medicine: Empirical studies using MEDBIZ platform. Dig Health 9: 20552076221149659.
- LIU JJ ET AL. 2025. Digital phenotyping from wearables using AI characterizes psychiatric disorders and identifies genetic associations. Cell 188: 515-529.
- LOVIBOND PF & LOVIBOND SH. 1995. The structure of negative emotional states: Comparison of the Depression Anxiety Stress Scales (DASS) with the Beck depression and anxiety inventories. Behav Res Ther 33(3): 335-343.
- MENESES DA, TAVARES JJC, MONTEIRO REM & LOPEZ LCS. 2023. Fenótipos digitais para mindfulness e ansiedade encontrados por aplicativo de smartphone. Rev Saude Pesqui 16: e11196.
- NKEMDIRIM OKERE A, LI T, THERAN C, NYASANI E & ALI AA. 2025. Evaluation of factors predicting transition from prediabetes to diabetes among patients residing in underserved communities in the United States – A machine learning approach. Comput Biol Med 187: 109824.
- OBERMEYER Z & EMANUEL EJ. 2016. Predicting the Future – Big Data, Machine Learning, and Clinical Medicine. N Engl J Med 375: 1216-1219.
- ONNELA JP. 2021. Opportunities and challenges in the collection and analysis of digital phenotyping data. Neuropsychopharmacol 46: 45-54.
- PARK JH, SHIN YB, JUNG D, HUR JW, PACK SP, LEE HJ & CHO CH. 2025. Machine learning prediction of anxiety symptoms in social anxiety disorder: utilizing multimodal data from virtual reality sessions. Front Psychiatry 15: 1504190.
- PRIYA A, GARG S & TIGGA NP. 2020. Predicting Anxiety, Depression and Stress in Modern Life using Machine Learning Algorithms. Procedia Comput Sci 167: 1258-1267.
- QUIROZ JC, YONG MH & GEANGU E. 2017. Emotion-recognition using smart watch accelerometer data: preliminary findings. In: Proceedings of the 2017 ACM International Joint Conference on Pervasive and Ubiquitous Computing and Proceedings of the 2017 ACM International Symposium on Wearable Computers, Maui Hawaii: ACM, p. 805-812.
- SAI MJ, CHETTRI P, PANIGRAHI R, GARG A, BHOI AK & BARSOCCHI P. 2023. An Ensemble of Light Gradient Boosting Machine and Adaptive Boosting for Prediction of Type-2 Diabetes. Int J Comput Intell Syst 16: 14.
- SAMEH A, ROSTAMI M, OUSSALAH M, KORPELAINEN R & FARRAHI V. 2024. Digital phenotypes and digital biomarkers for health and diseases: a systematic review of machine learning approaches utilizing passive non-invasive signals collected via wearable devices and smartphones. Artif Intell Rev 58: 66.
- SAU A & BHAKTA I. 2019. Screening of anxiety and depression among the seafarers using machine learning technology. Inform Med Unlocked 16: 100149.
- SHABAN-NEJAD A, MICHALOWSKI M & BUCKERIDGE DL. 2018. Health intelligence: how artificial intelligence transforms population and personalized health. npj Digital Med 1: 53, s41746-018-0058-9.
- SHAHIDIAN N, ABREU P, SANTOS D & BARBOSA-POVOA A. 2025. Short-term forecasting of emergency medical services demand exploring machine learning. Comput Ind Eng 200: 110765.
- SHIVAIAH S, KRISHNAPPA K, BORAIAH N, SHENOY P & RAJUK V. 2024. Prediction of mental illness using ensemble model and grid search hyperparameter optimization. Bull Electr Eng Inform 13(5): 3726-3736.
- TABARES MT, ÁLVAREZ CV, SALCEDO JB & RENDÓN SM. 2024. Anxiety in young people: Analysis from a machine learning model. Acta Psychol 248: 104410.
- TOROUS J, BUCCI S, BELL IH, KESSING LV, FAURHOLT-JEPSEN M, WHELAN P, CARVALHO AF, KESHAVAN M, AKE LINARDON & FIRTH J. 2021. The growing field of digital psychiatry: current evidence and the future of apps, social media, chatbots, and virtual reality. World Psychiatry 20(3): 318-335.
- VÄHÄSARJA LEJ, LIPSANEN JO, KOUVONEN AM, LAHELMA ET, LAPPALAINEN R, VIRTANEN M & LALLUKKA TM. 2025. Depression Anxiety Stress Scales (DASS-21) for Finnish-speaking adults: Validation and normative data. Psychol Assess 37: e15-e27.
- VALERO-CARRERAS D, ALCARAZ J & LANDETE M. 2023. Comparing two SVM models through different metrics based on the confusion matrix. Comput Oper Res 152: 106131.
- VIGNOLA RCB & TUCCI AM. 2014. Adaptation and validation of the depression, anxiety and stress scale (DASS) to Brazilian Portuguese. J Affect Disord 155: 104-109.
- WANG W & SUN D. 2021. The improved AdaBoost algorithms for imbalanced data classification. Inf Sci 563: 358-374.
- WHO. 2022. Mental Health and COVID-19: Early evidence of the pandemic’s impact. Scientific Brief. Geneva: WHO, 11 p.
- XIE Y, ZHU C, ZHOU W, LI Z, LIU X & TU M. 2018. Evaluation of machine learning methods for formation lithology identification: A comparison of tuning processes and model performances. J Pet Sci Eng 160: 182-193.
- ZANON C ET AL. 2021. Examining the Dimensionality, Reliability, and Invariance of the Depression, Anxiety, and Stress Scale–21 (DASS-21) Across Eight Countries. Assessment 28: 1531-1544.
- ZHANG Y, STEWART C, RANJAN Y, CONDE P, SANKESARA H, RASHID Z & FOLARIN AA. 2025. Large-scale digital phenotyping: identifying depression and anxiety indicators in a general UK population with over 10,000 participants. J Affect Disord 375: 412-422.
- ZOHAR O & SHAMIR M. 2016. A Readout Mechanism for Latency Codes. Front Comput Neurosci 10: 107.
- ZULFIKER S, KABIR N, BISWAS AA, NAZNEEN T & UDDIN MS. 2021. An in-depth analysis of machine learning approaches to predict depression. Curr Res Behav Sci 2: 1-12.
- ZULUETA J ET AL. 2018. Predicting Mood Disturbance Severity with Mobile Phone Keystroke Metadata: A BiAffect Digital Phenotyping Study. J Med Internet Res 20: e241.








