Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for CPI_offset logic #2381

Merged
merged 3 commits into from
Nov 12, 2019
Merged

Conversation

hdoupe
Copy link
Collaborator

@hdoupe hdoupe commented Nov 11, 2019

When the CPI_offset parameter is updated in 2018 or later, the values from prior years are re-applied to the inflation rates. Here's an example demonstrating the behavior:

import numpy as np

from taxcalc import Policy


p1 = Policy()
p2 = Policy()
p2.implement_reform({"CPI_offset": {2022: -0.005}})

p1_rates = p1.inflation_rates()
p2_rates = p2.inflation_rates()

for year in range(2013, 2030):
    print(
        year,
        p1_rates[year - 2013],
        p2_rates[year - 2013],
        np.round(p1_rates[year - 2013] - p2_rates[year - 2013], 4)
    )

# output:
2013 0.0148 0.0148 0.0
2014 0.0159 0.0159 0.0
2015 0.0012 0.0012 0.0
2016 0.0127 0.0127 0.0
2017 0.0187 0.0162 0.0025 # p1 is 0.0025 greater than p2
2018 0.0224 0.0199 0.0025 # even though they should be equal
2019 0.0186 0.0161 0.0025
2020 0.0233 0.0208 0.0025
2021 0.0229 0.0204 0.0025
2022 0.0228 0.0178 0.005
2023 0.0221 0.0171 0.005
2024 0.0211 0.0161 0.005
2025 0.0209 0.0159 0.005
2026 0.0211 0.0161 0.005
2027 0.0208 0.0158 0.005
2028 0.021 0.016 0.005
2029 0.021 0.016 0.005

This PR only applies the offset starting in the first year that CPI_offset is modified in the revision.

@codecov
Copy link

codecov bot commented Nov 11, 2019

Codecov Report

Merging #2381 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff           @@
##           master   #2381   +/-   ##
======================================
  Coverage     100%    100%           
======================================
  Files          13      13           
  Lines        2748    2749    +1     
======================================
+ Hits         2748    2749    +1
Impacted Files Coverage Δ
taxcalc/parameters.py 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 05702c0...c48a4b0. Read the comment docs.

@MattHJensen
Copy link
Contributor

Thanks @hdoupe. I was able to replicate the bug and fix locally. Merging.

@MattHJensen MattHJensen merged commit 7d1b24f into PSLmodels:master Nov 12, 2019
@hdoupe hdoupe deleted the cpi-offset-fix branch November 12, 2019 15:41
hdoupe added a commit to hdoupe/Tax-Calculator that referenced this pull request Feb 29, 2020
@hdoupe hdoupe mentioned this pull request Mar 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants