From 5bb6097890fe55d48db977bdb124cf2dad938101 Mon Sep 17 00:00:00 2001 From: LeqiGogo <100904908+LeqiGogo@users.noreply.github.com> Date: Wed, 15 Nov 2023 14:45:38 -0600 Subject: [PATCH] Decouple California CDCC calculation from ARPA in 2021 (#3224) * Decouple California CDCC calculation from ARPA in 2021 Fixes #2060 * Decouple California CDCC calculation from ARPA in 2021 Fixes #2060 * California cdcc * Decouple California CDCC calculation from ARPA in 2021 Fixes #2060 * Update policyengine_us/variables/gov/states/ca/tax/income/credits/ca_federal_capped_cdcc.py * Decouple California CDCC calculation from ARPA in 2021 Fixes #2060 * Decouple California CDCC calculation from ARPA in 2021 Fixes #2060 * Decouple California CDCC calculation from ARPA in 2021 Fixes #2060 * format --------- Co-authored-by: Pavel Makarchuk <110687043+PavelMakarchuk@users.noreply.github.com> --- changelog_entry.yaml | 4 + .../credits/child_dependent_care/input.yaml | 15 ++++ .../states/ca/tax/income/credits/ca_cdcc.yaml | 35 -------- .../credits/child_dependent_care/ca_cdcc.yaml | 79 +++++++++++++++++++ .../child_dependent_care/ca_cdcc_rate.yaml | 47 +++++++++++ .../ca_cdcc_relevant_expenses.yaml | 49 ++++++++++++ .../ca_federal_capped_cdcc.yaml | 39 +++++++++ .../child_dependent_care/ca_federal_cdcc.yaml | 44 +++++++++++ .../child_dependent_care/integration.yaml | 48 +++++++++++ .../states/ca/tax/income/credits/ca_cdcc.py | 2 +- .../ca/tax/income/credits/ca_cdcc_rate.py | 39 +++++++++ .../credits/ca_cdcc_relevant_expenses.py | 31 ++++++++ .../income/credits/ca_federal_capped_cdcc.py | 22 ++++++ .../ca/tax/income/credits/ca_federal_cdcc.py | 17 ++++ .../gov/states/tax/income/state_income_tax.py | 2 +- 15 files changed, 436 insertions(+), 37 deletions(-) create mode 100644 policyengine_us/parameters/gov/states/ca/tax/income/credits/child_dependent_care/input.yaml delete mode 100644 policyengine_us/tests/policy/baseline/gov/states/ca/tax/income/credits/ca_cdcc.yaml create mode 100644 policyengine_us/tests/policy/baseline/gov/states/ca/tax/income/credits/child_dependent_care/ca_cdcc.yaml create mode 100644 policyengine_us/tests/policy/baseline/gov/states/ca/tax/income/credits/child_dependent_care/ca_cdcc_rate.yaml create mode 100644 policyengine_us/tests/policy/baseline/gov/states/ca/tax/income/credits/child_dependent_care/ca_cdcc_relevant_expenses.yaml create mode 100644 policyengine_us/tests/policy/baseline/gov/states/ca/tax/income/credits/child_dependent_care/ca_federal_capped_cdcc.yaml create mode 100644 policyengine_us/tests/policy/baseline/gov/states/ca/tax/income/credits/child_dependent_care/ca_federal_cdcc.yaml create mode 100644 policyengine_us/tests/policy/baseline/gov/states/ca/tax/income/credits/child_dependent_care/integration.yaml create mode 100644 policyengine_us/variables/gov/states/ca/tax/income/credits/ca_cdcc_rate.py create mode 100644 policyengine_us/variables/gov/states/ca/tax/income/credits/ca_cdcc_relevant_expenses.py create mode 100644 policyengine_us/variables/gov/states/ca/tax/income/credits/ca_federal_capped_cdcc.py create mode 100644 policyengine_us/variables/gov/states/ca/tax/income/credits/ca_federal_cdcc.py diff --git a/changelog_entry.yaml b/changelog_entry.yaml index e69de29bb2d..63b647384ad 100644 --- a/changelog_entry.yaml +++ b/changelog_entry.yaml @@ -0,0 +1,4 @@ +- bump: minor + changes: + added: + - Replicated Child and Dependent Care Expenses Credit to include California limitations. diff --git a/policyengine_us/parameters/gov/states/ca/tax/income/credits/child_dependent_care/input.yaml b/policyengine_us/parameters/gov/states/ca/tax/income/credits/child_dependent_care/input.yaml new file mode 100644 index 00000000000..16e792eb2a8 --- /dev/null +++ b/policyengine_us/parameters/gov/states/ca/tax/income/credits/child_dependent_care/input.yaml @@ -0,0 +1,15 @@ +description: California uses this input for the state child/dependent care credit, based on year. +values: + 2012-01-01: + - cdcc + 2021-01-01: + - ca_federal_capped_cdcc + 2022-01-01: + - cdcc +metadata: + unit: list + period: year + label: California child/dependent care credit input + reference: + - title: Details of Public Law 117-2, section 9631 + href: https://www.ftb.ca.gov/about-ftb/data-reports-plans/Summary-of-Federal-Income-Tax-Changes/index.html#PL-117-2-9631 diff --git a/policyengine_us/tests/policy/baseline/gov/states/ca/tax/income/credits/ca_cdcc.yaml b/policyengine_us/tests/policy/baseline/gov/states/ca/tax/income/credits/ca_cdcc.yaml deleted file mode 100644 index e6e7bc6151b..00000000000 --- a/policyengine_us/tests/policy/baseline/gov/states/ca/tax/income/credits/ca_cdcc.yaml +++ /dev/null @@ -1,35 +0,0 @@ -- name: Filer with AGI above $100,000 is not eligible. - period: 2021 - input: - state_code: CA - adjusted_gross_income: 100_001 - cdcc: 1_000 - output: - ca_cdcc: 0 - -- name: Filer with income at the 50% match level. - period: 2021 - input: - state_code: CA - adjusted_gross_income: 1_000 - cdcc: 1_000 - output: - ca_cdcc: 500 - -- name: Filer with income at the 43% match level. - period: 2021 - input: - state_code: CA - adjusted_gross_income: 50_000 - cdcc: 1_000 - output: - ca_cdcc: 430 - -- name: Filer with negative AGI gets a 50% match. - period: 2021 - input: - state_code: CA - adjusted_gross_income: -50_000 - cdcc: 1_000 - output: - ca_cdcc: 500 diff --git a/policyengine_us/tests/policy/baseline/gov/states/ca/tax/income/credits/child_dependent_care/ca_cdcc.yaml b/policyengine_us/tests/policy/baseline/gov/states/ca/tax/income/credits/child_dependent_care/ca_cdcc.yaml new file mode 100644 index 00000000000..3cbbe67213b --- /dev/null +++ b/policyengine_us/tests/policy/baseline/gov/states/ca/tax/income/credits/child_dependent_care/ca_cdcc.yaml @@ -0,0 +1,79 @@ +- name: 2021 filer with AGI above $100,000 is not eligible. + period: 2021 + input: + state_code: CA + adjusted_gross_income: 100_001 + cdcc: 0 + ca_federal_capped_cdcc: 1_000 + output: + ca_cdcc: 0 + +- name: 2021 filer with income at the 50% match level. + period: 2021 + input: + state_code: CA + adjusted_gross_income: 1_000 + cdcc: 0 + ca_federal_capped_cdcc: 1_000 + output: + ca_cdcc: 500 + +- name: 2021 filer with income at the 43% match level. + period: 2021 + input: + state_code: CA + adjusted_gross_income: 50_000 + cdcc: 0 + ca_federal_capped_cdcc: 1_000 + output: + ca_cdcc: 430 + +- name: 2021 filer with negative AGI gets a 50% match. + period: 2021 + input: + state_code: CA + adjusted_gross_income: -50_000 + cdcc: 0 + ca_federal_capped_cdcc: 1_000 + output: + ca_cdcc: 500 + +- name: 2022 filer with AGI above $100,000 is not eligible. + period: 2022 + input: + state_code: CA + adjusted_gross_income: 100_001 + cdcc: 1_000 + ca_federal_capped_cdcc: 0 + output: + ca_cdcc: 0 + +- name: 2022 filer with income at the 50% match level. + period: 2022 + input: + state_code: CA + adjusted_gross_income: 1_000 + cdcc: 1_000 + ca_federal_capped_cdcc: 0 + output: + ca_cdcc: 500 + +- name: 2022 filer with income at the 43% match level. + period: 2022 + input: + state_code: CA + adjusted_gross_income: 50_000 + cdcc: 1_000 + ca_federal_capped_cdcc: 0 + output: + ca_cdcc: 430 + +- name: 2022 filer with negative AGI gets a 50% match. + period: 2022 + input: + state_code: CA + adjusted_gross_income: -50_000 + cdcc: 1_000 + ca_federal_capped_cdcc: 0 + output: + ca_cdcc: 500 diff --git a/policyengine_us/tests/policy/baseline/gov/states/ca/tax/income/credits/child_dependent_care/ca_cdcc_rate.yaml b/policyengine_us/tests/policy/baseline/gov/states/ca/tax/income/credits/child_dependent_care/ca_cdcc_rate.yaml new file mode 100644 index 00000000000..50706f44577 --- /dev/null +++ b/policyengine_us/tests/policy/baseline/gov/states/ca/tax/income/credits/child_dependent_care/ca_cdcc_rate.yaml @@ -0,0 +1,47 @@ +- name: test 1 + period: 2019 + input: + state_code: CA + adjusted_gross_income: 100_000 + output: + ca_cdcc_rate: 0.2 + +- name: test 2 + period: 2021 + input: + state_code: CA + adjusted_gross_income: 100_000 + output: + ca_cdcc_rate: 0.2 + +- name: test 3 + period: 2022 + input: + state_code: CA + adjusted_gross_income: 100_000 + output: + ca_cdcc_rate: 0.2 + +- name: test 4 + period: 2022 + input: + state_code: CA + adjusted_gross_income: 45_000 + output: + ca_cdcc_rate: 0.2 + +- name: test 5 + period: 2022 + input: + state_code: CA + adjusted_gross_income: 35_000 + output: + ca_cdcc_rate: 0.25 + +- name: test 6 + period: 2022 + input: + state_code: CA + adjusted_gross_income: 15_000 + output: + ca_cdcc_rate: 0.35 diff --git a/policyengine_us/tests/policy/baseline/gov/states/ca/tax/income/credits/child_dependent_care/ca_cdcc_relevant_expenses.yaml b/policyengine_us/tests/policy/baseline/gov/states/ca/tax/income/credits/child_dependent_care/ca_cdcc_relevant_expenses.yaml new file mode 100644 index 00000000000..757fc4d9950 --- /dev/null +++ b/policyengine_us/tests/policy/baseline/gov/states/ca/tax/income/credits/child_dependent_care/ca_cdcc_relevant_expenses.yaml @@ -0,0 +1,49 @@ +- name: test 1 + period: 2019 + input: + state_code: CA + tax_unit_childcare_expenses: 10_000 + count_cdcc_eligible: 1 + min_head_spouse_earned: 50_000 + output: + ca_cdcc_relevant_expenses: 3_000 + +- name: test 2 + period: 2021 + input: + state_code: CA + tax_unit_childcare_expenses: 10_000 + count_cdcc_eligible: 1 + min_head_spouse_earned: 50_000 + output: + ca_cdcc_relevant_expenses: 3_000 + +- name: test 3 + period: 2022 + input: + state_code: CA + tax_unit_childcare_expenses: 10_000 + count_cdcc_eligible: 1 + min_head_spouse_earned: 50_000 + output: + ca_cdcc_relevant_expenses: 3_000 + +- name: test 4 + period: 2022 + input: + state_code: CA + tax_unit_childcare_expenses: 20_000 + count_cdcc_eligible: 3 + min_head_spouse_earned: 50_000 + output: + ca_cdcc_relevant_expenses: 6_000 + +- name: test 5 + period: 2022 + input: + state_code: CA + tax_unit_childcare_expenses: 35_000 + count_cdcc_eligible: 4 + min_head_spouse_earned: 40_000 + output: + ca_cdcc_relevant_expenses: 6_000 diff --git a/policyengine_us/tests/policy/baseline/gov/states/ca/tax/income/credits/child_dependent_care/ca_federal_capped_cdcc.yaml b/policyengine_us/tests/policy/baseline/gov/states/ca/tax/income/credits/child_dependent_care/ca_federal_capped_cdcc.yaml new file mode 100644 index 00000000000..ab507fcb3fa --- /dev/null +++ b/policyengine_us/tests/policy/baseline/gov/states/ca/tax/income/credits/child_dependent_care/ca_federal_capped_cdcc.yaml @@ -0,0 +1,39 @@ +- name: test 1 + period: 2019 + input: + state_code: CA + ca_federal_cdcc: 1_500 + income_tax_before_credits: 5_000 + foreign_tax_credit: 0 + output: + ca_federal_capped_cdcc: 1_500 + +- name: test 2 + period: 2021 + input: + state_code: CA + ca_federal_cdcc: 1_500 + income_tax_before_credits: 5_000 + foreign_tax_credit: 0 + output: + ca_federal_capped_cdcc: 1_500 + +- name: test 3 + period: 2022 + input: + state_code: CA + ca_federal_cdcc: 800 + income_tax_before_credits: 5_000 + foreign_tax_credit: 500 + output: + ca_federal_capped_cdcc: 800 + +- name: test 4 + period: 2022 + input: + state_code: CA + ca_federal_cdcc: 1_500 + income_tax_before_credits: 2_000 + foreign_tax_credit: 800 + output: + ca_federal_capped_cdcc: 1_200 diff --git a/policyengine_us/tests/policy/baseline/gov/states/ca/tax/income/credits/child_dependent_care/ca_federal_cdcc.yaml b/policyengine_us/tests/policy/baseline/gov/states/ca/tax/income/credits/child_dependent_care/ca_federal_cdcc.yaml new file mode 100644 index 00000000000..3f31e2da7e3 --- /dev/null +++ b/policyengine_us/tests/policy/baseline/gov/states/ca/tax/income/credits/child_dependent_care/ca_federal_cdcc.yaml @@ -0,0 +1,44 @@ +- name: test 1 + period: 2019 + input: + state_code: CA + ca_cdcc_relevant_expenses: 6_000 + ca_cdcc_rate: 0.25 + output: + ca_federal_cdcc: 1_500 + +- name: test 2 + period: 2021 + input: + state_code: CA + ca_cdcc_relevant_expenses: 6_000 + ca_cdcc_rate: 0.25 + output: + ca_federal_cdcc: 1_500 + +- name: test 3 + period: 2022 + input: + state_code: CA + ca_cdcc_relevant_expenses: 6_000 + ca_cdcc_rate: 0.25 + output: + ca_federal_cdcc: 1_500 + +- name: test 4 + period: 2022 + input: + state_code: CA + ca_cdcc_relevant_expenses: 4_000 + ca_cdcc_rate: 0.2 + output: + ca_federal_cdcc: 800 + +- name: test 5 + period: 2022 + input: + state_code: CA + ca_cdcc_relevant_expenses: 3_000 + ca_cdcc_rate: 0.35 + output: + ca_federal_cdcc: 1_050 diff --git a/policyengine_us/tests/policy/baseline/gov/states/ca/tax/income/credits/child_dependent_care/integration.yaml b/policyengine_us/tests/policy/baseline/gov/states/ca/tax/income/credits/child_dependent_care/integration.yaml new file mode 100644 index 00000000000..d92eab436c9 --- /dev/null +++ b/policyengine_us/tests/policy/baseline/gov/states/ca/tax/income/credits/child_dependent_care/integration.yaml @@ -0,0 +1,48 @@ +- name: Tax unit with taxsimid 37810 in g21.its.csv and g21.ots.csv + absolute_error_margin: 0.01 + period: 2021 + input: + people: + person1: + is_tax_unit_head: true + age: 58 + employment_income: 74_010 + taxable_interest_income: 11_010 + taxable_private_pension_income: 10_000 + social_security: 2_000 + rent: 9_000 + ssi: 0 # not in TAXSIM35 + state_supplement: 0 # not in TAXSIM35 + wic: 0 # not in TAXSIM35 + person2: + age: 11 + ssi: 0 # not in TAXSIM35 + state_supplement: 0 # not in TAXSIM35 + wic: 0 # not in TAXSIM35 + person3: + age: 11 + ssi: 0 # not in TAXSIM35 + state_supplement: 0 # not in TAXSIM35 + wic: 0 # not in TAXSIM35 + person4: + 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] + snap: 0 # not in TAXSIM35 + tanf: 0 # not in TAXSIM35 + tax_units: + tax_unit: + members: [person1, person2, person3, person4] + tax_unit_childcare_expenses: 10_000 + premium_tax_credit: 0 # not in TAXSIM35 + ca_use_tax: 0 # not in TAXSIM35 + households: + household: + members: [person1, person2, person3, person4] + state_code: CA + output: # expected results from patched TAXSIM35 2023-03-28 version + ca_cdcc: 408 diff --git a/policyengine_us/variables/gov/states/ca/tax/income/credits/ca_cdcc.py b/policyengine_us/variables/gov/states/ca/tax/income/credits/ca_cdcc.py index f289554ed7c..36c9943865b 100644 --- a/policyengine_us/variables/gov/states/ca/tax/income/credits/ca_cdcc.py +++ b/policyengine_us/variables/gov/states/ca/tax/income/credits/ca_cdcc.py @@ -17,6 +17,6 @@ def formula(tax_unit, period, parameters): period ).gov.states.ca.tax.income.credits.child_dependent_care agi = tax_unit("adjusted_gross_income", period) - federal_cdcc = tax_unit("cdcc", period) + federal_cdcc = add(tax_unit, period, p.input) rate = p.rate.calc(agi) return federal_cdcc * rate diff --git a/policyengine_us/variables/gov/states/ca/tax/income/credits/ca_cdcc_rate.py b/policyengine_us/variables/gov/states/ca/tax/income/credits/ca_cdcc_rate.py new file mode 100644 index 00000000000..c9cbe410c5a --- /dev/null +++ b/policyengine_us/variables/gov/states/ca/tax/income/credits/ca_cdcc_rate.py @@ -0,0 +1,39 @@ +from policyengine_us.model_api import * + + +class ca_cdcc_rate(Variable): + value_type = float + entity = TaxUnit + label = "CDCC credit rate replicated to include California limitations" + unit = USD + definition_period = YEAR + reference = "https://www.ftb.ca.gov/about-ftb/data-reports-plans/Summary-of-Federal-Income-Tax-Changes/index.html#PL-117-2-9631" + defined_for = StateCode.CA + + def formula(tax_unit, period, parameters): + agi = tax_unit("adjusted_gross_income", period) + + year = period.start.year + if year == 2021: + period_adjusted = f"{year-1}-01-01" + else: + period_adjusted = f"{year}-01-01" + + p = parameters(period_adjusted).gov.irs.credits.cdcc + + # First phase-out + excess_agi = max_(0, agi - p.phase_out.start) # start + increments = np.ceil(excess_agi / p.phase_out.increment) + percentage_reduction = increments * p.phase_out.rate + phased_out_rate = max_( + p.phase_out.min, p.phase_out.max - percentage_reduction # max + ) + + # Second phase-out + second_excess_agi = max_( + 0, agi - p.phase_out.second_start + ) # second_start + second_increments = np.ceil(second_excess_agi / p.phase_out.increment) + second_percentage_reduction = second_increments * p.phase_out.rate + + return max_(0, phased_out_rate - second_percentage_reduction) diff --git a/policyengine_us/variables/gov/states/ca/tax/income/credits/ca_cdcc_relevant_expenses.py b/policyengine_us/variables/gov/states/ca/tax/income/credits/ca_cdcc_relevant_expenses.py new file mode 100644 index 00000000000..d0e6749d08b --- /dev/null +++ b/policyengine_us/variables/gov/states/ca/tax/income/credits/ca_cdcc_relevant_expenses.py @@ -0,0 +1,31 @@ +from policyengine_us.model_api import * + + +class ca_cdcc_relevant_expenses(Variable): + value_type = float + entity = TaxUnit + label = "CDCC-relevant care expenses replicated to include California limitations" + unit = USD + definition_period = YEAR + reference = "https://www.ftb.ca.gov/about-ftb/data-reports-plans/Summary-of-Federal-Income-Tax-Changes/index.html#PL-117-2-9631" + defined_for = StateCode.CA + + def formula(tax_unit, period, parameters): + year = period.start.year + if year == 2021: + period_adjusted = f"{year-1}-01-01" + else: + period_adjusted = f"{year}-01-01" + + # First, cap based on the number of eligible care receivers + expenses = tax_unit("tax_unit_childcare_expenses", period) + cdcc = parameters(period_adjusted).gov.irs.credits.cdcc + count_eligible = min_( + cdcc.eligibility.max, tax_unit("count_cdcc_eligible", period) + ) + eligible_capped_expenses = min_(expenses, cdcc.max * count_eligible) + # Then, cap further to the lowest earnings between the taxpayer and spouse + return min_( + eligible_capped_expenses, + tax_unit("min_head_spouse_earned", period), + ) diff --git a/policyengine_us/variables/gov/states/ca/tax/income/credits/ca_federal_capped_cdcc.py b/policyengine_us/variables/gov/states/ca/tax/income/credits/ca_federal_capped_cdcc.py new file mode 100644 index 00000000000..5d4d2637d86 --- /dev/null +++ b/policyengine_us/variables/gov/states/ca/tax/income/credits/ca_federal_capped_cdcc.py @@ -0,0 +1,22 @@ +from policyengine_us.model_api import * + + +class ca_federal_capped_cdcc(Variable): + value_type = float + entity = TaxUnit + label = "Capped child/dependent care credit replicated to include California limitations" + unit = USD + definition_period = YEAR + reference = "https://www.ftb.ca.gov/forms/2020/2020-3506-instructions.html" + defined_for = StateCode.CA + + def formula(tax_unit, period, parameters): + cdcc = tax_unit("ca_federal_cdcc", period) + p = parameters(period).gov.irs.credits + # follow Credit Limit Worksheet in 2022 Form 2441 instructions: + itaxbc = tax_unit("income_tax_before_credits", period) # WS Line1 + # Excess Advance PTC Repayment (Form 8962) assumed zero in above line + offset = tax_unit("foreign_tax_credit", period) + # Partner Additional Reporting Year Tax (Form 8978) assumed zero above + cap = max_(itaxbc - offset, 0) # WS Line 2 + return min_(cdcc, cap) # WS Line 3 diff --git a/policyengine_us/variables/gov/states/ca/tax/income/credits/ca_federal_cdcc.py b/policyengine_us/variables/gov/states/ca/tax/income/credits/ca_federal_cdcc.py new file mode 100644 index 00000000000..cad9581ed92 --- /dev/null +++ b/policyengine_us/variables/gov/states/ca/tax/income/credits/ca_federal_cdcc.py @@ -0,0 +1,17 @@ +from policyengine_us.model_api import * + + +class ca_federal_cdcc(Variable): + value_type = float + entity = TaxUnit + label = "Child and Dependent Care Expenses Credit replicated to include California limitations" + unit = USD + documentation = "https://www.ftb.ca.gov/about-ftb/data-reports-plans/Summary-of-Federal-Income-Tax-Changes/index.html#PL-117-2-9631" + definition_period = YEAR + defined_for = StateCode.CA + + def formula(tax_unit, period, parameters): + relevant_expenses = tax_unit("ca_cdcc_relevant_expenses", period) + credit_rate = tax_unit("ca_cdcc_rate", period) + + return relevant_expenses * credit_rate diff --git a/policyengine_us/variables/gov/states/tax/income/state_income_tax.py b/policyengine_us/variables/gov/states/tax/income/state_income_tax.py index b40fb228288..6d685e56bb3 100644 --- a/policyengine_us/variables/gov/states/tax/income/state_income_tax.py +++ b/policyengine_us/variables/gov/states/tax/income/state_income_tax.py @@ -13,7 +13,7 @@ class state_income_tax(Variable): "al_income_tax", "ar_income_tax", "az_income_tax", - "ca_income_tax", + # "ca_income_tax", --- activating will cause circular logic errors # "co_income_tax", --- activating will cause circular logic errors "ct_income_tax", # "dc_income_tax", --- activating will cause circular logic errors