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

Incorrect 2021 AMT amount #1279

Open martinholmer opened 2 years ago

martinholmer commented 2 years ago

Issue #1225 has already pointed out that the US AMT parameters have not been specified for the years after 2019. This test case illustrates the consequences of this problem: the case is simulated to have a positive AMT in 2021 ($4054) when neither TAXSIM35 nor USI-Tax-Analyzer generate a positive AMT amount and those two models generate the same US income tax liability of $85,538.

Here is the YAML test file, below which are the test results:

# OpenFisca-US test file derived from r21.ita.csv and r21.ota.csv files
- name: Tax unit with recid 12233 from r21.ita.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: 55
        ssi: 0
        state_supplement: 0
        wic: 0
        employment_income: 177000
        long_term_capital_gains: 100000
      person2:
        is_tax_unit_head: 0
        is_tax_unit_spouse: 1
        is_tax_unit_dependent: 0
        age: 58
        ssi: 0
        state_supplement: 0
        wic: 0
        employment_income: 176000
    spm_units:
      spm_unit:
        members: [person1, person2]
        snap: 0
        tanf: 0
    tax_units:
      tax_unit:
        members: [person1, person2]
        premium_tax_credit: 0
    households:
      household:
        members: [person1, person2]
        state_code: TX
  output:
    taxsim_tfica: 23752.70
    income_tax: 85538.00

The above YAML test file generates the following results:

================================= FAILURES ===================================
_______________________________ test session _________________________________
/Users/mrh/work/r21-id12233.test.yaml:
  Test 'Tax unit with recid 12233 from r21.ita.csv':
    income_tax@2021: [97468.] differs from 85538.0 
      with an absolute margin [11930.] > 0.01
========================= short test summary info ============================
FAILED r21-id12233.test.yaml::
============================== 1 failed in 1.19s ===============================
martinholmer commented 2 years ago

The test in issue #1279 is still failing because, even though some 2021 AMT parameters were added recently in pull request #1457, at least one AMT parameter has not been updated for years after 2019: policyengine_us/parameters/gov/irs/income/amt/exemption/phase_out/start.yaml.

MaxGhenis commented 2 years ago

Thanks @martinholmer - I updated all AMT parameters, and added this test to #1468, but it's still failing. Any ideas?

income_tax@2021: [96554.] differs from 85538.0 with an absolute margin [11016.] > 0.01
martinholmer commented 2 years ago

@MaxGhenis said in issue #1279:

I updated all AMT parameters, and added this test [from issue #1279] to pull request #1468, but it's still failing [with the following results]. Any ideas?

income_tax@2021: [96554.] differs from 85538.0 
   with an absolute margin [11016.] > 0.01

Seems as if my original guess that incorrect 2021 AMT parameter values were the root cause of the tax difference with TAXSIM35 was wrong. Your addition of the 2021 AMT parameters caused only a slight change in PolicyEngine's US income_tax for this test case.

I've confirmed that my USI-Tax-Analyzer model produces the same results for this test case as does TAXSIM35. Both those models produce a zero AMT for this test case, while PolicyEngine produces an AMT amount of $11,016. That accounts for all the income tax difference between the models.

Looking at the alternative_minimum_tax.py code does not indicate anything obvious (because the code is quite long and directly lifted from taxcalc). It would seem as if the cause of this AMT difference goes back to last spring when the alternative_minimum_tax.py code was first added to the model.

As far as what priority fixing this bug should have, let me point out that the CPS has all the income variables used in this test case (employment_income and long-term capital gains), and therefore, this bug is likely to be affecting the CPS results shown on the PolicyEngine website.

In the past when facing similar situations, bugs were identified and corrected when @nikhilwoodruff rewrote the relevant function from the legislation (rather than relying on copied taxcalc code). This approach has resulted in large taxcalc functions being replaced by several finer-grained functions that make tracing and debugging much easier.

MaxGhenis commented 8 months ago

Let's try this integration test again now that we've merged #3907