A Machine-Learning Approach to Modeling Cognitive Flexibility, Stress Reactivity, and Executive Function in Clinical Populations
Keywords:
Cognitive Flexibility, Executive Function, Stress Reactivity, Major Depressive Disorder, Post-Traumatic Stress Disorder, Generalized Anxiety DisorderAbstract
Objective: The objective of this study was to develop a machine-learning model integrating behavioral measures of executive function, cognitive flexibility, and psychophysiological stress reactivity to predict and classify clinical symptomatology in individuals with Major Depressive Disorder, Generalized Anxiety Disorder, and Post-Traumatic Stress Disorder.
Methods and Materials: A cross-sectional design was utilized with a sample of participants, comprising Healthy Controls ( ) and individuals diagnosed with Major Depressive Disorder ( ), Generalized Anxiety Disorder ( ), and Post-Traumatic Stress Disorder ( ). Participants completed a comprehensive three-hour assessment protocol including neurocognitive tasks (Wisconsin Card Sorting Test, Stroop Color-Word Test, Trail Making Test), a modified social-evaluative stress task with concurrent psychophysiological recordings (electrocardiography for heart rate variability [HRV], salivary cortisol), and clinical self-report questionnaires. Machine learning models (Random Forest, Support Vector Machine, and XGBoost) were trained on of the data to classify clinical versus control groups, utilizing hyperparameter tuning and SHAP (SHapley Additive exPlanations) values for feature interpretation.
Findings: The XGBoost algorithm achieved the highest predictive performance in classifying clinical versus control groups, yielding an AUC-ROC of . Traditional linear analyses indicated that clinical cohorts exhibited significantly greater symptom severity and poorer cognitive performance, including elevated perseverative errors on the WCST and compromised Trail Making Test performance. Physiologically, cortisol reactivity ( ) was blunted in the PTSD group and exaggerated in the MDD group, while baseline HRV was significantly lower across all clinical cohorts. SHAP feature importance analysis revealed that the TMT Part B-A difference score was the most crucial predictor of clinical classification, followed closely by cortisol reactivity ( ), baseline anxiety, and baseline HRV.
Conclusion: Advanced machine-learning algorithms effectively capture the complex, non-linear interactions between cognitive flexibility and autonomic stress dysregulation, underscoring the necessity of integrated, multidimensional approaches for accurate psychiatric classification.
Downloads
References
Arshadi, S., Nokani, M., Asgari, M., & Sepahvand, T. (2022). Comparison of the effectiveness of inhibitory control cognitive rehabilitation, transcranial electrical stimulation, and combined inhibitory control rehabilitation and transcranial electrical stimulation on executive functions (behavioral inhibition and cognitive flexibility) in children with attention deficit/hyperactivity disorder. Journal of School Psychology, 11(3), 6-27. https://jsp.uma.ac.ir/%20http:/journal.uma.ac.ir/%20http:/jsp.uma.ac.ir/article_1786.html
Babaei, F., Abdollahi, M., Amini Gilvani, M., & Masoomifard, M. (2024). The Mediating Role of Theory of Mind in the Relationship Between Executive Functions and Marital Burnout Using Structural Equation Modeling and Artificial Neural Networks (SEM-ANN). International Journal of Education and Cognitive Sciences, 5(4), 62-73. https://doi.org/10.61838/kman.ijecs.5.4.7
Bacıoğlu, S. D., & Kocabıyık, O. O. (2025). Perceived Stress and Psychological Resilience: The Serial Mediation of Cognitive Control and Cognitive Flexibility. Roczniki Psychologiczne, 27(3), 235-253. https://doi.org/10.18290/rpsych2024.0013
Baniasadi, K., Gerdooie, R., Gorji, M., Shahbazi, G., Babaahmadi, F., Ghafourian, G., & Pourmohammad Ghouchani, K. (2025). Comparison of Cognitive Behavioral Therapy and Acceptance and Commitment Therapy on Enhancing Resilience, Cognitive Flexibility, and Distress Tolerance in Adolescents with Obsessive-Compulsive Disorder. Journal of Adolescent and Youth Psychological Studies (JAYPS), 6(6), 1-10. https://doi.org/10.61838/kman.jayps.6.6.6
Baniasadi, T. (2024). Comparison of Executive Function and Working Memory among Children with High and Low Levels of Physical Activity. International Journal of Education and Cognitive Sciences, 5(3), 9-15. https://doi.org/10.61838/kman.ijeas.5.3.2
Bardeen, J. R., Gorday, J. Y., & Weathers, F. W. (2022). Executive functioning deficits exacerbate posttraumatic stress symptoms: A longitudinal mediation model. Journal of anxiety disorders, 87, 102556. https://doi.org/10.1016/j.janxdis.2022.102556
Corbo, I., Troisi, G., Marselli, G., & Casagrande, M. (2024). The Role of Cognitive Flexibility on Higher Level Executive Functions in Mild Cognitive Impairment and Healthy Older Adults. BMC psychology, 12(1). https://doi.org/10.1186/s40359-024-01807-5
Erostarbe-Pérez, M., Reparaz-Abaitua, C., Martínez-Pérez, L., & Magallón-Recalde, S. (2022). Executive functions and their relationship with intellectual capacity and age in schoolchildren with intellectual disability. Journal of Intellectual Disability Research, 66(1-2), 50-67. https://doi.org/10.1111/jir.12885
Esmaeilnejad, M., & Mazraeh, A. (2025). The mediating role of rumination in emotional distress tolerance and cognitive flexibility with existential anxiety in adolescent athletes. Child Emotional Development Psychology, 1(3), e220485. https://www.journalcedp.com/article_220485.html
Filipe, M., Veloso, A., & Frota, S. (2023). Executive Functions and Language Skills in Preschool Children: The Unique Contribution of Verbal Working Memory and Cognitive Flexibility. Brain Sciences, 13(3), 470. https://doi.org/10.3390/brainsci13030470
Ghasemi, H., Ebrahimi Ghavam, S., Dortaj, F., & Farrokhi, N. (2022). The Effect of Executive Function-Based Parenting Training on Cognitive Flexibility and Inhibitory Control of Children. Research in Educational Systems, 16(58), 5-19.
Granmayeh, S., Arjmandnia, A. A., Akbari, M., Kakabraee, K., & Moradi, A. (2023). The effectiveness of an executive function-based parenting training package on parenting stress in parents of children with autism spectrum disorder. Razi Journal of Medical Sciences, 29(11), 112-123. https://rjms.iums.ac.ir/article-1-7781-en.html
Harel, O., Hemi, A., & Levy‐Gigi, E. (2023). The Role of Cognitive Flexibility in Moderating the Effect of School-Related Stress Exposure. Scientific reports, 13(1). https://doi.org/10.1038/s41598-023-31743-0
Hasheminejad, F. H., Salehi, M., & Sharifi, N. (2024). Modeling the General Health of Iranian Immigrants Based on Cognitive Flexibility and Perfectionism With the Mediation of Acculturation Stress. Jayps, 5(1), 78-86. https://doi.org/10.61838/kman.jayps.5.1.10
Iceta, S., Rodrigue, C., Legendre, M., Daoust, J., Flaudias, V., Michaud, A., & Bégin, C. (2021). Cognitive function in binge eating disorder and food addiction: A systematic review and three-level meta-analysis. Progress in Neuro-Psychopharmacology and Biological Psychiatry, 111, 110400. https://doi.org/10.1016/j.pnpbp.2021.110400
Khorasani, A. H. (2024). Investigating the effectiveness of positive psychotherapy on cognitive flexibility and distress tolerance in divorced women. J Fam Relat Stud, 4(13), 32-39. https://doi.org/10.32598/jfrs.4.13.32
Miller, S., & Taylor, M. (2024). Cognitive flexibility and executive functions in adolescence. Adolescent Cognitive Development, 16(1), 105-119. https://doi.org/10.8765/acd.2024.16105
Parvaresh, M., Taghinezhad, N., Amirfakhraei, A., & Sabahizadeh, M. (2024). Providing an Optimal Model for Enhancing Cognitive Flexibility Based on Mindfulness in Nurses. Journal of Psychological Dynamics in Mood Disorders (PDMD), 3(1), 112-123. https://doi.org/10.22034/pdmd.2024.434590.1033
Paula, J., & Antônio José, S. (2023). Complex post-traumatic stress disorder (CPTSD), executive function and attachment. Revista Latinoamericana de Psicopatologia Fundamental, 26. https://doi.org/10.1590/1415-4714.e220529
Polizzi, C., Burgio, S., Lavanco, G., & Alesi, M. (2021). Parental Distress and Perception of Children’s Executive Functioning After the First COVID-19 Lockdown in Italy. Journal of clinical medicine, 10(18), 4170. https://doi.org/10.3390/jcm10184170
Qian, G., Li, B., Xu, L., Ai, S., Li, X., Lei, X., & Dou, G. (2024). Parenting Style and Young Children's Executive Function Mediate the Relationship Between Parenting Stress and Parenting Quality in Two-Child Families. Scientific reports, 14(1). https://doi.org/10.1038/s41598-024-59225-x
Schäfer, J., Reuter, T., Leuchter, M., & Karbach, J. (2024). Executive functions and problem-solving: The contribution of inhibition, working memory, and cognitive flexibility to science problem-solving performance in elementary school students. Journal of Experimental Child Psychology, 244, 105962. https://doi.org/10.1016/j.jecp.2024.105962
Shari, S., Sedaghat, M., Shoja Kazemi, M., & Moradi, H. (2021). Evaluation of neurofeedback training on executive functioning, cognitive flexibility, and attention in students with learning disorders. Scientific Journal of Ilam University of Medical Sciences, 3(3), 62-74. https://doi.org/10.52547/sjimu.30.3.62
Yaqubi, M., Ebrahimi, F., Pourmohammad Ghouchani, K., & Norouziani, Z. (2026). Comparison of cognitive behavioral therapy and acceptance and commitment therapy on referential thoughts, cognitive flexibility, and distress tolerance in patients with major depressive disorder. Psychological Dynamics in Emotional Disorders, 1-18. https://doi.org/https://maherpub.com/pdmd/article/view/628
Yavaribarha, E., Asghari, P., Nadari, F., & Heidari, A. R. (2022). The effect of cognitive empowerment on executive functions (decision-making and flexibility, emotion control) in children with ADHD. Journal of Faculty of Medicine, Mashhad University of Medical Sciences, 65(3), 1199-1213. https://doi.org/10.22038/mjms.2022.64291.3779

