Skip to content
Draft
6 changes: 6 additions & 0 deletions changelog_entry.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
- bump: minor
changes:
added:
- Add Head Start and Early Head Start takeup variables for dataset-driven stochastic modeling
changed:
- Update head_start and early_head_start to use takeup in microsimulation (defaults to True in policy calculator)

This file was deleted.

This file was deleted.

This file was deleted.

8 changes: 0 additions & 8 deletions policyengine_us/variables/gov/aca/aca_take_up_seed.py

This file was deleted.

13 changes: 7 additions & 6 deletions policyengine_us/variables/gov/aca/takes_up_aca_if_eligible.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
class takes_up_aca_if_eligible(Variable):
value_type = bool
entity = TaxUnit
label = "Whether a random eligible SPM unit does not claim ACA Premium Tax Credit"
label = "Whether an eligible tax unit claims ACA Premium Tax Credit"
documentation = (
"Generated stochastically in the dataset using take-up rates. "
"No formula - purely deterministic rules engine."
)
definition_period = YEAR

def formula(tax_unit, period, parameters):
seed = tax_unit("aca_take_up_seed", period)
takeup_rate = parameters(period).gov.aca.takeup_rate
return seed < takeup_rate
# For policy calculator (non-dataset), defaults to True (full take-up assumption)
default_value = True
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,18 @@ class early_head_start(Variable):
reference = "https://headstart.gov/program-data/article/head-start-program-facts-fiscal-year-2022"

def formula(person, period, parameters):
takes_up = person("takes_up_early_head_start_if_eligible", period)
is_in_microsim = hasattr(person.simulation, "dataset")

p = parameters(period).gov.hhs.head_start.early_head_start
state = person.household("state_code_str", period)
spending = p.spending[state]
enrollment = p.enrollment[state]
mask = enrollment > 0
result = np.zeros_like(p.spending[state])
result[mask] = spending[mask] / enrollment[mask]
return result

if is_in_microsim:
return result * takes_up
else:
return result
9 changes: 8 additions & 1 deletion policyengine_us/variables/gov/hhs/head_start/head_start.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,18 @@ class head_start(Variable):
reference = "https://headstart.gov/program-data/article/head-start-program-facts-fiscal-year-2022"

def formula(person, period, parameters):
takes_up = person("takes_up_head_start_if_eligible", period)
is_in_microsim = hasattr(person.simulation, "dataset")

p = parameters(period).gov.hhs.head_start
state = person.household("state_code_str", period)
spending = p.spending[state]
enrollment = p.enrollment[state]
mask = enrollment > 0
result = np.zeros_like(p.spending[state])
result[mask] = spending[mask] / enrollment[mask]
return result

if is_in_microsim:
return result * takes_up
else:
return result
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from policyengine_us.model_api import *


class takes_up_early_head_start_if_eligible(Variable):
value_type = bool
entity = Person
label = "Whether an eligible person enrolls in Early Head Start"
documentation = (
"Generated stochastically in the dataset using take-up rates. "
"No formula - purely deterministic rules engine."
)
definition_period = YEAR
# For policy calculator (non-dataset), defaults to True (full take-up assumption)
default_value = True
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from policyengine_us.model_api import *


class takes_up_head_start_if_eligible(Variable):
value_type = bool
entity = Person
label = "Whether an eligible person enrolls in Head Start"
documentation = (
"Generated stochastically in the dataset using take-up rates. "
"No formula - purely deterministic rules engine."
)
definition_period = YEAR
# For policy calculator (non-dataset), defaults to True (full take-up assumption)
default_value = True

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
class takes_up_medicaid_if_eligible(Variable):
value_type = bool
entity = Person
label = "Whether a random eligible person unit does not enroll in Medicaid"
label = "Whether an eligible person enrolls in Medicaid"
documentation = (
"Generated stochastically in the dataset using take-up rates. "
"No formula - purely deterministic rules engine."
)
definition_period = YEAR

def formula(person, period, parameters):
seed = person("medicaid_take_up_seed", period)
takeup_rate = parameters(period).gov.hhs.medicaid.takeup_rate
return seed < takeup_rate
# For policy calculator (non-dataset), defaults to True (full take-up assumption)
default_value = True
8 changes: 0 additions & 8 deletions policyengine_us/variables/gov/usda/snap/snap_take_up_seed.py

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
class takes_up_snap_if_eligible(Variable):
value_type = bool
entity = SPMUnit
label = "Whether a random eligible SPM unit does not claim SNAP"
label = "Whether an eligible SPM unit claims SNAP"
documentation = (
"Generated stochastically in the dataset using take-up rates. "
"No formula - purely deterministic rules engine."
)
definition_period = YEAR

def formula(spm_unit, period, parameters):
seed = spm_unit("snap_take_up_seed", period)
takeup_rate = parameters(period).gov.usda.snap.takeup_rate
return seed < takeup_rate
# For policy calculator (non-dataset), defaults to True (full take-up assumption)
default_value = True