Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/qmb-cost-sharing-calibration.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Value QMB cost sharing at Medicaid's spending per Qualified Medicare Beneficiary from CMS-64 line 17D ($137.70 a year in FY 2024), replacing 20 percent of all Medicare spending per enrollee, and remove the unused `gov.hhs.medicare.savings_programs.qmb.cost_sharing_rate` parameter.
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
description: Medicaid spending on Medicare deductibles and coinsurance for Qualified Medicare Beneficiaries, per Qualified Medicare Beneficiary enrollee per year.
# Each value is a federal fiscal year (October through September): national
# CMS-64 net expenditures on line 17D, "Coinsurance" (total computable), over
# Qualified Medicare Beneficiary person-years (QMB only plus QMB plus) from CMS
# Program Statistics. Fiscal year Y takes 0.25 times calendar year Y-1 and
# 0.75 times calendar year Y person-years. The latest value holds afterwards.
values:
2014-10-01: 145.14 # FY 2015: $964,276,592 / 6,643,568.5
2015-10-01: 160.07 # FY 2016: $1,088,990,259 / 6,803,362.5
2016-10-01: 149.87 # FY 2017: $1,044,519,254 / 6,969,459.1
2017-10-01: 143.55 # FY 2018: $1,023,074,055 / 7,126,922.3
2018-10-01: 142.54 # FY 2019: $1,036,646,026 / 7,272,591.8
2019-10-01: 138.65 # FY 2020: $1,040,603,350 / 7,505,377.9
2020-10-01: 133.70 # FY 2021: $1,046,566,216 / 7,827,817.8
2021-10-01: 128.05 # FY 2022: $1,037,693,614 / 8,103,524.3
2022-10-01: 132.92 # FY 2023: $1,118,400,599 / 8,413,952.4
2023-10-01: 137.70 # FY 2024: $1,153,227,651 / 8,374,811.6

metadata:
unit: currency-USD
period: year
label: Medicaid spending on QMB Medicare cost sharing per enrollee
reference:
- title: CMS - Medicaid Financial Management Reports, FY 2015 to FY 2024 net expenditures, National Totals, line "Coinsurance"
href: https://www.medicaid.gov/medicaid/financial-management/state-expenditure-reporting-for-medicaid-chip/expenditure-reports-mbescbes
- title: CMS-64.9 Base category of service line definitions - line 17D, Coinsurance and Deductibles for QMBs under section 1905(p)(3)
href: https://www.medicaid.gov/medicaid/downloads/cms-649-base-category-of-services-definition.pdf#page=18
- title: CMS Program Statistics - Medicare-Medicaid Dual Enrollment, table MDCR ENROLL AB 40 (QMB only and QMB plus person-years)
href: https://data.cms.gov/summary-statistics-on-beneficiary-enrollment/medicare-and-medicaid-reports/cms-program-statistics-medicare-medicaid-dual-enrollment
- title: MACPAC - MACStats December 2024, Exhibit 17 (FY 2023 Medicare premiums and coinsurance, the sum of CMS-64 lines 17A to 17D)
href: https://www.macpac.gov/wp-content/uploads/2024/12/MACSTATS_Dec2024_WEB-508.pdf#page=61
- title: 42 U.S.C. 1396d(p)(3) - Medicare cost-sharing definition
href: https://www.law.cornell.edu/uscode/text/42/1396d#p_3

This file was deleted.

243 changes: 243 additions & 0 deletions policyengine_us/tests/core/test_qmb_cost_sharing_per_enrollee.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,243 @@
"""Medicaid spending on Medicare cost sharing per Qualified Medicare Beneficiary.

``calibration.gov.hhs.medicare.savings_programs.qmb_cost_sharing_per_enrollee``
values QMB coverage of Medicare deductibles and coinsurance at what Medicaid
spends on it. Each federal fiscal year's value is national CMS-64 net
expenditure on line 17D, "Coinsurance and Deductibles", which holds "Medicare
deductibles and coinsurance required to be paid for QMBs under §1905(p)(3)"
(CMS-64.9 Base line definitions, page 18), over QMB person-years from CMS
Program Statistics (QMB only plus QMB plus, table MDCR ENROLL AB 40). Fiscal
year Y runs October Y-1 to September Y, so its person-years are 0.25 times
calendar year Y-1 plus 0.75 times calendar year Y, and its value is dated
October 1 of Y-1. ``qmb_cost_sharing`` pays a QMB a twelfth of it each month.

Invariants:

1. Transcription: each value is the line 17D total over fiscal-year QMB
person-years, rounded to the cent, recomputed here from the published
totals.
2. Cross-source: line 17D equals MACStats December 2024 Exhibit 17's FY 2023
"Medicare premiums and coinsurance" column ($27,587 million) less CMS-64
lines 17A to 17C1 for the same year.
3. Level: every value is positive and under a fifth of the fee-for-service
Part A and Part B cost sharing that QMBs incurred per QMB person-year in
calendar 2022, $1,139 (MedPAC and MACPAC duals data book, December 2025,
Table 6, over the same person-years). The series is what Medicaid pays,
not the cost sharing Medicare charges: 42 U.S.C. 1396a(n)(2) does not
require a state to pay once Medicare's payment reaches its Medicaid rate.
4. Dating: each date reads the value of the fiscal year it falls in, and every
date after September 2024 reads the FY 2024 value.
5. Consumers: a QMB's monthly ``qmb_cost_sharing`` is the value in force that
month over 12, other categories get zero, and a calendar year sums to nine
twelfths of one fiscal year's value plus three twelfths of the next.
``msp_federal_cost`` plus ``msp_state_cost`` equals ``msp_cost`` for QMB and
SLMB, and a full Medicaid enrollee has no separate MSP cost.
"""

from decimal import ROUND_HALF_UP, Decimal

import pytest
from hypothesis import given, settings
from hypothesis import strategies as st
from policyengine_core.parameters.operations.get_parameter import get_parameter

from policyengine_us import Simulation
from policyengine_us.system import system

SERIES = "calibration.gov.hhs.medicare.savings_programs.qmb_cost_sharing_per_enrollee"
FIRST_FY, LAST_FY = 2015, 2024
FISCAL_YEARS = range(FIRST_FY, LAST_FY + 1)

# CMS Medicaid Financial Management Report net expenditures, Medical
# Assistance Program, "MAP - National Totals" sheet, line "Coinsurance"
# (CMS-64.9 line 17D), total computable, from financial-management-report-
# fy<YEAR>.zip on medicaid.gov.
LINE_17D = {
2015: 964_276_592,
2016: 1_088_990_259,
2017: 1_044_519_254,
2018: 1_023_074_055,
2019: 1_036_646_026,
2020: 1_040_603_350,
2021: 1_046_566_216,
2022: 1_037_693_614,
2023: 1_118_400_599,
2024: 1_153_227_651,
}
# FY 2023 CMS-64 lines 17A (Medicare - Part A), 17B (Medicare - Part B) and
# 17C1 (120% - 134% Of Poverty), same sheet.
FY2023_PREMIUM_LINES = (4_467_995_163, 20_740_509_880, 1_260_062_080)
# MACStats December 2024, Exhibit 17, Total row, "Medicare premiums and
# coinsurance" column, FY 2023, millions.
MACSTATS_FY2023_MEDICARE_PREMIUMS_AND_COINSURANCE = 27_587
# CMS Program Statistics, Medicare-Medicaid Enrollment, table MDCR ENROLL AB
# 40, all areas, person-years as (QMB plus, QMB only). 2014-2016 from the
# 2017 release, 2017-2024 from the 2022 and 2024 releases.
QMB_PERSON_YEARS = {
2014: (5_188_112, 1_329_131),
2015: (5_302_665, 1_383_012),
2016: (5_394_679, 1_447_912),
2017: (5_491_307.666665925, 1_520_440.750000014),
2018: (5_612_836.249999335, 1_552_477.333333389),
2019: (5_740_930.41666614, 1_567_420.833333381),
2020: (5_916_824.416666307, 1_654_229.083333384),
2021: (6_204_436.916666491, 1_708_968.916666722),
2022: (6_424_476.916666286, 1_742_420.166666717),
2023: (6_767_803.583332852, 1_728_500.583333357),
2024: (6_586_884.583332959, 1_747_429.499999969),
}
# MedPAC and MACPAC, Data book: Beneficiaries dually eligible for Medicare and
# Medicaid, December 2025, Table 6: fee-for-service Part A and Part B cost
# sharing incurred in calendar 2022, billions, QMB plus and QMB only.
CY2022_QMB_FFS_COST_SHARING_INCURRED = 8.1e9 + 1.2e9


def _series(date):
return get_parameter(system.parameters, SERIES)(date)


def _fiscal_year_value(fiscal_year):
return _series(f"{fiscal_year - 1}-10-01")


def _fiscal_year_person_years(fiscal_year):
previous = sum(QMB_PERSON_YEARS[fiscal_year - 1])
current = sum(QMB_PERSON_YEARS[fiscal_year])
return 0.25 * previous + 0.75 * current


def _expected(fiscal_year):
ratio = LINE_17D[fiscal_year] / _fiscal_year_person_years(fiscal_year)
return float(Decimal(ratio).quantize(Decimal("0.01"), rounding=ROUND_HALF_UP))


@pytest.mark.parametrize("fiscal_year", FISCAL_YEARS)
def test_value_is_line_17d_over_qmb_person_years(fiscal_year):
assert _fiscal_year_value(fiscal_year) == _expected(fiscal_year)


def test_line_17d_is_macstats_medicare_column_less_premium_lines():
total = LINE_17D[2023] + sum(FY2023_PREMIUM_LINES)
assert round(total / 1e6) == MACSTATS_FY2023_MEDICARE_PREMIUMS_AND_COINSURANCE


@pytest.mark.parametrize("fiscal_year", FISCAL_YEARS)
def test_value_is_below_cost_sharing_incurred_per_qmb(fiscal_year):
incurred_per_qmb = CY2022_QMB_FFS_COST_SHARING_INCURRED / sum(
QMB_PERSON_YEARS[2022]
)
assert 0 < _fiscal_year_value(fiscal_year) < incurred_per_qmb / 5


@given(
st.integers(FIRST_FY, LAST_FY),
st.integers(1, 12),
st.integers(1, 28),
)
def test_each_date_reads_its_fiscal_year(fiscal_year, month, day):
calendar_year = fiscal_year - 1 if month >= 10 else fiscal_year
if calendar_year < FIRST_FY - 1 or (calendar_year, month) < (FIRST_FY - 1, 10):
return
date = f"{calendar_year}-{month:02d}-{day:02d}"
assert _series(date) == _fiscal_year_value(fiscal_year)


@given(st.integers(2024, 2100), st.integers(1, 12), st.integers(1, 28))
def test_dates_after_fy_2024_hold_its_value(year, month, day):
if year == 2024 and month < 10:
return
assert _series(f"{year}-{month:02d}-{day:02d}") == _fiscal_year_value(LAST_FY)


def _person_simulation(year, person):
members = ["person"]
return Simulation(
situation={
"people": {"person": person},
"tax_units": {"tax_unit": {"members": members}},
"spm_units": {"spm_unit": {"members": members}},
"families": {"family": {"members": members}},
"marital_units": {"marital_unit": {"members": members}},
"households": {
"household": {"members": members, "state_code": {year: "CA"}}
},
}
)


CATEGORIES = ("QMB", "SLMB", "QI", "NONE")


@settings(max_examples=25, deadline=None)
@given(st.integers(2015, 2035), st.integers(1, 12), st.sampled_from(CATEGORIES))
def test_qmb_gets_a_twelfth_of_the_value_in_force(year, month, category):
period = f"{year}-{month:02d}"
simulation = _person_simulation(year, {"msp_category": {period: category}})
paid = simulation.calculate("qmb_cost_sharing", period)[0]
expected = _series(f"{period}-01") / 12 if category == "QMB" else 0
# Variables are float32.
assert paid == pytest.approx(expected, rel=1e-6, abs=1e-6)


@settings(max_examples=15, deadline=None)
@given(st.integers(2015, 2035))
def test_calendar_year_sums_nine_and_three_twelfths(year):
simulation = _person_simulation(year, {"msp_category": {year: "QMB"}})
annual = sum(
simulation.calculate("qmb_cost_sharing", f"{year}-{month:02d}")[0]
for month in range(1, 13)
)
expected = (9 * _series(f"{year}-01-01") + 3 * _series(f"{year}-10-01")) / 12
assert annual == pytest.approx(expected, rel=1e-6)


@settings(max_examples=25, deadline=None)
@given(
st.integers(2015, 2035),
st.sampled_from(("QMB", "SLMB", "QI")),
st.sampled_from(("CA", "AL", "NY", "MS", "DC")),
st.floats(0, 6_000, allow_nan=False),
st.floats(0, 10_000, allow_nan=False),
st.booleans(),
)
def test_msp_cost_splits_between_federal_and_state(
year, category, state, part_a_premium, part_b_premium, medicaid_enrolled
):
members = ["person"]
simulation = Simulation(
situation={
"people": {
"person": {
"age": {year: 67},
"is_medicare_eligible": {year: True},
"medicaid_enrolled": {year: medicaid_enrolled},
"msp_category": {year: category},
"base_part_a_premium": {year: part_a_premium},
"base_part_b_premium": {year: part_b_premium},
}
},
"tax_units": {"tax_unit": {"members": members}},
"spm_units": {"spm_unit": {"members": members}},
"families": {"family": {"members": members}},
"marital_units": {"marital_unit": {"members": members}},
"households": {
"household": {"members": members, "state_code": {year: state}}
},
}
)
total = simulation.calculate("msp_cost", year)[0]
federal = simulation.calculate("msp_federal_cost", year)[0]
state_cost = simulation.calculate("msp_state_cost", year)[0]
if medicaid_enrolled:
assert total == federal == state_cost == 0
return
cost_sharing = sum(
simulation.calculate("qmb_cost_sharing", f"{year}-{month:02d}")[0]
for month in range(1, 13)
)
premiums = part_b_premium + (part_a_premium if category == "QMB" else 0)
assert total == pytest.approx(premiums + cost_sharing, rel=1e-5, abs=0.01)
assert federal + state_cost == pytest.approx(total, rel=1e-5, abs=0.01)
assert 0 <= federal <= total + 0.01
if category == "QI":
assert state_cost == pytest.approx(0, abs=0.01)
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
base_part_b_premium: 2_434.8
output:
# Part B premium: $202.90 * 12 = $2,434.80.
# QMB cost sharing: $14,500 * 20% = $2,900.
msp_cost: 5_334.8
# QMB cost sharing: Medicaid's $137.70 a year per QMB (FY 2024, held).
msp_cost: 2_572.5

- name: Case 2, SLMB MSP-only beneficiary receives Part B premium value.
period: 2026
Expand Down Expand Up @@ -55,3 +55,20 @@
base_part_b_premium: 2_434.8
output:
msp_cost: 0

- name: Case 5, QMB cost sharing switches fiscal year in October.
period: 2023
absolute_error_margin: 0.01
input:
state_code: CA
age: 67
is_medicare_eligible: true
medicaid_enrolled: false
msp_category: QMB
base_part_a_premium: 0
base_part_b_premium: 1_978.8
output:
# Part B premium: $164.90 * 12 = $1,978.80. QMB cost sharing: nine
# months of FY 2023 ($132.92 / 12) and three of FY 2024 ($137.70 / 12)
# = $99.69 + $34.425 = $134.115.
msp_cost: 2_112.915
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@
base_part_a_premium: 0
base_part_b_premium: 2_434.8
output:
# CA regular FMAP is 50%; total MSP cost is $5,334.80.
msp_federal_cost: 2_667.4
msp_state_cost: 2_667.4
# CA regular FMAP is 50%; total MSP cost is $2,434.80 Part B premium
# plus $137.70 QMB cost sharing = $2,572.50.
msp_federal_cost: 1_286.25
msp_state_cost: 1_286.25

- name: Case 2, QI cost is federally financed within allocation.
period: 2026
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
- name: Case 1, QMB cost sharing uses the monthly Medicare cost approximation.
- name: Case 1, QMB cost sharing is a twelfth of Medicaid's annual spending per QMB.
period: 2026-01
absolute_error_margin: 0.01
absolute_error_margin: 0.001
input:
msp_category: QMB
output:
# $14,500 annual Medicare per-capita cost / 12 * 20%.
qmb_cost_sharing: 241.67
# FY 2024 CMS-64 line 17D, $1,153,227,651, over 8,374,811.6 QMB
# person-years is $137.70 a year, held after FY 2024; / 12 = $11.475.
qmb_cost_sharing: 11.475

- name: Case 2, non-QMB MSP categories do not receive QMB cost sharing.
period: 2026-01
Expand All @@ -14,3 +15,21 @@
msp_category: SLMB
output:
qmb_cost_sharing: 0

- name: Case 3, September 2023 uses the fiscal year 2023 value.
period: 2023-09
absolute_error_margin: 0.001
input:
msp_category: QMB
output:
# FY 2023: $1,118,400,599 / 8,413,952.4 = $132.92 a year; / 12.
qmb_cost_sharing: 11.076667

- name: Case 4, October 2023 starts the fiscal year 2024 value.
period: 2023-10
absolute_error_margin: 0.001
input:
msp_category: QMB
output:
# FY 2024: $137.70 a year; / 12.
qmb_cost_sharing: 11.475
Original file line number Diff line number Diff line change
Expand Up @@ -84,5 +84,7 @@
base_part_a_premium: 0
base_part_b_premium: 2_434.8
output:
federal_benefit_cost: 2_667.4
state_benefit_cost: 2_667.4
# MSP cost: $2,434.80 Part B premium + $137.70 QMB cost sharing =
# $2,572.50, split at CA's 50% FMAP.
federal_benefit_cost: 1_286.25
state_benefit_cost: 1_286.25
Loading
Loading