In October 2012, the US government's Center for Medicare and Medicaid Services (CMS) began reducing Medicare payments for Inpatient Prospective Payment System hospitals with excess readmissions. Excess readmissions are measured by a ratio, by dividing a hospital’s number of “predicted” 30-day readmissions for heart attack, heart failure, and pneumonia by the number that would be “expected,” based on an average hospital with similar patients. A ratio greater than 1 indicates excess readmissions.
In this exercise, you will:
More instructions provided below. Include your work in this notebook and submit to your Github account.
In [1]:
%matplotlib inline
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import bokeh.plotting as bkp
from mpl_toolkits.axes_grid1 import make_axes_locatable
In [2]:
# read in readmissions data provided
hospital_read_df = pd.read_csv('data/cms_hospital_readmissions.csv')
hospital_read_df.head()
Out[2]:
In [3]:
# deal with missing and inconvenient portions of data
clean_hospital_read_df = hospital_read_df[hospital_read_df['Number of Discharges'] != 'Not Available']
clean_hospital_read_df.loc[:,'Number of Discharges'] = clean_hospital_read_df['Number of Discharges'].astype(int)
clean_hospital_read_df = clean_hospital_read_df.sort_values('Number of Discharges')
In [4]:
# generate a scatterplot for number of discharges vs. excess rate of readmissions
# lists work better with matplotlib scatterplot function
x = [a for a in clean_hospital_read_df['Number of Discharges'][81:-3]]
y = list(clean_hospital_read_df['Excess Readmission Ratio'][81:-3])
fig, ax = plt.subplots(figsize=(8,5))
ax.scatter(x, y,alpha=0.2)
#ax.plot(x,y)
ax.fill_between([0,350], 1.15, 2, facecolor='red', alpha = .15, interpolate=True)
ax.fill_between([800,2500], .5, .95, facecolor='green', alpha = .15, interpolate=True)
ax.set_xlim([0, max(x)])
ax.set_xlabel('Number of discharges', fontsize=12)
ax.set_ylabel('Excess rate of readmissions', fontsize=12)
ax.set_title('Scatterplot of number of discharges vs. excess rate of readmissions', fontsize=14)
ax.grid(True)
fig.tight_layout()
Read the following results/report. While you are reading it, think about if the conclusions are correct, incorrect, misleading or unfounded. Think about what you would change or what additional analyses you would perform.
A. Initial observations based on the plot above
B. Statistics
C. Conclusions
D. Regulatory policy recommendations
Include your work on the following in this notebook and submit to your Github account.
A. Do you agree with the above analysis and recommendations? Why or why not?
B. Provide support for your arguments and your own recommendations with a statistically sound analysis:
You can compose in notebook cells using Markdown:
The report conclusion says there is a strong coorelation between the Hospital capacity and readmission rates.We have not tested if there is really a strong coorelation between them and hence need to set up a hypothesis test.
Null hypothesis: There is no statistical difference between the hospital capacity and the readmission rates.
Alternate hypothesis: There is a statistical difference between the hospital capacity and the readmission rates.
We can compare small number of hospitals(hospital_capacity<100) and large number of hospitals(hospital_capacity>1000) to fit our hypothesis and since the number of samples are different for the two of them we can perform ANOVA.
In [5]:
hospital_cap_small= clean_hospital_read_df[clean_hospital_read_df['Number of Discharges'].astype(int)<100]
hospital_cap_small = hospital_cap_small[hospital_cap_small['Number of Discharges'].astype(int) != 0]
hospital_small=sorted(hospital_cap_small['Excess Readmission Ratio'])
In [6]:
hospital_cap_big= clean_hospital_read_df[clean_hospital_read_df['Number of Discharges'].astype(int)>1000]
hospital_cap_big = hospital_cap_big[hospital_cap_big['Number of Discharges'].astype(int) != 0]
hospital_big=sorted(hospital_cap_big['Excess Readmission Ratio'])
In [7]:
from scipy import stats
statistic = stats.f_oneway(hospital_small,hospital_big)
statistic
Out[7]:
With alpha=0.01 the p-value is way too less than alpha and hence we can say that the null hypotheis can be rejected and the difference is not due to randomness. There is a significant difference between the two groups but we should also consider various other factors that might influence this difference.