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

PA pension exclusion from PA AGI isn't correct #1501

Closed martinholmer closed 1 year ago

martinholmer commented 1 year ago

Following PR #1494, many more of the TAXSIM35 2021 PA validation tests pass. The first failures are in the v21 sample that adds pension income to some of the randomly generated tax units. The differences between the TAXSIM35 results and the PolicyEngine US results indicate that PR #1494 was not correct in excluding all pension income from PA AGI. The key phrase in the following screenshot that TAXSIM35 implements, and PR #1494 does not, is: "after becoming eligible to retire, and retiring".

Screen Shot 2022-11-15 at 10 38 08 AM

The following test case illustrates these v21 sample differences:

- name: Tax unit with taxsimid 17052 in v21.its.csv and v21.ots.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: 34
        employment_income: 18000
        qualified_dividend_income: 4000
        taxable_interest_income: 3000
        short_term_capital_gains: 10000
        long_term_capital_gains: 9000
        taxable_pension_income: 12000
        social_security: 3000
        real_estate_taxes: 23000
        interest_expense: 25000
        ssi: 0  # not in TAXSIM35
        state_supplement: 0  # not in TAXSIM35
        wic: 0  # not in TAXSIM35
      person2:
        is_tax_unit_head: 0
        is_tax_unit_spouse: 0
        is_tax_unit_dependent: 1
        age: 16
        ssi: 0  # not in TAXSIM35
        state_supplement: 0  # not in TAXSIM35
        wic: 0  # not in TAXSIM35
      person3:
        is_tax_unit_head: 0
        is_tax_unit_spouse: 0
        is_tax_unit_dependent: 1
        age: 16
        ssi: 0  # not in TAXSIM35
        state_supplement: 0  # not in TAXSIM35
        wic: 0  # not in TAXSIM35
      person4:
        is_tax_unit_head: 0
        is_tax_unit_spouse: 0
        is_tax_unit_dependent: 1
        age: 16
        ssi: 0  # not in TAXSIM35
        state_supplement: 0  # not in TAXSIM35
        wic: 0  # not in TAXSIM35
      person5:
        is_tax_unit_head: 0
        is_tax_unit_spouse: 0
        is_tax_unit_dependent: 1
        age: 16
        ssi: 0  # not in TAXSIM35
        state_supplement: 0  # not in TAXSIM35
        wic: 0  # not in TAXSIM35
    spm_units:
      spm_unit:
        members: [person1, person2, person3, person4, person5]
        snap: 0  # not in TAXSIM35
        tanf: 0  # not in TAXSIM35
    tax_units:
      tax_unit:
        members: [person1, person2, person3, person4, person5]
        premium_tax_credit: 0  # not in TAXSIM35
        pa_use_tax: 0  # not in TAXSIM35
    households:
      household:
        members: [person1, person2, person3, person4, person5]
        state_code: PA
  output:  # expected results from TAXSIM35
    pa_income_tax: 1719.20
martinholmer commented 1 year ago

Progress on fixing issue #1501 can start after pull request #1505 is merged.