Tax-Calculator icon indicating copy to clipboard operation
Tax-Calculator copied to clipboard

Parameterize IRS rounding rules for indexed parameter values

Open jdebacker opened this issue 3 years ago • 5 comments

Tax-Calculator should parameterize the rounding rules of indexed parameters in policy_current_law.json. There will probably need to be an update to the ParamTools package to handle rounding in the extrapolation of parameters.

The need for rounding has been highlighted in PR #2652, where a new JSON file was created to help with the round-trip-reform test. With out that, all JSON files of past legislative reforms need to be updated to reflect rounding rules in years beyond those affected by the legislative change.

Advantages of building in rounding rules:

  1. Reduce time and errors in maintenance currently required to update rounded parameter values each year
  2. Reduces the size of policy_current_law.json -- it would no longer need to include all values from the first to last known values (currently 2013-2022), but rather just values for any legislative changes
  3. Allows for JSON files representing enacted laws to keep their integrity (no additional year values need to be added for rounded values going beyond the years affected by the legislation -- JSON files represent only the legislative changes)
  4. Improves accuracy of calculations in years beyond the last known year

cc @MattHJensen @hdoupe

jdebacker avatar Mar 31 '22 13:03 jdebacker

Hey @jdebacker , this sounds like a nice enhancement. I think you may be able to implement the new rounding rules on the taxcalc.Parameters class by overriding the extend_func method: https://github.com/PSLmodels/ParamTools/blob/0107eceb4a732e3c0eea32dd83b56ae253d009cb/paramtools/parameters.py#L973-L1020

By default, it rounds to 2 places. But, this method has access to the parameter's name, so you could round it however you'd like.

There's a simpler example in the tests that might make it a little easier to see how the method works: https://github.com/PSLmodels/ParamTools/blob/0107eceb4a732e3c0eea32dd83b56ae253d009cb/paramtools/tests/test_parameters.py#L2229-L2283

hdoupe avatar Apr 06 '22 11:04 hdoupe

Cool - thanks for the pointers @hdoupe!

jdebacker avatar Apr 06 '22 13:04 jdebacker

Relevant issue over in the ParamTools repo: https://github.com/PSLmodels/ParamTools/issues/130

jdebacker avatar May 10 '22 19:05 jdebacker

Note - will need to record the base year for indexing for each parameter. This can probably be recorded in the parameter metadata in policy_current_law.json

@Peter-Metz do you recall doing any research on the base years for each parameter that can be used for indexing?

jdebacker avatar Jun 24 '22 14:06 jdebacker