Skip to content

Add Social Security retirement benefit calculation chain#7515

Open
MaxGhenis wants to merge 3 commits intoPolicyEngine:mainfrom
MaxGhenis:implement-ss-benefits-v2
Open

Add Social Security retirement benefit calculation chain#7515
MaxGhenis wants to merge 3 commits intoPolicyEngine:mainfrom
MaxGhenis:implement-ss-benefits-v2

Conversation

@MaxGhenis
Copy link
Contributor

Summary

Implements the full Social Security retirement benefit formula chain, transforming social_security_retirement from an input-only variable to a computed variable with 14 new variables and 20 new parameter files.

Variable chain

employment_income, self_employment_income (existing)
    → ss_covered_earnings_this_year (min(earnings, wage_base))
    → ss_aime (45-year lookback, NAWI indexing, highest 35 / 420)
    → ss_pia (90/32/15% bend point formula)
    → ss_retirement_age_adjustment_factor (early/delayed credits)
    → ss_retirement_benefit_before_earnings_test (PIA × factor × 12)
    → ss_earnings_test_reduction (excess earnings × rate)
    → social_security_retirement (benefit - reduction)

Key design decisions

  • Microsim compatibility: social_security_retirement branches between reported (CPS) and computed values via reported_social_security_retirement simulation parameter. CPS input values override the formula automatically.
  • AIME is input-overridable: ss_aime_input lets users enter their AIME from their SSA statement, bypassing the 45-year lookback.
  • Claiming age vs current age: ss_claiming_age defaults to age but can be set independently to model e.g. a 70-year-old who claimed at 62.
  • Full longitudinal lookback: AIME computation loops over 45 years with period.offset(), indexing each year's earnings by NAWI ratio.
  • All parameters are reformable: bend point factors, FRA, wage base, earnings test thresholds/rates, early/delayed retirement rates, minimum retirement age.

Files changed

  • 14 new variable files under variables/gov/ssa/social_security/
  • 1 modified variable: social_security_retirement.py (added formula with reported/computed branching)
  • 20 new parameter files under parameters/gov/ssa/social_security/ and parameters/gov/simulation/
  • 12 test files with 78 YAML tests (unit, integration, multi-year earnings history)

Test plan

  • 78 YAML tests pass: policyengine-core test .../gov/ssa/social_security/ -c policyengine_us
  • Microsim backward compatibility verified (SS retirement total ~$1T)
  • make format passes
  • CI passes

🤖 Generated with Claude Code

MaxGhenis and others added 3 commits February 27, 2026 16:40
Implements the full SS retirement benefit formula chain from
earnings through final benefit amount:

Variables (14 new, 1 modified):
- ss_covered_earnings_this_year: min(earnings, wage_base)
- ss_quarters_of_coverage: floor(earnings / threshold), max 4
- ss_aime_eligible: age >= 22
- ss_aime_input: optional direct AIME override from SSA statement
- ss_aime: 45-year indexed earnings lookback, highest 35 / 420
- ss_pia: 90/32/15% bend point formula
- ss_full_retirement_age_months: scale by birth year (780-804)
- ss_claiming_age: input, defaults to current age
- ss_retirement_eligible: claiming_age >= minimum_retirement_age
- ss_retirement_age_adjustment_factor: early/delayed credits
- ss_retirement_benefit_before_earnings_test: PIA * factor * 12
- ss_earnings_test_applicable: claiming and under FRA
- ss_earnings_test_reduction: excess earnings * rate
- social_security_retirement_reported: input-only for CPS data
- social_security_retirement: reported/computed branching

Parameters (20 new):
- wage_base (1937-2025), AIME config, PIA bend points,
  FRA by birth year, early/delayed retirement rates,
  earnings test thresholds, minimum retirement age,
  simulation controls (aime_lookback_years,
  reported_social_security_retirement)

Tests: 78 YAML tests covering unit, integration, and
multi-year earnings history scenarios.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant