Source: https://goo.gl/images/wYdKFi

Are We Aware of the Opioid Crisis? A Data Exploration of Opioid Abuse — Part 2

Manali Shinde
One Datum At A Time
9 min readMay 9, 2018

--

Hello Readers!

The following articles are going to be a part of a three part series on the opioid crisis in Canada and America. The opioid crisis has been declared a national emergency in both countries — and yet I find that not many people are aware of it as they should be.

Some of the questions I will be exploring are:

  1. What does overall Canadian and American data and research tell us?
  2. Presentation of data: can we make a comparison between one province and one state?
  3. How prevalent are prescription opioids?
  4. What steps can we take to raise awareness and action against opioid overdose?

Since this will be a length of this piece will be long, I want to dedicate a whole article to each question (grouping 3 and 4 together). I hope that you read the series and it really gets the gears going for you. By the end of each article, if you have any questions regarding anything I have explored, please be sure to reach out and let me know!

Note: Raw data and any coding will be uploaded on my Github page and link will be provided at the end of each article.

To Recap — here is Part One

Massachusetts, USA

While analyzing data from the state of Massachusetts, I came across a very peculiar problem — there just wasn’t enough parameters available to do an in-depth analysis. What I could do however, was build a prediction model to the best of the data-set's abilities, to try and predict the death rate — as of now — due to opioid poisoning.

In figure one — I attempted to plot the relationship between the year, and the death rate. While I may not have any factors affected how or why death rate is increasing, we can observe that this data is telling us that has the years progressed, the rate of death due to opioid overdose has increased. While there were dips from 2007–2010, we see a steady, and alarming increase from 2012 onward.

Fig 1: Death Rate from 1999 to 2016

The Prediction Model

Due to there being only three parameters, I opted to use a linear regression model, with Sklearn’s linear regression library, I was able to to construct a linear regression model to predict the death rate trend over 17 years. Below, is the sample code that was used to construct this simple model:

Note: This will be the same code that is going to be used for code regarding Ontario predictive regression

from sklearn.linear_model import LinearRegression
df=madata.drop(“State”, axis=1)
X = df.drop(“Death_Rate”, axis = 1)
lm = LinearRegression()
lm.fit(X, madata.Death_Rate)
print(“Estimated Intercept is”, lm.intercept_)
>> Estimated Intercept is -1878.93
print(“The coefficients in this model are”, lm.coef_)
>> The coefficients in this model are 0.941486

Finally, the model that was created is the following:
Model: Y = 0.941486Year — 1878.9318

When plotting the predicted versus actual death rates, we can observe that there is a low mean standard error of 14.09. Figure 2 shows us that the actual vs. predicted death rates are very similar to the overall relationship that is occurring in the geographical area.

With a mean of 11.1, and a mean standard error of 14, while we can find a margin of error, this model is still quite functional in predicting opioid poisoning death rate, and we see that the prediction also shows an upward trend.

print(scipy.mean(df.Death_Rate))
>> 11.105555555555556
mse = np.mean((df.Death_Rate — lm.predict(X))**2)
print(mse)
>> 14.08836524863341
Fig 2: Predicted vs. Actual Death Rate using the model

Ontario, Canada

As we observed from part 1, the highest opioid poisoning rate was seen in British Columbia, then Alberta and Ontario. While it would have been beneficial to compare BC data, there was more readily available open data for Ontario opioid rate. Public Health Ontario had historical data available from 2003–2016, organized by death rate, hospitalization rate, and emergency department visits due to prescription and street opioid abuse.

Ontario data was interesting as it included emergency department visits and hospitalization rates, but due to the data that was provided for the MA data set — I chose to focus on death rate for consistency. I may explore these parameters at a later date.

It is important to note that it is unknown, and perhaps not possible to determine whether these are deaths that have occurred at the hospital versus out of the hospital. It is not specified if this a cumulative rate of death that are of individuals who are found dead on arrival, or have died after treatment in the hospital. The relationship factor is that all these deaths are related to an overdose of opioid usage, whether prescription or recreational opioids.

Population Trends: Split By Gender Demographic

1. Average Death Rate Trend Grouped by Year

After using pivot tables to organize the data in a succinct manner, it is explained that the average death rate for the last 14 years was 2.37 females/year and 4.54 males/year. This average increase is demonstrated in figure 3.

Table 1: Average Death Rate per year
Fig 3: Average Death Rates in Females and Males

This data is a concatenated average of all age groups. In table one, we see that around 2015, the female death rate jumped to 3 individuals/year, and stayed consistent the following year. At the same time, we see a jump from 5 to 6 males/year, and then to an alarming rate of 7 males/year that are being affected by opioid abuse/poisoning. As figure 3 shows us, there is a steady, and frightening climb that is occurring in the average death rates. Both demographics, male and female are being affected by opioid abuse, and we see that the male population even more so.

2. Average Death Rate Trend Grouped by Age Group

Note: the code for all of these tables and visualization can be found on my Github page linked below.

Let’s zoom in a little on these statistics. First, I proceeded to construct a pivot table of the Female and Male death rates due to opioid abuse. Then, I wanted to observe how each age group is affected, in terms of the mean death rate in each year.

Table 1: Male and Female Average Death Rates Grouped by Age Group
Figure 4 & 5: Male and Female Average Death Rates Grouped by Age Group

0 to 14 : it is quite obvious why the rates are so low for this age group. Young infants are usually not prescribed strong opioids, and if there are deaths related to opioids for this age group, it is usually due to medicine that has not been properly stored at home. Therefore, the trend is seen at around 0 infant males and females/year.

15 to 24: The adolescent to young adult age groups has a low death rate, although we see a sharp increase in the number of females passing away due to opioid abuse, going from 0–1 females/year to 2. Starting from 2013/2014, we are seeing a slow increase in the death rate. In the male age groups, we see an even higher death rate in adolescents and young adults. Around 3–4 males/year, with an increase to 5 males in 2015 and 2016. While the death rate is low because adolescents may not able to easily get access to opioids. Or, if they are, it is usually things like Oxycontin, or Morphine, after a surgery.They are able to access these drugs through peers, or more frighteningly, older adults who have to use opioids for pain management, but do not remember to properly store away these drugs.

25 to 44: In males, this age group is the highest increase in opioid related deaths. With the average being more than 12 males/year starting in 2014. This average increased to an alarming 15 deaths in 2016. For females, the rate was around 3 -4 deaths/year with the highest being in 2016 at around 5 deaths. It is speculated that a large part of these deaths is in fact the over usage of prescription drugs. Due to improper handling, over-prescription, and a heavily reliance of opioids by healthcare professionals, we see that pain management is mostly done by opioids, when alternatives are not given as an option.

45 to 64: Similar to the reasoning behind the previous age group, we see a drastic increase in opioid usage. For female residents of Ontario, the death rate goes up to about 7 women in the year, while staying at around 6 women in 2016, and the trend is increasing. Similarly, for men, around 7–12 men are dying in the year due to opioid abuse. Again, whether this is recreational or prescribed is unclear, however — considering the age group, we can perhaps infer that most if the population that is using opioids in this age groups has been prescribed it in order to manage their pain or other symptoms.

65+: Finally, the death rate due to opioid abuse is around 1 death a year for more males and females. This is once again increasing steadily as the years progress, nearing 2 individuals per year. Many of the reasons why this increase is occurring will be covered in part three of this series.

Building a Linear Regression Model and What it Tells Us

For the sake of consistency, these predictions were done using a Linear Regression model, using the scikit learn library. The code above was used to design these models. The different here was that in order to make a prediction model, since a large portion was data was available, I was able to conduct a train-test split.

Fig 6: Actual Death Rate Trends

Figure 6 was plotted using an overall average of all age groups, and a strong correlated, positive trend was observed. there was a higher rate of increase in the male demographic than the female demographic, with a rate of 0.278 male deaths per year. In females, the rate was observed to be slightly lower, but positive as well at 0.106 deaths per year.

Fig 7: Predicted Death Rate Trends after a Train-Test Split

Then, I wanted plot the predicted death rates, using the train — test split. I saw a similar trend. In Figure 7, a linear and positive trend can be observed. As the years are progressing, there does not seem to be a decrease in opioid deaths — at the moment. With increased awareness and action taken , it is hoped that this trend will become more negative.

Summary of the Statistics

Male regression model:

Y = 0.278x-554.81
R2= 0.08968
MSE = 12.42

Female regression model:

Y = 0.106x -211.82
R2 = 0.0511
MSE = 3.425

Above is a summary of the linear regression models that I have used, with the R squared and mean square error statistic. We observe that while the linear regression model can be used to predict death rates due to opioid abuse, it may not provide us with significant data, as the R-squared value is very low. That being said, the mean standard error, is not too far from the average values for each demographic.

In the next part, I will being going in depth of how we can raise more awareness of the opioid crisis, and the factors that are affecting these statistics to begin with. Until then, do not hesitate to reach out to me in the comments or via Twitter!

Thank you for reading!

References

--

--

Manali Shinde
One Datum At A Time

A health informatician and aspiring health data analyst. I am a photographer, writer, dancer, and public health advocate. Join me on my journey!