Repository: PolicyEngine/policyengine-us

Issue:
Apply the 2020 tax rules to the Oklahoma EITC computation
From the [instructions](https://taxsim.nber.org/historical_state_tax_forms/OK/2023/511-Pkt.pdf):

![Image](https://github.com/user-attachments/assets/d1f18e04-948b-44df-9527-eacd06da1368)

Hints from issue comments:

Solution patch:
diff --git a/changelog_entry.yaml b/changelog_entry.yaml
index e69de29bb2..1f0c44a743 100644
--- a/changelog_entry.yaml
+++ b/changelog_entry.yaml
@@ -0,0 +1,4 @@
+- bump: patch
+  changes:
+    fixes:
+    - Apply the 2020 tax rules to the Oklahoma EITC computation.
diff --git a/policyengine_us/parameters/gov/states/or/tax/income/subtractions/federal_tax_liability/cap/surviving_spouse.yaml b/policyengine_us/parameters/gov/states/or/tax/income/subtractions/federal_tax_liability/cap/surviving_spouse.yaml
index 3ce39a2daa..0294bdde72 100644
--- a/policyengine_us/parameters/gov/states/or/tax/income/subtractions/federal_tax_liability/cap/surviving_spouse.yaml
+++ b/policyengine_us/parameters/gov/states/or/tax/income/subtractions/federal_tax_liability/cap/surviving_spouse.yaml
@@ -91,4 +91,4 @@ brackets:
       2021-01-01: 290_000
     amount:
       values:
-        2021-01-01: 0
\ No newline at end of file
+        2021-01-01: 0
diff --git a/policyengine_us/variables/gov/states/ok/tax/income/credits/eitc/federal_credit/eligible/ok_federal_eitc_demographic_eligible.py b/policyengine_us/variables/gov/states/ok/tax/income/credits/eitc/federal_credit/eligible/ok_federal_eitc_demographic_eligible.py
new file mode 100644
index 0000000000..63a19db870
--- /dev/null
+++ b/policyengine_us/variables/gov/states/ok/tax/income/credits/eitc/federal_credit/eligible/ok_federal_eitc_demographic_eligible.py
@@ -0,0 +1,34 @@
+from policyengine_us.model_api import *
+
+
+class ok_federal_eitc_demographic_eligible(Variable):
+    value_type = bool
+    entity = TaxUnit
+    label = "Meets demographic eligibility for EITC for the Oklahoma EITC computation"
+    definition_period = YEAR
+    reference = (
+        "https://law.justia.com/codes/oklahoma/title-68/section-68-2357-43/"
+    )
+    defined_for = StateCode.OK
+
+    def formula(tax_unit, period, parameters):
+        person = tax_unit.members
+        has_child = tax_unit("eitc_child_count", period) > 0
+        age = person("age", period)
+        # Relative parameter reference break branching in some states that
+        # modify EITC age limits.
+        min_age_non_student = (
+            parameters.gov.irs.credits.eitc.eligibility.age.min(f"2020-01-01")
+        )
+        min_age_student = (
+            parameters.gov.irs.credits.eitc.eligibility.age.min_student(
+                f"2020-01-01"
+            )
+        )
+        student = person("is_full_time_student", period)
+        min_age = where(student, min_age_student, min_age_non_student)
+        max_age = parameters.gov.irs.credits.eitc.eligibility.age.max(
+            f"2020-01-01"
+        )
+        meets_age_requirements = (age >= min_age) & (age <= max_age)
+        return has_child | tax_unit.any(meets_age_requirements)
diff --git a/policyengine_us/variables/gov/states/ok/tax/income/credits/eitc/federal_credit/eligible/ok_federal_eitc_eligible.py b/policyengine_us/variables/gov/states/ok/tax/income/credits/eitc/federal_credit/eligible/ok_federal_eitc_eligible.py
new file mode 100644
index 0000000000..98accdf4b1
--- /dev/null
+++ b/policyengine_us/variables/gov/states/ok/tax/income/credits/eitc/federal_credit/eligible/ok_federal_eitc_eligible.py
@@ -0,0 +1,30 @@
+from policyengine_us.model_api import *
+
+
+class ok_federal_eitc_eligible(Variable):
+    value_type = bool
+    entity = TaxUnit
+    label = "Eligible for federal EITC for the Oklahoma EITC computation"
+    definition_period = YEAR
+    reference = (
+        "https://law.justia.com/codes/oklahoma/title-68/section-68-2357-43/"
+    )
+    defined_for = StateCode.OK
+
+    def formula(tax_unit, period, parameters):
+        eitc = parameters.gov.irs.credits.eitc(f"2020-01-01")
+        investment_income_eligible = tax_unit(
+            "ok_federal_eitc_investment_income_eligible", period
+        )
+        demographic_eligible = tax_unit(
+            "ok_federal_eitc_demographic_eligible", period
+        )
+        # Define eligibility before considering separate filer limitation.
+        eligible = demographic_eligible & investment_income_eligible
+        # This parameter is true if separate filers are eligible.
+        if eitc.eligibility.separate_filer:
+            return eligible
+        # If separate filers are not eligible, check if the filer is separate.
+        filing_status = tax_unit("filing_status", period)
+        separate = filing_status == filing_status.possible_values.SEPARATE
+        return eligible & ~separate
diff --git a/policyengine_us/variables/gov/states/ok/tax/income/credits/eitc/federal_credit/eligible/ok_federal_eitc_investment_income_eligible.py b/policyengine_us/variables/gov/states/ok/tax/income/credits/eitc/federal_credit/eligible/ok_federal_eitc_investment_income_eligible.py
new file mode 100644
index 0000000000..e5f6bcb319
--- /dev/null
+++ b/policyengine_us/variables/gov/states/ok/tax/income/credits/eitc/federal_credit/eligible/ok_federal_eitc_investment_income_eligible.py
@@ -0,0 +1,17 @@
+from policyengine_us.model_api import *
+
+
+class ok_federal_eitc_investment_income_eligible(Variable):
+    value_type = bool
+    entity = TaxUnit
+    label = "Meets investment income eligibility for EITC"
+    definition_period = YEAR
+    reference = (
+        "https://law.justia.com/codes/oklahoma/title-68/section-68-2357-43/"
+    )
+    defined_for = StateCode.OK
+
+    def formula(tax_unit, period, parameters):
+        eitc = parameters.gov.irs.credits.eitc(f"2020-01-01")
+        invinc = tax_unit("eitc_relevant_investment_income", period)
+        return invinc <= eitc.phase_out.max_investment_income
diff --git a/policyengine_us/variables/gov/states/ok/tax/income/credits/eitc/federal_credit/ok_federal_eitc.py b/policyengine_us/variables/gov/states/ok/tax/income/credits/eitc/federal_credit/ok_federal_eitc.py
new file mode 100644
index 0000000000..e8ae0f3ba7
--- /dev/null
+++ b/policyengine_us/variables/gov/states/ok/tax/income/credits/eitc/federal_credit/ok_federal_eitc.py
@@ -0,0 +1,21 @@
+from policyengine_us.model_api import *
+
+
+class ok_federal_eitc(Variable):
+    value_type = float
+    entity = TaxUnit
+    definition_period = YEAR
+    label = "Federal earned income credit for the Oklahoma EITC computation"
+    reference = (
+        "https://law.justia.com/codes/oklahoma/title-68/section-68-2357-43/"
+    )
+    unit = USD
+    defined_for = "ok_federal_eitc_eligible"
+
+    def formula(tax_unit, period, parameters):
+        takes_up_eitc = tax_unit("takes_up_eitc", period)
+        maximum = tax_unit("ok_federal_eitc_maximum", period)
+        phased_in = tax_unit("ok_federal_eitc_phased_in", period)
+        reduction = tax_unit("ok_federal_eitc_reduction", period)
+        limitation = max_(0, maximum - reduction)
+        return min_(phased_in, limitation) * takes_up_eitc
diff --git a/policyengine_us/variables/gov/states/ok/tax/income/credits/eitc/federal_credit/ok_federal_eitc_maximum.py b/policyengine_us/variables/gov/states/ok/tax/income/credits/eitc/federal_credit/ok_federal_eitc_maximum.py
new file mode 100644
index 0000000000..236816f5b7
--- /dev/null
+++ b/policyengine_us/variables/gov/states/ok/tax/income/credits/eitc/federal_credit/ok_federal_eitc_maximum.py
@@ -0,0 +1,18 @@
+from policyengine_us.model_api import *
+
+
+class ok_federal_eitc_maximum(Variable):
+    value_type = float
+    entity = TaxUnit
+    label = "Maximum federal EITC for the Oklahoma EITC computation"
+    definition_period = YEAR
+    reference = (
+        "https://law.justia.com/codes/oklahoma/title-68/section-68-2357-43/"
+    )
+    unit = USD
+    defined_for = StateCode.OK
+
+    def formula(tax_unit, period, parameters):
+        child_count = tax_unit("eitc_child_count", period)
+        eitc = parameters(f"2020-01-01").gov.irs.credits.eitc
+        return eitc.max.calc(child_count)
diff --git a/policyengine_us/variables/gov/states/ok/tax/income/credits/eitc/federal_credit/ok_federal_eitc_phase_in_rate.py b/policyengine_us/variables/gov/states/ok/tax/income/credits/eitc/federal_credit/ok_federal_eitc_phase_in_rate.py
new file mode 100644
index 0000000000..ea712a5c5e
--- /dev/null
+++ b/policyengine_us/variables/gov/states/ok/tax/income/credits/eitc/federal_credit/ok_federal_eitc_phase_in_rate.py
@@ -0,0 +1,19 @@
+from policyengine_us.model_api import *
+
+
+class ok_federal_eitc_phase_in_rate(Variable):
+    value_type = float
+    entity = TaxUnit
+    label = "Federal EITC phase-in rate for the Oklahoma EITC computation"
+    unit = "/1"
+    documentation = "Rate at which the EITC phases in with income."
+    definition_period = YEAR
+    reference = (
+        "https://law.justia.com/codes/oklahoma/title-68/section-68-2357-43/"
+    )
+    defined_for = StateCode.OK
+
+    def formula(tax_unit, period, parameters):
+        child_count = tax_unit("eitc_child_count", period)
+        eitc = parameters(f"2020-01-01").gov.irs.credits.eitc
+        return eitc.phase_in_rate.calc(child_count)
diff --git a/policyengine_us/variables/gov/states/ok/tax/income/credits/eitc/federal_credit/ok_federal_eitc_phase_out_rate.py b/policyengine_us/variables/gov/states/ok/tax/income/credits/eitc/federal_credit/ok_federal_eitc_phase_out_rate.py
new file mode 100644
index 0000000000..d7c38e1401
--- /dev/null
+++ b/policyengine_us/variables/gov/states/ok/tax/income/credits/eitc/federal_credit/ok_federal_eitc_phase_out_rate.py
@@ -0,0 +1,18 @@
+from policyengine_us.model_api import *
+
+
+class ok_federal_eitc_phase_out_rate(Variable):
+    value_type = float
+    entity = TaxUnit
+    label = "Federal EITC phase-out rate for the Oklahoma EITC computation"
+    unit = USD
+    definition_period = YEAR
+    reference = (
+        "https://law.justia.com/codes/oklahoma/title-68/section-68-2357-43/"
+    )
+    defined_for = StateCode.OK
+
+    def formula(tax_unit, period, parameters):
+        eitc = parameters(f"2020-01-01").gov.irs.credits.eitc
+        num_children = tax_unit("eitc_child_count", period)
+        return eitc.phase_out.rate.calc(num_children)
diff --git a/policyengine_us/variables/gov/states/ok/tax/income/credits/eitc/federal_credit/ok_federal_eitc_phase_out_start.py b/policyengine_us/variables/gov/states/ok/tax/income/credits/eitc/federal_credit/ok_federal_eitc_phase_out_start.py
new file mode 100644
index 0000000000..921c40f7a9
--- /dev/null
+++ b/policyengine_us/variables/gov/states/ok/tax/income/credits/eitc/federal_credit/ok_federal_eitc_phase_out_start.py
@@ -0,0 +1,21 @@
+from policyengine_us.model_api import *
+
+
+class ok_federal_eitc_phase_out_start(Variable):
+    value_type = float
+    entity = TaxUnit
+    label = "Federal EITC phase-out start for the Oklahoma EITC computation"
+    unit = USD
+    definition_period = YEAR
+    reference = (
+        "https://law.justia.com/codes/oklahoma/title-68/section-68-2357-43/"
+    )
+    defined_for = StateCode.OK
+
+    def formula(tax_unit, period, parameters):
+        count_children = tax_unit("eitc_child_count", period)
+        eitc = parameters(f"2020-01-01").gov.irs.credits.eitc
+        is_joint = tax_unit("tax_unit_is_joint", period)
+        joint_bonus = eitc.phase_out.joint_bonus.calc(count_children)
+        phase_out_start = eitc.phase_out.start.calc(count_children)
+        return phase_out_start + is_joint * joint_bonus
diff --git a/policyengine_us/variables/gov/states/ok/tax/income/credits/eitc/federal_credit/ok_federal_eitc_phased_in.py b/policyengine_us/variables/gov/states/ok/tax/income/credits/eitc/federal_credit/ok_federal_eitc_phased_in.py
new file mode 100644
index 0000000000..567aac0608
--- /dev/null
+++ b/policyengine_us/variables/gov/states/ok/tax/income/credits/eitc/federal_credit/ok_federal_eitc_phased_in.py
@@ -0,0 +1,18 @@
+from policyengine_us.model_api import *
+
+
+class ok_federal_eitc_phased_in(Variable):
+    value_type = float
+    entity = TaxUnit
+    label = "Federal EITC phase-in amount for the Oklahoma EITC computation"
+    unit = USD
+    documentation = "EITC maximum amount, taking into account earnings."
+    definition_period = YEAR
+    defined_for = StateCode.OK
+
+    def formula(tax_unit, period, parameters):
+        maximum = tax_unit("ok_federal_eitc_maximum", period)
+        phase_in_rate = tax_unit("ok_federal_eitc_phase_in_rate", period)
+        earnings = tax_unit("filer_adjusted_earnings", period)
+        phased_in_amount = earnings * phase_in_rate
+        return min_(maximum, phased_in_amount)
diff --git a/policyengine_us/variables/gov/states/ok/tax/income/credits/eitc/federal_credit/ok_federal_eitc_reduction.py b/policyengine_us/variables/gov/states/ok/tax/income/credits/eitc/federal_credit/ok_federal_eitc_reduction.py
new file mode 100644
index 0000000000..bcc96058bd
--- /dev/null
+++ b/policyengine_us/variables/gov/states/ok/tax/income/credits/eitc/federal_credit/ok_federal_eitc_reduction.py
@@ -0,0 +1,22 @@
+from policyengine_us.model_api import *
+
+
+class ok_federal_eitc_reduction(Variable):
+    value_type = float
+    entity = TaxUnit
+    label = "Federal EITC reduction for the Oklahoma EITC computation"
+    unit = USD
+    definition_period = YEAR
+    reference = (
+        "https://law.justia.com/codes/oklahoma/title-68/section-68-2357-43/"
+    )
+    defined_for = StateCode.OK
+
+    def formula(tax_unit, period, parameters):
+        earnings = tax_unit("filer_adjusted_earnings", period)
+        agi = tax_unit("adjusted_gross_income", period)
+        highest_income_variable = max_(earnings, agi)
+        phase_out_start = tax_unit("ok_federal_eitc_phase_out_start", period)
+        phase_out_rate = tax_unit("ok_federal_eitc_phase_out_rate", period)
+        phase_out_region = max_(0, highest_income_variable - phase_out_start)
+        return phase_out_rate * phase_out_region
diff --git a/policyengine_us/variables/gov/states/ok/tax/income/credits/ok_eitc.py b/policyengine_us/variables/gov/states/ok/tax/income/credits/eitc/ok_eitc.py
similarity index 93%
rename from policyengine_us/variables/gov/states/ok/tax/income/credits/ok_eitc.py
rename to policyengine_us/variables/gov/states/ok/tax/income/credits/eitc/ok_eitc.py
index 1cb1bcffb2..f283f04246 100644
--- a/policyengine_us/variables/gov/states/ok/tax/income/credits/ok_eitc.py
+++ b/policyengine_us/variables/gov/states/ok/tax/income/credits/eitc/ok_eitc.py
@@ -20,6 +20,6 @@ class ok_eitc(Variable):
         mask = us_agi != 0
         agi_ratio[mask] = ok_agi[mask] / us_agi[mask]
         prorate = min_(1, max_(0, agi_ratio))
-        federal_eitc = tax_unit("eitc", period)
+        federal_eitc = tax_unit("ok_federal_eitc", period)
         p = parameters(period).gov.states.ok.tax.income.credits.earned_income
         return prorate * p.eitc_fraction * federal_eitc


Test patch:
diff --git a/policyengine_us/tests/policy/baseline/gov/states/ok/tax/income/credits/eitc/federal_credit/ok_federal_eitc.yaml b/policyengine_us/tests/policy/baseline/gov/states/ok/tax/income/credits/eitc/federal_credit/ok_federal_eitc.yaml
new file mode 100644
index 0000000000..c674ae9205
--- /dev/null
+++ b/policyengine_us/tests/policy/baseline/gov/states/ok/tax/income/credits/eitc/federal_credit/ok_federal_eitc.yaml
@@ -0,0 +1,10 @@
+- name: Partially phased-in credit
+  period: 2022
+  input:
+    ok_federal_eitc_eligible: true
+    ok_federal_eitc_maximum: 4_000
+    ok_federal_eitc_phased_in: 2_000
+    ok_federal_eitc_reduction: 100
+    state_code: OK
+  output:
+    ok_federal_eitc: 2_000
diff --git a/policyengine_us/tests/policy/baseline/gov/states/ok/tax/income/credits/eitc/federal_credit/ok_federal_eitc_demographic_eligible.yaml b/policyengine_us/tests/policy/baseline/gov/states/ok/tax/income/credits/eitc/federal_credit/ok_federal_eitc_demographic_eligible.yaml
new file mode 100644
index 0000000000..212f9f7de3
--- /dev/null
+++ b/policyengine_us/tests/policy/baseline/gov/states/ok/tax/income/credits/eitc/federal_credit/ok_federal_eitc_demographic_eligible.yaml
@@ -0,0 +1,49 @@
+- name: No children and under 25, not eligible.
+  period: 2022
+  input:
+    age: 24
+    state_code: OK
+  output:
+    ok_federal_eitc_demographic_eligible: false
+
+- name: No children and over 25, ineligible.
+  period: 2022
+  input:
+    age: 25
+  output:
+    ok_federal_eitc_demographic_eligible: false
+
+- name: Children and under 25, eligible.
+  period: 2022
+  input:
+    people:
+      parent:
+        age: 24
+      child:
+        age: 7
+    tax_units:
+      tax_unit:
+        members: [parent, child]
+    households:
+      household: 
+        members: [child, parent]
+        state_code: OK
+  output:
+    ok_federal_eitc_demographic_eligible: true
+
+- name: Non-student in 2021 ineligible at age 19.
+  period: 2021
+  input:
+    age: 19
+    state_code: OK
+  output:
+    ok_federal_eitc_demographic_eligible: false
+
+- name: Student in 2021 not eligible at age 19.
+  period: 2021
+  input:
+    age: 19
+    is_full_time_student: true
+    state_code: OK
+  output:
+    ok_federal_eitc_demographic_eligible: false
diff --git a/policyengine_us/tests/policy/baseline/gov/states/ok/tax/income/credits/eitc/federal_credit/ok_federal_eitc_eligible.yaml b/policyengine_us/tests/policy/baseline/gov/states/ok/tax/income/credits/eitc/federal_credit/ok_federal_eitc_eligible.yaml
new file mode 100644
index 0000000000..08e25b7cd5
--- /dev/null
+++ b/policyengine_us/tests/policy/baseline/gov/states/ok/tax/income/credits/eitc/federal_credit/ok_federal_eitc_eligible.yaml
@@ -0,0 +1,29 @@
+- name: Investment income ineligible.
+  period: 2022
+  input:
+    ok_federal_eitc_investment_income_eligible: false
+    ok_federal_eitc_demographic_eligible: true
+    filing_status: JOINT
+    state_code: OK
+  output:
+    ok_federal_eitc_eligible: false
+
+- name: Demographic ineligible.
+  period: 2022
+  input:
+    ok_federal_eitc_investment_income_eligible: true
+    ok_federal_eitc_demographic_eligible: false
+    filing_status: JOINT
+    state_code: OK
+  output:
+    ok_federal_eitc_eligible: false
+
+- name: Eligible.
+  period: 2022
+  input:
+    ok_federal_eitc_investment_income_eligible: true
+    ok_federal_eitc_demographic_eligible: true
+    filing_status: JOINT
+    state_code: OK
+  output:
+    ok_federal_eitc_eligible: true
diff --git a/policyengine_us/tests/policy/baseline/gov/states/ok/tax/income/credits/eitc/federal_credit/ok_federal_eitc_investment_income_eligible.yaml b/policyengine_us/tests/policy/baseline/gov/states/ok/tax/income/credits/eitc/federal_credit/ok_federal_eitc_investment_income_eligible.yaml
new file mode 100644
index 0000000000..0e7848dc91
--- /dev/null
+++ b/policyengine_us/tests/policy/baseline/gov/states/ok/tax/income/credits/eitc/federal_credit/ok_federal_eitc_investment_income_eligible.yaml
@@ -0,0 +1,15 @@
+- name: Investment income eligible in 2022.
+  period: 2022
+  input:
+    eitc_relevant_investment_income: 3_500
+    state_code: OK
+  output:
+    ok_federal_eitc_investment_income_eligible: true
+
+- name: Investment income ineligible in 2023.
+  period: 2023
+  input:
+    eitc_relevant_investment_income: 11_000
+    state_code: OK
+  output:
+    ok_federal_eitc_investment_income_eligible: false
diff --git a/policyengine_us/tests/policy/baseline/gov/states/ok/tax/income/credits/eitc/federal_credit/ok_federal_eitc_maximum.yaml b/policyengine_us/tests/policy/baseline/gov/states/ok/tax/income/credits/eitc/federal_credit/ok_federal_eitc_maximum.yaml
new file mode 100644
index 0000000000..3973752d17
--- /dev/null
+++ b/policyengine_us/tests/policy/baseline/gov/states/ok/tax/income/credits/eitc/federal_credit/ok_federal_eitc_maximum.yaml
@@ -0,0 +1,39 @@
+- name: Childless EITC maximum.
+  period: 2022
+  absolute_error_margin: 0
+  input:
+    employment_income: 10_000
+    state_code: OK
+  output:
+    ok_federal_eitc_maximum: 538
+
+- name: Childless EITC maximum in 2020
+  period: 2020
+  absolute_error_margin: 0
+  input:
+    employment_income: 10_000
+    state_code: OK
+  output:
+    ok_federal_eitc_maximum: 538
+
+- name: EITC maximum with two children
+  period: 2022
+  absolute_error_margin: 0
+  input:
+    people:
+      child_1:
+        age: 7
+      child_2:
+        age: 7
+      parent:
+        employment_income: 20_000
+        age: 25
+    tax_units:
+      tax_unit:
+        members: [child_1, child_2, parent]
+    households:
+      household: 
+        members: [child_1, child_2, parent]
+        state_code: OK
+  output:
+    ok_federal_eitc_maximum: 5_920
diff --git a/policyengine_us/tests/policy/baseline/gov/states/ok/tax/income/credits/eitc/federal_credit/ok_federal_eitc_reduction.yaml b/policyengine_us/tests/policy/baseline/gov/states/ok/tax/income/credits/eitc/federal_credit/ok_federal_eitc_reduction.yaml
new file mode 100644
index 0000000000..6193922196
--- /dev/null
+++ b/policyengine_us/tests/policy/baseline/gov/states/ok/tax/income/credits/eitc/federal_credit/ok_federal_eitc_reduction.yaml
@@ -0,0 +1,28 @@
+- name: No income, no reduction
+  period: 2022
+  absolute_error_margin: 0
+  input: {}
+  output:
+    ok_federal_eitc_reduction: 0
+
+- name: Two children, full reduction
+  period: 2022
+  absolute_error_margin: 1
+  input:
+    people:
+      child_1:
+        age: 5
+      child_2:
+        age: 5
+      parent:
+        age: 25
+        employment_income: 50_000
+    tax_units:
+      tax_unit:
+        members: [child_1, child_2, parent]
+    households:
+      household: 
+        members: [child_1, child_2, parent]
+        state_code: OK
+  output:
+    ok_federal_eitc_reduction: 6_459
diff --git a/policyengine_us/tests/policy/baseline/gov/states/ok/tax/income/credits/eitc/ok_eitc.yaml b/policyengine_us/tests/policy/baseline/gov/states/ok/tax/income/credits/eitc/ok_eitc.yaml
new file mode 100644
index 0000000000..d77169b7d3
--- /dev/null
+++ b/policyengine_us/tests/policy/baseline/gov/states/ok/tax/income/credits/eitc/ok_eitc.yaml
@@ -0,0 +1,48 @@
+- name: OK eitc unit test 1
+  period: 2021
+  input:
+    adjusted_gross_income: 40_000
+    ok_agi: 30_000
+    ok_federal_eitc: 2_000
+    state_code: OK
+  output:
+    ok_eitc: 2_000 * 0.05 * (30_000 / 40_000)
+
+- name: Integration test
+  absolute_error_margin: 2
+  period: 2024
+  input:
+    people:
+      person1:
+        age: 40
+        employment_income: 20000
+        ssi: 0
+        state_supplement: 0
+        wic: 0
+        deductible_mortgage_interest: 0
+      person2:
+        age: 10
+        employment_income: 1
+        ssi: 0
+        state_supplement: 0
+        wic: 0
+        deductible_mortgage_interest: 0
+    tax_units:
+      tax_unit:
+        members: [person1, person2]
+        tax_unit_childcare_expenses: 0
+        premium_tax_credit: 0
+        local_income_tax: 0
+        state_sales_tax: 0
+    spm_units:
+      spm_unit:
+        members: [person1, person2]
+        snap: 0
+        tanf: 0
+    households:
+      household:
+        members: [person1, person2]
+        state_fips: 40
+  output:
+    ok_eitc: 174
+    ok_income_tax: -239.7
diff --git a/policyengine_us/tests/policy/baseline/gov/states/ok/tax/income/ok_eitc.yaml b/policyengine_us/tests/policy/baseline/gov/states/ok/tax/income/ok_eitc.yaml
deleted file mode 100644
index a5f5ae8f0b..0000000000
--- a/policyengine_us/tests/policy/baseline/gov/states/ok/tax/income/ok_eitc.yaml
+++ /dev/null
@@ -1,9 +0,0 @@
-- name: OK eitc unit test 1
-  period: 2021
-  input:
-    adjusted_gross_income: 40_000
-    ok_agi: 30_000
-    eitc: 2_000
-    state_code: OK
-  output:
-    ok_eitc: 2_000 * 0.05 * (30_000 / 40_000)
diff --git a/policyengine_us/tests/policy/baseline/gov/states/ok/tax/income/ok_integration.yaml b/policyengine_us/tests/policy/baseline/gov/states/ok/tax/income/ok_integration.yaml
index a1a0749a33..bd8f927af4 100644
--- a/policyengine_us/tests/policy/baseline/gov/states/ok/tax/income/ok_integration.yaml
+++ b/policyengine_us/tests/policy/baseline/gov/states/ok/tax/income/ok_integration.yaml
@@ -1,5 +1,5 @@
 - name: Tax unit with taxsimid 55 in p21.its.csv and p21.ots.csv
-  absolute_error_margin: 0.01
+  absolute_error_margin: 1
   period: 2021
   input:
     people:
@@ -26,5 +26,5 @@
         state_code: OK
   output:  # expected results from patched TAXSIM35 2023-03-26 version
     eitc: 1_440.80
-    ok_eitc: 72.04
-    ok_income_tax: -39.74
+    ok_eitc: 14.6
+    ok_income_tax: 17.7