Random Forest Classification of Suicide Risk Using Hopelessness, Defeat, Entrapment, and Psychological Pain

Authors

    Nabil Mouhajir * ISPITS–Higher Institute of Nursing and Health Techniques, Ministry of Health and Social Protection, Rabat 10020, Morocco nabil_mouhajir98@gmail.com
    Mohammed Abubaker Hospital of Mental Health and Psychiatric Diseases, Mohamed VI University Hospital of Oujda, Morocco
    Thiago Saab Faculty of Letters and Human Sciences, Mohamed V University, Rabat, Morocco

Keywords:

Suicide risk, Random Forest, hopelessness, defeat, entrapment, psychological pain, machine learning, Morocco

Abstract

Objective: This study aimed to develop and evaluate a Random Forest classification model for predicting suicide risk among Moroccan adults using hopelessness, defeat, entrapment, and psychological pain as psychological predictors.

Methods and Materials: This cross-sectional predictive study was conducted among 1,284 adults from Morocco. Participants completed standardized self-report measures assessing suicide risk, hopelessness, defeat, entrapment, and psychological pain. Suicide risk was classified as a binary outcome variable, distinguishing low-risk and high-risk participants according to standardized suicide risk scores. Data were screened for missing values, distributional properties, and outliers before analysis. The dataset was divided into training and testing subsets using an 80:20 stratified split to preserve the proportion of suicide risk categories. A Random Forest classifier was trained on the training dataset, and hyperparameter tuning was performed using grid search with five-fold stratified cross-validation. Model performance was evaluated on the independent test dataset using accuracy, sensitivity, specificity, precision, F1-score, balanced accuracy, ROC-AUC, Cohen’s Kappa, Matthews Correlation Coefficient, and confusion matrix indices. Feature importance was examined using Gini importance, permutation importance, and SHAP-based interpretability analysis.

Findings: Hopelessness, defeat, entrapment, and psychological pain were all positively associated with suicide risk, with psychological pain showing the strongest relationship. The optimized Random Forest model demonstrated excellent classification performance, with accuracy of 92.61%, sensitivity of 88.96%, specificity of 93.87%, precision of 90.74%, F1-score of 89.84%, balanced accuracy of 91.42%, and ROC-AUC of 0.964. Cohen’s Kappa was 0.819 and the Matthews Correlation Coefficient was 0.824, indicating strong agreement beyond chance. Feature-importance results showed that psychological pain was the strongest predictor, followed by entrapment, hopelessness, and defeat. SHAP analysis confirmed that higher levels of all four predictors increased the probability of classification into the high-suicide-risk group.

Conclusion: The findings indicate that Random Forest classification can accurately distinguish suicide risk levels using theoretically grounded psychological variables. Psychological pain and entrapment were the most influential predictors, suggesting that unbearable emotional suffering and perceived inability to escape distress are central markers of elevated suicide risk. The model may provide a useful decision-support approach for suicide risk screening, although it should complement rather than replace professional clinical judgment.

Downloads

Download data is not yet available.

References

Aadahl, V., Wells, A., Hallard, R., & Pratt, D. (2021). Metacognitive Beliefs and Suicidal Ideation: An Experience Sampling Study. International journal of environmental research and public health, 18(23), 12336. https://doi.org/10.3390/ijerph182312336

Arco, A. H., Izquierdo-Sotorrío, E., Ramírez-Uclés, I., Carrasco, M. Á., & Tello, F. P. H. (2025). Analysis of the Internal Structure and Psychometric Properties of the Entrapment Scale in Spanish Adolescents and Emerging Adults. European Journal of Investigation in Health Psychology and Education, 15(6), 111. https://doi.org/10.3390/ejihpe15060111

Ballegooijen, W. v., Littlewood, D. L., Nielsen, E., Kapur, N., & Gooding, P. (2022). The Temporal Relationships Between Defeat, Entrapment and Suicidal Ideation: Ecological Momentary Assessment Study. BJPsych Open, 8(4). https://doi.org/10.1192/bjo.2022.68

Beurs, D. d., Giltay, E. J., Nuij, C., Connor, R. O., Remco, F. P. d. W., Kerkhof, A. J. F. M., Ballegooijen, W. v., & Riper, H. (2024). Symptoms of a Feather Flock Together; Dynamic Time Warp Analysis of 11 Single Case Time Series of Suicide Ideation and Related Symptoms. https://doi.org/10.31219/osf.io/6s3m4

Clement, D. N., Awad, S. A., Oliphant, V. N., & Wingate, L. R. (2023). Race-Based Rejection Sensitivity and the Integrated Motivational Volitional Model of Suicide in a Sample of Black Women. Clinical Psychological Science, 12(2), 305-319. https://doi.org/10.1177/21677026221147265

Dewa, L. H., Pappa, S., Greene, T., Cooke, J., Mitchell, L., Hadley, M., Simplicio, M. D., Woodcock, T., & Aylin, P. (2022). The Association Between Sleep Disturbance and Suicidality in Psychiatric Inpatients Transitioning to the Community: Protocol for an Ecological Momentary Assessment Study. Jmir Research Protocols, 11(5), e33817. https://doi.org/10.2196/33817

Dies, M. A., Sánchez-Reolid, D., Monferrer, M., Montes, M. J., Fernández‐Caballero, A., Fernández-Sotos, P., & Ricarte, J. J. (2024). Interplay of Repetitive Negative Thinking, Defeat, and Entrapment in Patients With Suicidal Ideation Versus Suicidal Behavior Through the Integrated Motivational-Volitional Model. https://doi.org/10.21203/rs.3.rs-4837022/v1

Everaert, J., Bronstein, M. V., Cannon, T. D., Klonsky, E. D., & Joormann, J. (2021). Inflexible Interpretations of Ambiguous Social Situations: A Novel Predictor of Suicidal Ideation and the Beliefs That Inspire It. Clinical Psychological Science, 9(5), 879-899. https://doi.org/10.1177/2167702621993867

Galynker, I., Cohen, L. J., Prekas, A. S., Bloch‐Elkouby, S., King, M. D., & Lévy, Y. (2025). Suicide Crisis Syndrome: Examining Supporting Evidence and Barriers to Diagnostic Validity. Frontiers in Psychiatry, 16. https://doi.org/10.3389/fpsyt.2025.1627463

Harris, K., Haddock, G., Peters, S., & Gooding, P. (2021). Psychometric Properties of the Suicidal Ideation Attributes Scale (SIDAS) in a Longitudinal Sample of People Experiencing Non-Affective Psychosis. BMC psychiatry, 21(1). https://doi.org/10.1186/s12888-021-03639-8

Höller, I., & Forkmann, T. (2021). Ambivalent Heroism? – Psychological Burden and Suicidal Ideation Among Nurses During the Covid‐19 Pandemic. Nursing Open, 9(1), 785-800. https://doi.org/10.1002/nop2.1130

Höller, I., Kremers, A., Schreiber, D., & Forkmann, T. (2022). Trapped in My Inner Prison—Cross-Sectional Examination of Internal and External Entrapment, Hopelessness and Suicidal Ideation. PLoS One, 17(7), e0270985. https://doi.org/10.1371/journal.pone.0270985

Hollingsworth, D. W., & Polanco‐Roman, L. (2022). Ethnic Identity Protects Against Feelings of Defeat and Entrapment on Suicide Ideation in African American Young Adults. Cultural diversity & ethnic minority psychology, 28(2), 217-226. https://doi.org/10.1037/cdp0000523

Huddy, V., Forrester, A. C., & Cabourne, J. (2025). Perceived Entrapment, Goal Adjustment and Goal Ambivalence as Predictors for Suicide Ideation in High-Risk Prisoners. International Journal of Forensic Mental Health, 24(1), 43-53. https://doi.org/10.1177/14999013241306139

Jaegere, E. D., Stas, P., Heeringen, K. v., Dumon, E., Landschoot, R. v., & Portzky, G. (2023). Future‐Oriented Group Training for Suicidal Individuals: A Randomized Controlled Trial. Suicide and Life-Threatening Behavior, 53(2), 270-281. https://doi.org/10.1111/sltb.12944

Kiani, A., Rashid, S., Dadfar, M., & Lester, D. (2021). Understanding Suicidal Behavior Using a Comprehensive Approach. Illness Crisis & Loss, 31(2), 228-243. https://doi.org/10.1177/10541373211051058

Kirshenbaum, J. S., Pagliaccio, D., Bitran, A., Xu, E., & Auerbach, R. P. (2024). Why Do Adolescents Attempt Suicide? Insights From Leading Ideation-to-Action Suicide Theories: A Systematic Review. Translational psychiatry, 14(1). https://doi.org/10.1038/s41398-024-02914-y

Köse, G., Evans, J. J., & O’Connor, R. C. (2025). The Relationship Between Positive Future Thinking, Entrapment, Defeat and Death-Related Mental Imagery in Individuals With and Without a Suicidal History: An Experimental Study. Frontiers in psychology, 16. https://doi.org/10.3389/fpsyg.2025.1574315

Kulemarzi, M. J. B., Moosivand, M., & Zaremohzzabieh, Z. (2024). Evaluation of the Validity and Reliability of the Entrapment Scale in Iranian Adolescents and Its Relationship With Suicidal Ideation. Illness Crisis & Loss, 33(2), 342-361. https://doi.org/10.1177/10541373231224518

Lee, H., & Park, B.-M. (2021). Feelings of Entrapment During the COVID-19 Pandemic Based on ACE Star Model: A Concept Analysis. Healthcare, 9(10), 1305. https://doi.org/10.3390/healthcare9101305

Lekkas, D., Oh, J. Y., Matsumura, R., Perrier, A. D., & Jacobson, N. C. (2023). Profiling the Digital Mosaic of Uncensored Suicidal Thought and Behavior: a Theory-Driven Network Analysis of Online Written Expression. https://doi.org/10.31234/osf.io/79mwn

Levi‐Belz, Y., Peleg, D., & Ifrah, K. (2022). An Integrative Psychological Model of Risk Factors for Suicidal Ideation and Behavior Among Israeli LGBT Individuals. OMEGA - Journal of Death and Dying, 90(2), 475-502. https://doi.org/10.1177/00302228221087504

McClure, K. (2025). From Repetition to Relevance: Initial Development of a Multidimensional Computerized Adaptive Test for Intensive Longitudinal Assessment of Suicide Risk (Preprint). Jmir Formative Research. https://doi.org/10.2196/76544

Moscardini, E. H., Oakey‐Frost, N., Robinson, A., Powers, J., Aboussouan, A., Rasmussen, S., Cramer, R. J., & Tucker, R. P. (2021). Entrapment and Suicidal Ideation: The Protective Roles of Presence of Life Meaning and Reasons for Living. Suicide and Life-Threatening Behavior, 52(1), 14-23. https://doi.org/10.1111/sltb.12767

O’Neill, C., Pratt, D., Kilshaw, M. A., Ward, K. A., Kelly, J., & Haddock, G. (2021). The Relationship Between Self‐criticism and Suicide Probability. Clinical Psychology & Psychotherapy, 28(6), 1445-1456. https://doi.org/10.1002/cpp.2593

Oakey‐Frost, N., Moscardini, E. H., Russell, K., Rasmussen, S., Cramer, R. J., & Tucker, R. P. (2022). Defeat, Entrapment, and Hopelessness: Clarifying Interrelationships Between Suicidogenic Constructs. International journal of environmental research and public health, 19(17), 10518. https://doi.org/10.3390/ijerph191710518

Ordóñez-Carrasco, J. L., Cuadrado, I., & Tejada, A. J. R. (2021). Experiential Avoidance in the Context of the Integrated Motivational–Volitional Model of Suicidal Behavior. Crisis, 42(4), 284-291. https://doi.org/10.1027/0227-5910/a000721

Owen, R., Jones, S., Dempsey, R. C., & Gooding, P. (2022). Directly or Indirectly? The Role of Social Support in the Psychological Pathways Underlying Suicidal Ideation in People With Bipolar Disorder. International journal of environmental research and public health, 19(9), 5286. https://doi.org/10.3390/ijerph19095286

Park, J. Y., Rogers, M. L., Bloch‐Elkouby, S., Richards, J., Lee, S., Galynker, I., & You, S. (2023). Factor Structure and Validation of the Revised Suicide Crisis Inventory in a Korean Population. Psychiatry Investigation, 20(2), 162-173. https://doi.org/10.30773/pi.2022.0208

Rath, D., Teismann, T., Schmitz, F., Glaesmer, H., Hallensleben, N., Paashaus, L., Spangenberg, L., Schönfelder, A., Juckel, G., & Forkmann, T. (2021). Predicting Suicidal Behavior by Implicit Associations With Death? Examination of the Death IAT in Two Inpatient Samples of Differing Suicide Risk. Psychological assessment, 33(4), 287-299. https://doi.org/10.1037/pas0000980

Rosario‐Williams, B., Rombola, C., & Miranda, R. (2021). Being Certain That Negative Events Will Happen or That Positive Events Will Not Happen: Depressive Predictive Certainty and Change in Suicide Ideation Over Time. Suicide and Life-Threatening Behavior, 51(6), 1106-1116. https://doi.org/10.1111/sltb.12793

Sardarzehi, R., Zadehparizi, R., Kianimoghadam, A. S., Renani, M. K., Ekhtiyari, L., & Yaztappeh, J. S. (2023). Integrated Motivational-Volitional Model: A Structural Equation Modeling With Interaction of Latent Variables. International Journal High Risk Behaviors & Addiction, 12(1). https://doi.org/10.5812/ijhrba-132830

Schomberg, J., Teismann, T., Gerlach, A. L., & Cwik, J. C. (2025). Testing the Predictions of the Interpersonal-Psychological Theory of Suicide in a Sample of Female Cancer Patients. https://doi.org/10.21203/rs.3.rs-6688154/v1

Wetherall, K., Cleare, S., Eschle, S., Ferguson, E., O’Connor, D. B., O’Carroll, R. E., & O’Connor, R. C. (2021). Predicting Suicidal Ideation in a Nationally Representative Sample of Young Adults: A 12-Month Prospective Study. Psychological medicine, 52(14), 3168-3175. https://doi.org/10.1017/s0033291720005255

Downloads

Additional Files

Published

2026-07-01

Submitted

2026-03-19

Revised

2026-05-30

Accepted

2026-06-13

Issue

Section

Articles

How to Cite

Mouhajir , N. ., Abubaker, M. ., & Saab, T. . (2026). Random Forest Classification of Suicide Risk Using Hopelessness, Defeat, Entrapment, and Psychological Pain. Journal of Assessment and Research in Applied Counseling (JARAC), 1-14. https://journals.kmanpub.com/index.php/jarac/article/view/5461