PolicyEngine / policyengine-us

The PolicyEngine US Python package contains a rules engine of the US tax-benefit system, and microdata generation for microsimulation analysis.
https://policyengine.org/us
GNU Affero General Public License v3.0
103 stars 176 forks source link

CTC isn't fully refundable in 2021 #1488

Closed martinholmer closed 1 year ago

martinholmer commented 1 year ago

Pull request #1485, which generated version 0.177.0, causes unintended changes in 2021 US tax liability for tax units with low or zero income tax liability before credits. Essentially the code refactoring in #1485 has rendered the 2021 CTC as not fully refundable, so many low income tax units have higher taxes in version 0.177.0 than they had in version 0.176.0. Also, the 0.176.0 version was in agreement with TAXSIM35 for 2021 low income tax units, but now that agreement has been lost.

Here is a simple 2021 test case that shows the new differences with TAXSIM35:

# PolicyEngine US test file derived from p21.its.csv and p21.ots.csv files
- name: Tax unit with taxsimid 56 from p21.its.csv
  absolute_error_margin: 0.01
  period: 2021
  input:
    people:
      person1:
        is_tax_unit_head: 1
        is_tax_unit_spouse: 0
        is_tax_unit_dependent: 0
        age: 68
        employment_income: 4000
        ssi: 0
        state_supplement: 0
        wic: 0
      person2:
        is_tax_unit_head: 0
        is_tax_unit_spouse: 0
        is_tax_unit_dependent: 1
        age: 11
        ssi: 0
        state_supplement: 0
        wic: 0
      person3:
        is_tax_unit_head: 0
        is_tax_unit_spouse: 0
        is_tax_unit_dependent: 1
        age: 11
        ssi: 0
        state_supplement: 0
        wic: 0
    spm_units:
      spm_unit:
        members: [person1, person2, person3]
        snap: 0
        tanf: 0
    tax_units:
      tax_unit:
        members: [person1, person2, person3]
        premium_tax_credit: 0
    households:
      household:
        members: [person1, person2, person3]
        state_code: TX
  output:
    taxsim_tfica: 306.00
    income_tax: -11800.00

And here are the summary results for that test case:

(policyengine-us) US% ../extract_case.sh p21 56
================================= FAILURES ===================================
_______________________________ test session _________________________________
/Users/mrh/work/Policy-Engine-US/US/p21-id56.test.yaml:
  Test 'Tax unit with taxsimid 56 from p21.its.csv':
    income_tax@2021: [-8600.] differs from -11800.0
                     with an absolute margin [3200.] > 0.01
========================= short test summary info ============================
FAILED p21-id56.test.yaml::
============================ 1 failed in 0.90s ===============================
Trace output is in file: p21-id56.test.trace

And finally, here is part of the trace output generated by the test:

(policyengine-us) US% ./trace.sh p21-id56       
income_tax_before_credits<2021, (default)> = [0.]
non_refundable_ctc<2021, (no_salt)> = [3200.]                    <<<<<< SHOULD BE 0
income_tax_non_refundable_credits<2021, (no_salt)> = [3950.]
income_tax_capped_non_refundable_credits<2021, (no_salt)> = [0.]
income_tax_before_refundable_credits<2021, (default)> = [0.]
refundable_ctc<2021, (no_salt)> = [2800.]                        <<<<<< SHOULD BE 6000
eitc<2021, (default)> = [1600.]
rrc_arpa<2021, (no_salt)> = [4200.]
income_tax<2021, (default)> = [-8600.]
MaxGhenis commented 1 year ago

Thanks @martinholmer. In #1485 I introduced a bug that kept the refundable CTC capped at $1,500 in 2021. I've fixed that in #1489, which passes your test and adds unit tests for most CTC variables. It's not quite working fully yet but I'll finish and merge it tomorrow.

martinholmer commented 1 year ago

@MaxGhenis, I'm glad you were able to identify the problem. Your quick response is impressive given you are on the road with so many other things going on.

martinholmer commented 1 year ago

Almost three weeks ago @MaxGhenis said in issue #1488:

In PR #1485 I introduced a bug that kept the refundable CTC capped at $1,500 in 2021. I've fixed that in PR #1489, which passes your [issue #1488] test and adds unit tests for most CTC variables.

@MaxGhenis, can you cherry pick just the #1489 changes that you describe above, put them into a new PR, and merge that new PR? The problem in issue #1488 is blocking progress on both US and MO validation testing as described in issue #993.

MaxGhenis commented 1 year ago

Unfortunately I tried cherrypicking the core fix into #1524, but it didn't immediately work. I think given it involves integrating changes from policyengine-core, we're better off finishing off #1489 (currently Nikhil and my main focus). But if you see a simpler interim solution please let us know.

martinholmer commented 1 year ago

@MaxGhenis, Feel free to ignore my suggestion. It was offered with the thought that it could be easier than resolving whatever are the problems with PR #1489. But if not, keep working on #1489.