Add marginal_tax_rate_wrt_employer_cost (#45)#1641
Open
vahid-ahmadi wants to merge 1 commit intomainfrom
Open
Conversation
Mirror the existing `marginal_tax_rate` variable but divide the change in household net income by the change in the employer's cost of employment rather than the change in gross pay. The denominator is `employer_cost` (gross pay plus employer NI, employer pension contributions, and statutory sick/maternity/paternity pay), so a pound of employer-side NI is no longer invisible to the MTR. Computation uses the same simulation-branching pattern as `marginal_tax_rate` — for each adult, branch the simulation, bump `employment_income` by the configured delta, recompute, and read both `household_net_income` and `employer_cost` in the branch. Division-by- zero is guarded for people whose employer cost happens not to move. No change to the existing `marginal_tax_rate` variable. Downstream surfaces (API, household calculator) would need a separate change to expose the new variable to end users. Co-Authored-By: Claude Opus 4.7 (1M context) <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
marginal_tax_rate_wrt_employer_costthat mirrors the existingmarginal_tax_ratebut uses the change inemployer_cost(gross pay + employer NI + employer pension contributions + statutory sick/maternity/paternity pay) as the denominator. A pound of employer-side NI is therefore no longer invisible to the MTR.marginal_tax_rate: for each adult, branch, bumpemployment_incomeby the configured delta, recompute, and read bothhousehold_net_incomeandemployer_costin the branch.marginal_tax_rateis unchanged.Closes #45.
Notes
policyengine-api/policyengine-appis a separate change.marginal_tax_rate, no YAML test is added — the branching pattern is not naturally unit-testable through the standard yaml harness.Test plan
ruff format+ruff checkon the new file.system.variablesimport check).make test) on this branch.marginal_tax_ratefor a household with no employer NI liability — the two MTRs should match.🤖 Generated with Claude Code