Opioid Overdoses: A Data Science Case Study of Overdoses in Connecticut from 2012-2017

The History of Opioid Addiction:

With death counts rising to an all-time high, the opioid addiction crisis has created an alarming situation across the United States. The president and federal government have declared the opioid epidemic a national emergency as new synthetic drugs are infiltrating the system and taking thousands of lives each year. Furthermore, more powerful opiates—such as fentanyl—have been introduced into the market and mixed in with heroin, resulting in devastating consequences over the last few years.

Millions of people around the world receive prescriptions for opioids, typically for treatment of pain. Common legal opiate drugs include morphine, meperidine, codeine, hydrocodone, acetaminophen, ibuprofen, oxycodone, and fentanyl. In most cases, physicians prescribe such drugs to patients who are recovering from surgery or injury. While opioids serve a great purpose in relieving pain, rampant abuse of these substances has led to high rates of opioid addiction and the destruction of thousands of families, households, careers, and lives.

The explosion in fentanyl deaths and the persistence of widespread opioid addiction have swamped local and state resources. Communities are complaining of their budgets being strained by mounting demands on resources—from increased police presence and medical care to distribution of naloxone for treatment of opioid overdoses. Additional costs include the care of children who have lost their parents to fentanyl overdoses and have been placed in the foster care system.

The Path to Addiction

Despite the toll that opioid abuse takes on individuals, communities, and families, the opioid addiction trend continues.  When an abuser who is addicted to pain pills takes an opiate, the drug enters the brain through the bloodstream, creating a flood of artificial endorphins and dopamine—neurotransmitters responsible for feelings of reward, pleasure, and satisfaction. This process creates a rush of happiness and euphoria. The high is so unlike any naturally-occurring rush of dopamine or endorphins that a person can only experience it again by using the drug again. After repeated use, however, the brain stops creating dopamine and endorphins without the use of opiates. Because of the strong and desirable feelings that flood the brain, and because the user cannot feel pleasure naturally any longer, cravings for an opiate high become stronger.

There are several steps toward developing this painkiller addiction:

  1. The first is tolerance–when a person has to use increasingly larger doses of opiates to experience the same high.
  2. Next comes physical dependence, when the body will enter withdrawal if the abuser stops taking the drug.
  3. Finally, psychological dependence, or cravings for opiates set in—the hallmark of addiction. Many people become addicted to opiates unintentionally. For some, they begin using the drugs with a legitimate prescription to manage pain following an accident or surgery. The long-term effect of opioid use on the brain is significant as it changes the way nerve cells work in the brain. This process occurs even in people who take opioids for a long time to treat pain, as prescribed by their doctor. The nerve cells become accustomed to the presence of opioids, so the brain has a volatile reaction to the absence of these substances. The unpleasant feelings and reactions that result are known as withdrawal symptoms.

A Fiscal Crisis:

It is estimated that the opioid crisis has cost the U.S. about $37.8 billion in state and federal taxes between 2000 and 2016, according to a recent study conducted by researchers at Penn State University and published in the journal Medical Care. Specifically, researchers found that “between 2000 and 2016, opioid misuse cost state governments $11.8 billion, including $1.7 billion in lost sales tax revenue and $10.1 billion in lost income tax revenue.” Additionally, the study revealed that the federal government lost $26 billion in income tax revenue during that time.

Given these repercussions, there are many companies and sectors— ranging from the government to pharmaceutical companies to even technology companies—that are trying to find solutions. The beauty of data science is that it might discover unexplored avenues by revealing interesting patterns in relevant data. This article will probe into the dataset of the history of overdoses in the state of Connecticut from 2012 to 2017.

Case Study of Overdoses in Connecticut from 2012-2017:

Many people have a perception that high drug overdose rates are limited to a select few states that have a historical problem with drug use. However, let’s examine the data of a state like Connecticut—which doesn’t have a significant history of drug use and overdose, but has rates of addiction and overdose that are increasing at staggering levels each year.

Exploratory Data Analysis (EDA):

Initial Exploratory Data Analysis revealed the following descriptive statistics of overdoses:

  • 3583 deaths input in dataset from 2012-2017 in Connecticut
  • Mean age of overdose: 42.00 years, Median age of overdose: 43.00 years
  • Standard deviation: 12.33 years
  • Minimum age: 14.00 years
  • Maximum age: 87.00 years
  • 25%: 32.00 years
  • 50%: 43.00 years
  • 75%: 52.00 years

Data Visualization


The box plot provides a better visual view of the prevalence and concentration of overdoses among people in their 30s-50s, with a mean overdose of 42 years of age.

Age and Gender:

This visualization provides a clear image of the discrepancy in overdose rates between Males and Females. Men are far more likely to overdose than women in all age ranges, which is concerning and raises questions about what can be done to bring down overdoses in Males.

Race and Gender: 

More detailed statistics show that White men are overdosing at far higher rates compared to all other combinations of race and gender. However, it must be noted that the census of Connecticut has significantly more White men than other race and gender combinations.


All T-tests show a significant difference in mean ages. What is interesting here, however, is that users of heroin and fentanyl tend to be younger than users of cocaine and benzodiazepine. These t-tests indicate statistically significant differences in drug consumption based on age!

Machine Learning: Modeling and Feature Engineering

The three best models with the maximum accuracy score are the decision tree classifier (90.6%), gradient boosting (89.6%), and random forest classifier (77.5%).

Feature Engineering and Importance:

The feature importance of the causes of death show that the top three are multiple drug toxicity, heroin intoxication, and cocaine intoxication.

Our decision tree classification report shows the three most important features and the corresponding scores associated with each feature:

Precision                     Recall                        F1 Score


Multiple Drug Toxicity           0.96                             1.00                     0.98

Heroin Intoxication                 0.96                             1.00                      0.98

Cocaine Intoxication               0.97                             1.00                     0.99

The F1 Score (or weighted average of precision and recall, which takes both false positives and false negatives into account), is a measure of the test’s accuracy score. In this case, the decision tree model has performed extremely well on this dataset for each major feature importance.

Final Note:

In conclusion, this initial exploration of the dataset released by the State of Connecticut, using visualization and machine learning tools, has shown how patterns can be uncovered through the power of data science. Feature engineering revealed that having multiple drugs in the system is a strong predictor of fatal overdoses, followed closely by heroin intoxication and cocaine intoxication. As more of these drugs are entering the market and being added into other relatively “harmless” drugs (without the knowledge of users or even dealers), the need to end this crisis as soon as possible becomes ever more crucial.

For the link to the code and more visualizations, visit: