Predicting crime during or after psychiatric care: Evaluating machine learning for risk assessment using the Danish patient registries

Research output: Contribution to journalJournal articleResearchpeer-review


  • Fulltext

    Final published version, 406 KB, PDF document

Background: Structural changes in psychiatric systems have altered treatment opportunities for patients in need of mental healthcare. These changes are possibly associated with an increase in post-discharge crime, reported in the increase of forensic psychiatric populations. As current risk-assessment tools are time-consuming to administer and offer limited accuracy, this study aims to develop a predictive model designed to identify psychiatric patients at risk of committing crime leading to a future forensic psychiatric treatment course. Method: We utilized the longitudinal quality of the Danish patient registries, identifying the 45.720 adult patients who had contact with the psychiatric system in 2014, of which 474 committed crime leading to a forensic psychiatric treatment course after discharge. Four machine learning models (Logistic Regression, Random Forest, XGBoost and LightGBM) were applied over a range of sociodemographic, judicial, and psychiatric variables. Results: This study achieves a F1-macro score of 76%, with precision = 57% and recall = 47% reported by the LightGBM algorithm. Our model was therefore able to identify 47% of future forensic psychiatric patients, while making correct predictions in 57% of cases. Conclusion: The study demonstrates how a clinically useful initial risk-assessment can be achieved using machine learning on data from patient registries. The proposed approach offers the opportunity to flag potential future forensic psychiatric patients, while in contact with the general psychiatric system, hereby allowing early-intervention initiatives to be activated.

Original languageEnglish
JournalJournal of Psychiatric Research
Pages (from-to)194-200
Publication statusPublished - 2022

Bibliographical note

Publisher Copyright:
© 2022 The Author(s)

    Research areas

  • Computational psychiatry, Forensic psychiatry, Machine learning, Precision psychiatry, Statistical risk assessment

Number of downloads are based on statistics from Google Scholar and

No data available

ID: 314296011