← All projects

Case study · Healthcare analytics · 2026

Where Medicare pays more for the same procedure

For office visits, state payment gaps are mostly local cost. For imaging they aren't, and much of what remains reflects what was billed.

SQLdbtDuckDBPythonTableau
9.78Mrows of 2024 CMS data processed by a tested dbt pipeline
14 → 0high-payment flags for office visits once local cost is removed
13 → 9high-payment flags for imaging: most remain
19automated data tests, all passing
Tableau dashboard of Medicare payment variation by state

The Tableau dashboard. Pick a procedure and switch between actual and adjusted payment.

The questionIs a state expensive, or just expensive to work in?

We compare Medicare payments across states. How do we avoid mistaking local costs for high prices?

An illustrative brief from a health plan's analytics manager. The data is real.

Medicare deliberately pays more where it costs more to run a practice. CMS also publishes each payment with those geographic adjustments removed. Comparing the two shows how much of a state's gap is local cost.

The dataThree CMS files for 2024

The provider-level file (9.78M rows, 1.73M kept for ten common procedures in the 50 states and DC), CMS's published state averages, and a procedure summary that shows what each imaging bill covered.

A flag is a state paying 10% or more above the national average for a procedure.

The approachA tested pipeline, then one question at a time

1 · Model

dbt and DuckDB turn the raw files into a star schema: one fact table and provider, procedure and geography tables.

2 · Test

19 data tests check keys, relationships and business rules, including that provider totals never exceed CMS's state totals.

3 · Explain

Measure how much states vary before and after local cost adjustment, then test what explains the gap that's left.

What this showsVisits are local cost; imaging is what was billed

Chart of how much state payments vary before and after local cost adjustment, by procedure
How much state averages vary (non-facility). Gray = actual payment, white or gold = after local cost adjustment. Imaging in gold.
  1. For visits, high-payment states are high because of local cost.Alaska pays 21% above average for an established patient visit, and 3% below once local cost is removed. All 14 visit flags disappear.
  2. Imaging keeps most of its gap.Spread stays at 13.2% for chest X-rays and 10.0% for heart ultrasounds after adjustment.
  3. Much of that is what was billed.A bill can cover the scan, the doctor's reading, or both. Partial bills are 55% of non-facility chest X-rays and 20% of heart ultrasounds, and pay much less.
  4. An explanation that failed:radiologists' share of imaging didn't explain the gap (r = −0.12 and −0.28), which is what sent me to the billing data.

RecommendationWhat I'd tell the health plan

A

Flag visits on the adjusted amount

Raw averages raise 14 visit flags that disappear once local cost is removed.

B

Split bill types before comparing imaging

Comparing only full-service bills outside hospitals cuts the spread from 19.3% to 10.8% for chest X-rays.

C

Don't set rates with the adjusted amount

It removes real local costs. Use it to compare places, and local Medicare rates when pricing.

How I checked itNumbers you can trust, and their limits

  • Two CMS files agree on non-facility imaging services to 99.5% and 99.8%; the build fails if the gap passes 1%.
  • Provider totals never exceed CMS's published state totals. The provider file holds 92–99.7% of published services, as CMS hides rows with 10 or fewer patients.
  • 19 data tests cover keys, relationships, allowed values and payment ranges.
  • The data shows that providers bill imaging in parts, not why.
  • Payments exclude the patient's share, and Medicare Advantage isn't included.
  • Differences in payment don't show that any state is overpaid.