Opioid death projections with AI-based forecasts using social media language

Matthew Matero, Salvatore Giorgi, Brenda Curtis, Lyle H. Ungar, H. Andrew SchwartzNpj Digit. Medicine 2023 · DOI

The U.S. opioid epidemic is a rapidly evolving crisis. What drives overdose deaths in a rural Appalachian county one year might differ entirely from the drivers in an urban center the next, particularly as the crisis shifts from prescription pills to synthetic fentanyl. Public health officials currently face a significant data lag, where official mortality estimates are released over a year after the fact, and a context gap, where traditional socioeconomic metrics fail to capture the real-time "pulse" of a community.

To address these hurdles, researchers developed TrOP (Transformer for Opioid Prediction), an AI model that forecasts county-level opioid mortality rates by analyzing the language used on Twitter. By treating social media as a real-time sensor, TrOP provides an "early warning" system for emerging hotspots.

Methodology: Transformers for Time-Series Forecasting

While Transformer architectures are famous for powering Large Language Models (LLMs), TrOP utilizes them for time-series forecasting. The model uses a multi-headed attention mechanism to analyze three years of historical data, allowing it to weigh different time steps based on their predictive power for future mortality.

To process millions of tweets into usable data, the team used Non-negative Matrix Factorization (NMF) to reduce 2,000-dimension topic vectors into 20 "community language features" per year. This allows the model to identify linguistic shifts—such as a sudden increase in language related to systemic struggle—that may precede a spike in substance abuse.

Data Integration

The study integrated three primary data sources:

  • County Tweet Lexical Bank (CTLB): A collection of tweets from 357 counties covering roughly 65% of the U.S. population.
  • CDC WONDER: The "ground truth" dataset for yearly opioid-related death rates (2011–2017).
  • U.S. Census Bureau: Traditional socioeconomic status (SES) variables (income, education, etc.) used to determine if social media language adds value beyond standard census data.

Key Results and Insights

TrOP achieved a Mean Absolute Percentage Error (MAPE) of 2.92%, outperforming traditional linear models (7% error) by more than double. In absolute terms, the model's predictions were off by only 1.15 deaths per 100,000 people on average.

Comparison of actual opioid death rates vs. predictions from TrOP and baseline models in Orange County, FL and Salt Lake County, UT.

One of the most striking findings was that language data is a primary signal. Models using only past death rates were significantly less accurate than those that "listened" to digital conversations. Furthermore, adding traditional census data (SES) to the language-based model did not significantly improve performance, suggesting that social media language already captures the underlying socioeconomic stressors leading to opioid mortality.

Model performance in Fayette County, WV, illustrating TrOP's ability to track rising mortality trends compared to RNN and AR baselines.

Language as a "Sensor"

The researchers identified specific linguistic clusters associated with mortality trends:

  • The "Anti-Despair" Signal: Language centered on family, holidays, and personal engagement (e.g., "merry," "christmas," "dinner") was associated with lower mortality, suggesting that community-level social cohesion acts as a protective buffer.
  • Worldly vs. Personal: Conversely, language associated with higher mortality tended to focus on "worldly" or negative events, such as politics, homelessness, and systemic struggle, rather than personal social circles.

Limitations and Future Work

Despite its accuracy, the model faces demographic biases, as Twitter users tend to be younger and more urban. The presence of automated "bots" also remains a potential source of noise. Additionally, because the study used data up to 2017, the model must be retrained on more recent data to account for the shifts caused by the COVID-19 pandemic and the current dominance of illicit fentanyl. Future iterations aim to expand this scope to more rural, data-sparse counties.

Summary updated

BibTeX
@article{matero2023opioid,
  author = {Matthew Matero and Salvatore Giorgi and Brenda Curtis and Lyle H. Ungar and H. Andrew Schwartz},
  title = {{Opioid death projections with AI-based forecasts using social media language}},
  journal = {Npj Digit. Medicine},
  year = {2023},
  doi = {10.1038/s41746-023-00776-0},
}
Figure