Related Experiment Video
Updated: Aug 5, 2026

Implementation of a Real-Time Psychosis Risk Detection and Alerting System Based on Electronic Health Records using CogStack
Published on: May 15, 2020
Machine Learning Model for Predicting Suicide Risks Among Patients With Posttraumatic Stress Disorder Who Received
Shu Huang1, Amie J Goodin1,2, Jill A Star3
1Department of Pharmaceutical Outcomes and Policy, College of Pharmacy, University of Florida, Gainesville 32611, Florida, USA, ufl.edu.
Background:
The cooccurrence of posttraumatic stress disorder (PTSD) and opioid use heightens suicide risk. We aimed to develop and validate a machine learning-based suicide prediction model (SPM) to identify PTSD patients prescribed opioids who are at risk of suicide within 6-month prediction intervals.
Methods:
Using 2016-21 OneFlorida+ data, we compared the predictive performance of multiple models, including least absolute shrinkage and selection operator (LASSO) regression, gradient boosting machines (GBMs), random forest (RF), and deep neural networks (DNNs). The best-performing SPM was selected to predict 6-month suicide risks among adult PTSD patients who received opioids. The index date was the first day when both an opioid prescription and a PTSD diagnosis occurred within 180 days. We divided the 2016-18 cohort into training and internal validation datasets (2:1 ratio), applying machine learning models to the training dataset to predict suicide-related outcomes. We evaluated model prediction performance using various metrics on internal (2016-18) and external (2019-21) validation cohorts.
Results:
Among 5578 patients (age = 38.1 ± 11.1, female = 83.2%) in the 2016-18 cohort, 709 (12.7%) patients had at least one suicide-related outcome during follow-up. The final RF model selected 271/299 covariates, with C-statistics, accuracy, sensitivity, specificity, and precision being 83.6% (81.7%-85.9%), 86.2% (85.2%-87.1%), 65.0% (59.8%-70.1%), 87.6% (86.7%-88.5%), and 26.6% (24.6%-28.8%), respectively. We classified intervals into 10 suicide-risk subgroups based on the predicted probabilities, with 79.2% of suicide intervals captured in the top 3 decile subgroups. We observed similar findings in the 2019-21 cohort (n = 4849), with C-statistics, accuracy, sensitivity, specificity, and precision being 83.6% (82.2%-84.9%), 87.0% (86.5%-87.6%), 65.3% (61.7%-68.7%), 88.2% (87.6%-88.7%), and 22.3% (21.1%-23.5%), respectively.
Conclusions:
Our SPM performed well in internal and external validations. It may serve as a feasible tool to identify patients at risk of suicide, helping prioritize preventive interventions, and enabling providers to allocate time and resources more efficiently to patients who may benefit from closer follow-up.