Data Science Project · Health Economics
Hospital Operating Margins: A Five-Year Longitudinal Panel Analysis
Built a 29,670-record hospital-year panel from raw CMS Medicare Cost Reports and modeled rural–urban margin differences using mixed-effects models, GEE, and logistic mixed models in R.
Rdata.tablelme4geepackLongitudinal Data AnalysisMixed-Effects ModelsGEE
Overview
A self-directed analysis of hospital financial performance using public-use CMS Healthcare Cost Report Information System (HCRIS) data. I assembled a five-year panel (FY2018–2022) covering roughly 6,000 hospitals per year and used it to estimate how operating margins differ between rural and urban hospitals over time.
What I did
- Assembled a 29,670-record hospital-year panel from raw HCRIS microdata, validating Worksheet G-3 and S-2 financial line mappings against more than 20 million raw line items.
- Engineered a reproducible ingestion pipeline in R (data.table) that extracts, pivots, joins provider identifiers, and computes operating and total margins per hospital per year, with a documented outlier-trimming rule.
- Fit three model families to the panel: a linear mixed-effects model, generalized estimating equations (GEE), and a logistic mixed model (lme4, geepack).
- Quantified the between-hospital correlation (ICC = 0.74), showing that most margin variation is stable hospital-level rather than year-to-year — justifying the panel design.
- Contrasted subject-specific and population-averaged estimates of the odds of a hospital operating at a loss (odds ratios of 4.7 vs. 1.8), illustrating how the two frameworks answer different questions.
Key findings
- Rural hospitals ran persistently lower operating margins than urban hospitals across all five years (median gap ~5–7 percentage points).
- The panel independently reproduced the known national arc: a pre-pandemic decline, a 2020 COVID shock, a 2021 relief-driven partial recovery, and a 2022 fade.
- Documented deviations from published figures and the methodological reasons for them, rather than claiming a perfect match.
Data source
Data: CMS HCRIS public-use files (Form 2552-10). Analysis is independent and self-directed; uses only public, non-identifiable aggregate cost-report data.
Code
View code on GitHub →Repository link coming soon.