R codebase from: Medicare and Medicaid hospital quality ratings and hospital community commitment – A cross-sectional study
Data files
Jun 08, 2026 version files 41.40 KB
-
Methods.Rmd
38.68 KB
-
README.md
2.72 KB
Abstract
This codebase contains an R Markdown script for reproducing the findings of Medicare and Medicaid Hospital Quality Ratings and Hospital Community Commitment – A Cross-Sectional Study (https://doi.org/10.1016/j.jcjq.2026.05.001). The included script links publicly available hospital data from the Centers for Medicare & Medicaid Services (CMS) Overall Hospital Quality Star Ratings and the Lown Institute Hospital Index to assess associations between hospital quality ratings and measures of service to and support for vulnerable communities. The data structure, which relies on data obtained and curated by independent entities, is hospital-level in nature. Variables included in the analysis represent CMS star ratings, Lown Institute inclusivity and community benefit rankings and grades, hospital characteristics, and sensitivity analysis variables included hospital referral region codes and reconstructed CMS continuous summary scores. This data is solely the property of the collecting entities, this script is solely for the purpose of analysis of publicly available data. The code reproduces the study's findings and workflow, including data cleaning, data linkage, cohort construction, descriptive comparisons of hospitals, figure generation, Kendall's tau-b and partial tau-b correlation analyses, and sensitivity analyses. These materials may be used to reproduce the published findings, examine alternative queries, and further evaluate the relationship between hospital quality ratings and measures of community commitment. These materials may also be used for educational purposes and methodological work. All data used in the project was obtained from publicly available, hospital-level datasets cited in the associated manuscript. The dataset does not contain personally identifiable information or protected health information. As the source materials rely on publicly available hospital-level data, no additional ethical restrictions apply beyond appropriate citation of the original datasets and/or publications.
Dataset DOI: 10.5061/dryad.q2bvq83xx
Description of the data and file structure
This script was compiled to support a cross-sectional study examining the relationship between publicly reported CMS Overall Hospital Quality Star Ratings and hospital community commitment metrics. The analyses link CMS hospital quality data with Lown measures of community benefit and inclusivity to assess whether higher-rated hospitals are associated with improved performance on measures of service to and support for the vulnerable communities they serve. Additional sensitivity analyses use reconstructed CMS continuous summary scores and hospital referral region clustering to evaluate the robustness of these associations.
Files and variables
File: Methods.Rmd
Description: A script containing the source code and links to the data utilized in the project Medicare and Medicaid Hospital Quality Ratings and Hospital Community Commitment – A Cross-Sectional Study.
Code/software
The included analysis script, Methods.Rmd, was written in R Markdown and is intended to be run in RStudio. The analysis uses R with the following packages loaded in the script: dplyr, ggplot2, patchwork, MASS, ppcor, ArgumentCheck, gdata, cluscor, gtsummary, and gt.
Access information
Publicly accessible locations of the data:
1. lown_ranks.csv: Lown Institute Hospital Index for Social Responsibility 2024–25 Rankings.
(https://lownhospitalsindex.org/rankings/?type=HospTyp_ACH)
2. Hospital_Full_Info.csv: CMS Hospital General Information July 2024 dataset.
(https://data.cms.gov/provider-data/dataset/xubh-q36u)
3. crosswalk.csv: ZIP code to HSA/HRR crosswalk used for HRR clustering.
(https://data.dartmouthatlas.org/supplemental/)
4. star_2024Jul.csv: Reconstructed CMS July 2024 continuous summary score file.
(https://qualitynet.cms.gov/inpatient/public-reporting/overall-ratings/sas)
5. teaching.csv: Teaching hospital indicator file.
(https://www.cms.gov/files/document/2025-reporting-cycle-teaching-hospital-listp.pdf)
6. beds.csv: Hospital bed count file.
(https://publicaccountability.org/datasets/239/hospital-beds-lo/)
