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
102 stars 175 forks source link

Missing NY state income tax rate schedules #1483

Closed martinholmer closed 1 year ago

martinholmer commented 1 year ago

When comparing 2021 NY income taxes produced by PolicyEngine-US 0.176.0 versus TAXSIM35 10/24/22 version, we get many differences even for simple tax units.

One problem is that the tax calculation logic for tax units with NY AGI of more than $107,650 is missing from PolicyEngine. Going to the URL cited in the NY income tax parameters section of PolicyEngine, we see this:

NYS-incone-tax-schedule

What is missing in PolicyEngine (and present in TAXSIM35) is the tax calculation worksheet logic on pages 52 through 57. Given this, there are many 2021 NY state income tax differences between the two models.

Here is the test case showing the difference between the two models:

# PolicyEngine US test file derived from p21.its.csv and p21.ots.csv files

- name: Tax unit with taxsimid 99902 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: 38
        employment_income: 117000
        ssi: 0
        state_supplement: 0
        wic: 0
      person2:
        is_tax_unit_head: 0
        is_tax_unit_spouse: 1
        is_tax_unit_dependent: 0
        age: 44
        employment_income: 139000
        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
        ny_supplemental_eitc: 0  # to work around a 2021-only TAXSIM35 bug
    households:
      household:
        members: [person1, person2, person3]
        state_code: NY
  output:
    ny_income_tax: 15125.54

The results for the above test case are:

================================= FAILURES ===================================
_______________________________ test session _________________________________
/Users/mrh/work/PolicyEngine-US/NY/p21-id99902.test.yaml:
  Test 'Tax unit with taxsimid 99902 from p21.its.csv':
    ny_income_tax@2021: [14069.755] differs from 15125.5400390625
                        with an absolute margin [1055.7852] > 0.01
========================= short test summary info ============================
FAILED p21-id99902.test.yaml::
============================ 1 failed in 0.76s ===============================
MaxGhenis commented 1 year ago

Hmm we do have some logic for the supplemental tax, maybe it's not getting hooked up to the main tax result?

image
martinholmer commented 1 year ago

@MaxGhenis said in issue #1483:

we do have some logic for the supplemental tax, maybe it's not getting hooked up to the main tax result?

It is "hooked up", but the supplemental parameters are all for 2022 and the supplemental variable's formula is for 2022 and following years only:

from policyengine_us.model_api import *
from policyengine_core.taxscales import MarginalRateTaxScale

class ny_supplemental_tax(Variable):
    value_type = float
    entity = TaxUnit
    label = "NY supplemental income tax"
    unit = USD
    definition_period = YEAR
    defined_for = StateCode.NY

    def formula_2022(tax_unit, period, parameters):
        ny_taxable_income = tax_unit("ny_taxable_income", period)
        ny_agi = tax_unit("ny_agi", period)
        tax = parameters(period).gov.states.ny.tax.income
        sup_tax = tax.supplemental

    ---{SNIP]---
martinholmer commented 1 year ago

On further investigation, NY state legislation Section 601: Imposition of tax contains the supplemental parameters for several years:

Although I did not study closely the legislative language of these three subsections, a cursory glance suggested that maybe the 2021 and 2022 supplemental parameters are the same.