In this script we compare Medicare payments in 2012 between several states. There are many ways to do this. For example, we could look at the total or average of all payments to all providers in a state. However the total payment at the state level would scale with the size of the state, and the average payment may be affected by the composition of patients and providers within the state. To reduce these effects, we can look at the average payment made within a state to all providers of a specific type, or for all services of a particular type. These averages can then be compared between states.

Next we read in the data for each state that we intend to analyze. We use a dictionary comprehension to create a dictionary that maps the two-letter state name string to the Pandas DataFrame object for the state.

The simplest comparison is to look at the total of all payments by state. We calculate this quantity in the next cell (in billions of US dollars). If we are comparing Florida to Michigan, Florida's total population is 19.3 million and Michigan's is 9.8 million. Florida's population of people over 65 years old is 4.1 million, and Michigan's is 1.5 million.

Next we aggregate the data by provider, taking the sum of all payments to each provider within each state. Again we use dictionary comprehensions, so the result is a dictionary mapping state abbreviations to a DataFrames containing the aggregated values. We aggregate the payments by summing, and we aggregate the provider type by taking the first value within the group (since it is constant within each group). The first function extracts the first element from a Pandas Series object.

This is what these data look like for one state, the numbers are the average total payment to a provider of a given type within the state:

In [10]:

by_provider_type["MI"].head()

Out[10]:

total_payment

provider_type

Addiction Medicine

121745.735000

Allergy/Immunology

53693.749917

Anesthesiologist Assistants

3732.635000

Anesthesiology

36701.068349

Audiologist (billing independently)

5019.827558

Up to this point, we had a separate data set for the each state. Now that we have reduced the data to the main quantity of interest, we can merge the state-level data sets into a single data set, to make it easier to compare the states.

Since the payment levels are quite skewed, we will plot them on a log scale. Note that the zeros that were introduced into the dataset will become nan after taking the log, and hence will be dropped from the plot. This is OK because those probably reflect administrative differences in how the coding is handled, rather than being true zeros.

plt.plot(by_service_type.loc[:,state_names[0]],by_service_type.loc[:,state_names[1]],'o',alpha=0.6)plt.plot([0,1e4],[0,1e4],'-',color='grey',alpha=0.5)plt.xlabel(state_names[0]+" service types",size=15)_=plt.ylabel(state_names[1]+" service types",size=15)

In [23]:

x=np.log(by_service_type.loc[:,state_names[0]])/np.log(2)y=np.log(by_service_type.loc[:,state_names[1]])/np.log(2)plt.plot(x,y,'o',alpha=0.6)plt.plot([0,14],[0,14],'-',color='grey',alpha=0.5)plt.xlim(0,14)plt.ylim(0,14)plt.xlabel(state_names[0]+" service types",size=15)_=plt.ylabel(state_names[1]+" service types",size=15)

Another way to compare the two states is to examine the distribution of provider total payments. A quantile-quantile (QQ) plot shows in detail how two distributions differ.

Compare the states' total Medicare payments in terms of the number of unique beneficiaries, and the number of unique beneficiary days (see the data documentation for the variable names). Interpret the results relative to the states' population sizes and Medicare eligible (65 years of age or older) population sizes.

Calculate the proportion of providers in each state who belong to each provider type. Compare these proportions between the two states using some of the techniques demonstrated above.

Repeat some of the analyses above using alternative measures to count the services (number of unique beneficiaries and number of unique beneficiary days).

This website does not host notebooks, it only renders notebooks
available on other websites.