Add Social Security retirement benefit calculation chain#7515
Open
MaxGhenis wants to merge 3 commits intoPolicyEngine:mainfrom
Open
Add Social Security retirement benefit calculation chain#7515MaxGhenis wants to merge 3 commits intoPolicyEngine:mainfrom
MaxGhenis wants to merge 3 commits intoPolicyEngine:mainfrom
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements the full Social Security retirement benefit formula chain, transforming
social_security_retirementfrom an input-only variable to a computed variable with 14 new variables and 20 new parameter files.Variable chain
Key design decisions
social_security_retirementbranches between reported (CPS) and computed values viareported_social_security_retirementsimulation parameter. CPS input values override the formula automatically.ss_aime_inputlets users enter their AIME from their SSA statement, bypassing the 45-year lookback.ss_claiming_agedefaults toagebut can be set independently to model e.g. a 70-year-old who claimed at 62.period.offset(), indexing each year's earnings by NAWI ratio.Files changed
variables/gov/ssa/social_security/social_security_retirement.py(added formula with reported/computed branching)parameters/gov/ssa/social_security/andparameters/gov/simulation/Test plan
policyengine-core test .../gov/ssa/social_security/ -c policyengine_usmake formatpasses🤖 Generated with Claude Code