Medicare Blog

how to compare states in medicare national data in r studio

by Dalton Jaskolski Published 2 years ago Updated 1 year ago
image

How have we improved Medicare’s compare sites?

We’ve also improved Medicare’s compare sites. The Centers for Medicare & Medicaid Services (CMS) and the nation’s hospitals work collaboratively to publicly report hospital quality performance information on Care Compare website located at www.medicare.gov/care-compare/ and the Provider Data Catalog on data.cms.gov.

Is there a package for data structure in R?

There are packages like the package on R, which have focused more on the structure of the data frame and lesser on the data itself. I was not able to easily identify and isolate what has changed in the data itself. So I decided to write one for myself.

What has CMS added to patient data in 2009?

2009: CMS added data on hospital outpatient facilities, which included outpatient imaging efficiency data as well as emergency department and surgical process of care measures. 2010: Addition of 30-day readmission measures for heart attack, heart failure and pneumonia patients.

Where can I find data on hospital quality measures?

CMS first publicly reported data on hospital quality measures on a web site called Hospital Compare. Hospital Compare was created through the efforts of Medicare and the Hospital Quality Alliance (HQA).

image

Introduction

Every so often while doing data analysis, I have come across a situation where I have two datasets, which have the same structure but with small differences in the actual data between the two. For example:

Usage

The package has a single function, compare_df compare_df . It takes in two data frames, and one or more grouping variables and does a comparison between the the two.

Basic Example

Let’s take the example of a teacher who wants to compare the marks and grades of students across two years, 2010 and 2011. The data is stored in tabular format.

Load csv into R

Boot up R Studio and load the packages tidyverse, ggplot2 and fiftystater. For Storybench tutorials on tidyverse head here and for ggplot2 head here.

Set up your map in ggplot

Next, we call up the state boundaries data using data (“fifty_states”). We then plot that using ggplot2 with the following line:

Mapping multiple data points in each state

Using the school shootings data set amassed by the Washington Post here, we visualized the lat and long coordinates and mapped bubble size the number of people killed. Code and map below.

What is the comparison of means test?

The comparison of means tests helps to determine if your groups have similar means. So this article contains statistical tests to use for comparing means in R programming. These tests include: T-test. Wilcoxon test.

What is a one sample Wilcoxon signed-rank test?

The one-sample Wilcoxon signed-rank test is a non-parametric alternative to a one-sample t-test when the data cannot be assumed to be normally distributed . It’s used to determine whether the median of the sample is equal to a known standard value i.e. a theoretical value.

What is the function of Manova in R?

The class “manova” differs from class “aov” in selecting a different summary method. The function manova () calls aov and then add class “manova” to the result object for each stratum.

What is paired sample t-test?

In a paired sample t-test, each subject is measured two times, resulting in pairs of observations.

Description

A dataset with variables about the 50 states. This dataset is used to demonstrate application of R to political analysis. See book Appendix for variable names and descriptions.

Source

Data sources vary. See Appendix Table A.3 of printed textbook for further information.

41.1 Introduction

When dealing with national data/geographical data, i.e., election results, it is often useful to visualize the data onto a map as it could help draw conclusion geographycally. Hence, in this tutorial, we will explore different packages that could help with mapping geographical data, specifically for the U.S.

41.2 Using usmap package

This is probabily the most convinent package to plot a U.S. map along with some data. usmap provides very helpful functions to select certain regions within the U.S.. Another feature of this package is that it creates a ggplot object and hence we could use all the nice functions that come with ggplot2 package.

41.5 Using plotly package

We first need to import data from US-State-Boundaries-Census-2014.shp, and then use plotly package. Suppose we care about water level for each state in U.S.

41.6 Using mapview package

We use the same dataset from last method. It gives us an interactive map with all information.

41.7 Using leaflet package

We use the same dataset from last method. We construct a interactive map with no specific information. If you are interested in a specific area, for example, water level, you can add specific choropleth to show more information.

image
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 1 2 3 4 5 6 7 8 9