PSLmodels / Tax-Calculator

USA Federal Individual Income and Payroll Tax Microsimulation Model
https://taxcalc.pslmodels.org
Other
254 stars 153 forks source link

Simplify indexing of tax policy parameters #2732

Closed martinholmer closed 4 months ago

martinholmer commented 4 months ago

This pull request simplifies the indexing of policy parameters by changing the 2017-2034 ACPIU values in the growfactors.csv file from values calculated using the unchained CPI-U index to values calculated using the chained CPI-U index. These changes mean that there is no need to use a non-zero value of the parameters_indexing_CPI_offset parameter to characterize current-law policy.

In addition to simplifying the characterization of current-law policy, these changes allow 2023-2034 Tax-Calculator policy parameters values to more closely match those in the most recent CBO projection (see below for details).

These improvements in the projection of future policy parameter values generate a number of changes in expected test results.

In the future, when the growfactors.csv file is generated in the taxdata repository using new CBO projections, the chained CPI-U index should be used (instead of the unchained CPI-U index).

The one-time revision of the ACPIU values in the growfactors.csv file was done by the following AWK script:

# The script patches the 2017-2034 ACPIU values in the growfactors.csv file,
# writing the patched version to standard output.  The patched ACPIU values
# are derived from chained CPI-U index values (rather than unchained CPI-U
# values).  
#
# USAGE: awk -f patch.awk growfactors.csv

BEGIN {
    # input and output are both CSV-formatted files
    FS = ","
    OFS = ","

    # CBO chained CPI-U values
    cbo_c_cpiu[2021] = 144.81409
    cbo_c_cpiu[2022] = 149.06351
    cbo_c_cpiu[2023] = 159.84
    cbo_c_cpiu[2024] = 168.47467
    cbo_c_cpiu[2025] = 172.77043
    cbo_c_cpiu[2026] = 176.56734
    cbo_c_cpiu[2027] = 180.2301
    cbo_c_cpiu[2028] = 183.73813
    cbo_c_cpiu[2029] = 187.30592
    cbo_c_cpiu[2030] = 190.98909
    cbo_c_cpiu[2031] = 194.76553
    cbo_c_cpiu[2032] = 198.64294
    cbo_c_cpiu[2033] = 202.61284
    cbo_c_cpiu[2034] = 206.66928
    # The above CBO (chained-CPI) inflation projection is in the CBO tax
    # parameter projection spreadsheet, which is a supplement to the CBO
    # report entitled "The Budget and Economic Outlook."  The most recent
    # supplement is entitled:
    # CBO Tax Parameters and Effective Marginal Tax Rates | Feb 2024
    # and is available at this URL:
    # https://www.cbo.gov/system/files/2024-02/53724-2024-02-Tax-Parameters.xlsx
    #
    # NOTE: the above values are the exact cell values, not the rounded values
    #       presented when the spreadsheet is viewed.

    # assumed constant inflation rate offset for 2017-2021
    # (assumed value will affect only TCJA-reverting parameter values in 2026+)
    irate_offset = -0.0045
}
NR==1 || $1<2017 {
    print $0
    next
}
$1<=2021 {
    unchained_irate = $5 - 1.0
    chained_irate = unchained_irate + irate_offset
    $5 = 1.0 + chained_irate
    print $0
    next
}
$1<=2033 {
    cbo_acpiu = cbo_c_cpiu[$1 + 1] / cbo_c_cpiu[$1]
    $5 = cbo_acpiu
    print $0
    next
}
$1==2034 {
    $5 = 1.02
    print $0
    next
}
codecov[bot] commented 4 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 99.42%. Comparing base (6ababf7) to head (f54bc5b). Report is 1 commits behind head on master.

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/PSLmodels/Tax-Calculator/pull/2732/graphs/tree.svg?width=650&height=150&src=pr&token=KqtTvRSNjQ&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=PSLmodels)](https://app.codecov.io/gh/PSLmodels/Tax-Calculator/pull/2732?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=PSLmodels) ```diff @@ Coverage Diff @@ ## master #2732 +/- ## ======================================= Coverage 99.42% 99.42% ======================================= Files 13 13 Lines 2593 2594 +1 ======================================= + Hits 2578 2579 +1 Misses 15 15 ``` | [Flag](https://app.codecov.io/gh/PSLmodels/Tax-Calculator/pull/2732/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=PSLmodels) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/PSLmodels/Tax-Calculator/pull/2732/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=PSLmodels) | `99.42% <100.00%> (+<0.01%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=PSLmodels#carryforward-flags-in-the-pull-request-comment) to find out more. | [Files](https://app.codecov.io/gh/PSLmodels/Tax-Calculator/pull/2732?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=PSLmodels) | Coverage Δ | | |---|---|---| | [taxcalc/records.py](https://app.codecov.io/gh/PSLmodels/Tax-Calculator/pull/2732?src=pr&el=tree&filepath=taxcalc%2Frecords.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=PSLmodels#diff-dGF4Y2FsYy9yZWNvcmRzLnB5) | `100.00% <100.00%> (ø)` | |
jdebacker commented 4 months ago

@bodiyang As a person who has recently released new taxdata created data, can you comment on this PR? Thanks!

bodiyang commented 4 months ago

@martinholmer Thanks for the work on this.

This PR looks good to me, and recommend merging. But I have couple of questions want to check.

(1) How is this PR 2732 related to PR 2731 ?

Do you still have plan to develop cbo2pcl.py, which pull the tax parameters from CBO spreadsheet to Tax-Calculator? (I've seen you mentioned this path has conflict with Tax-Calculator's structure.)

So is this PR the alternative plan for cbo2pcl.py to update tax parameters in future years? ~ So to speak, we will only adopt the C-CPIU from the CBO spreadsheet and calculate the inflation rate by growfactors.py and then implement the inflation rate upon Tax-Calculator policy parameters?

(2) I see this PR only update the policy parameter values for the year 2026 in policy_current_law.json

But is it our goal to update tax parameters to all future years (till 2034), based on the inflation rate calculated by C-CPIU?

(3) I see you use an AWK script (where the C-CPIU value is hard coded) to do the update for this time. Would you recommend we create a script to automate this process, to pull the value from CBO spreadsheet and write into growthfactor.csv?

So next time CBO has a new publication of this tax parameters spreadsheet, we can just run the script and make the update.

~ I would be glad to work / help on this if necessary.

Thank you, Bodi Yang

martinholmer commented 4 months ago

@bodiyang, Thanks for your review of Tax-Calculator PR #2732. Let me answer your questions one at a time.

(1) How is this PR 2732 related to https://github.com/PSLmodels/Tax-Calculator/pull/2731?

Do you still have plan to develop cbo2pcl.py, which pull the tax parameters from CBO spreadsheet to Tax-Calculator? (I've seen you mentioned this path has conflict with Tax-Calculator's structure.)

No. PR #2731 was a bad idea.

So is this PR the alternative plan for cbo2pcl.py to update tax parameters in future years? ~ So to speak, we will only adopt the C-CPIU from the CBO spreadsheet and calculate the inflation rate by growfactors.py and then implement the inflation rate upon Tax-Calculator policy parameters?

Yes, that is the idea.

(2) I see this PR only update the policy parameter values for the year 2026 in policy_current_law.json

The new 2026 values for TCJA-reverting policy parameters are generated using the ppp.py script as always. The values are different because the chained-CPI inflation rates now being used are more accurate than when they were approximated by a constant value for the parameter_indexing_CPI_offset parameter.

But is it our goal to update tax parameters to all future years (till 2034), based on the inflation rate calculated by C-CPIU?

Yes, but that is done automatically by the Policy class. So, there is nothing else for us to do.

(3) I see you use an AWK script (where the C-CPIU value is hard coded) to do the update for this time. Would you recommend we create a script to automate this process, to pull the [chained-CPI] value[s] from CBO spreadsheet and write into growthfactor.csv?

Yes. Look at the Python code in the closed PR #2731 to see how I extracted information from the downloaded CBO spreadsheet.

So next time CBO has a new publication of this tax parameters spreadsheet, we can just run the script and make the update.

Yes, but you would need to check the new CBO spreadsheet to make sure it was consistent with your script. Again, look at the cbo2clp.py in #2731 to see how I did that.

~ I would be glad to work / help on this if necessary.

That is great news! Perhaps the first thing you could do would be to add an issue to the taxdata repository that describes what needs to be done differently in early 2025 (when updating to the new CBO projection) than what was done in past years (including this year).

Let me know if you have any questions on any of these matters.
If you cc me in your taxdata comment, I'll be happy to review it.

jdebacker commented 4 months ago

@bodiyang Thanks for these great questions to clarify the changes

@martinholmer Thank you for your PR. This is very helpful to improve the accuracy of Tax-Calculator.