Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in meets_school_meal_categorical_eligibility #5317

Closed
anth-volk opened this issue Nov 8, 2024 · 2 comments · Fixed by #5318
Closed

Bug in meets_school_meal_categorical_eligibility #5317

anth-volk opened this issue Nov 8, 2024 · 2 comments · Fixed by #5318

Comments

@anth-volk
Copy link
Contributor

Visible from this household: https://policyengine.org/us/household?focus=householdOutput.earnings&household=49385

image

A few things to note:

  1. This is immediately reproducible and confirmed across two systems running two different browsers
  2. This is very likely a duplicate of Household scenarios calculate for 2023, even when 2024 is selected policyengine-api#1792, but not 100% sure - here and there, there's a difference of $127 between the line and dot
  3. I believe this issue is separate from the one solved through Shallow copy entities when cloning TaxBenefitSystem instances policyengine-core#288, fix: Shallow copy group_entities and person_entity when cloning TBS policyengine-core#294, and related fixes in the API
@anth-volk
Copy link
Contributor Author

This stems from differing calculations between households with axes and households without on school meal subsidies, particularly the following values (as visible in the "Varying your earnings" component):

  1. Free and reduced price school meals
  2. School meal subsidies per child per day
  3. Reduced price school meals
  4. Free school meals (3 and 4 are exact inverses of each other)
  5. School meal tier (this is an enum, so it's possible that it just erroneously displays 0 for all outputs, but I would expect it to go 0-1-2 for the three tiers)

It's looking like the error will be in the -us code establishing the free and reduced school meal program. If so, will transfer this error to that repo.

@anth-volk anth-volk transferred this issue from PolicyEngine/policyengine-app Nov 8, 2024
@anth-volk anth-volk changed the title Discrepancy between "Varying your earnings" dot and line Bug in meets_school_meal_categorical_eligibility Nov 8, 2024
@anth-volk
Copy link
Contributor Author

The cause of this issue is the following:

  1. meets_school_meal_categorial_eligibility determines whether a household should qualify for free (and not reduced or none) school meals based on the fact that they receive another government program, as opposed to their income
  2. The existing formula takes a scalar, sums its categorial benefits, then (and this is the problem) returns np.any() on the scalar. For all axes that we'd ever pass via the API, where there's a market income of $0 at the bottom end, this scalar will always contain received benefits at the low end, meaning np.any() will always return True.
  3. This, in turn, will give all households (all the way up to $200k a year in market income) a school_meal_tier value of FREE, as opposed to REDUCED (which is where the household in the example at the top of this issue should be) or NONE.
  4. This, then, awards all households free school meals instead of reduced (which is a flat $127 less, hence the common disparity across households around $28k a year in income) or free (which would be like $1,000, but we simulate these households less often).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Closed
Development

Successfully merging a pull request may close this issue.

1 participant