PolicyEngine US is a microsimulation model of the US state and federal tax and benefit system.
To install, run pip install policyengine-us
.
The PolicyEngine US Python package contains a rules engine of the US tax-benefit system, and microdata generation for microsimulation analysis.
Home Page: https://policyengine.org/us
License: GNU Affero General Public License v3.0
This might be premature and introduce a lot of extra typing, but in case we want other tax types down the road (corporate, employer, consumption, carbon, etc.), we may want to add a layer after parameters/tax
, e.g. parameters/tax/personal_income
or parameters/tax/pit
(a common abbreviation referring to Personal Income Tax), or parameters/pit
.
We need to add the following output variables from tax-calculator
:
On the microdata side, we're going to need survey inputs for the different tax variables used as input to tax logic. This will involve essentially trying to replicate taxdata
's process for the CPS. taxdata
uses the same input dataset as us (the CPS), so to do this, we'll need to do the following for every variable in the output dataset:
openfisca-data
in survey_input_variables.py
like this.model_input_variables.py
like this.This should be fairly procedural, but since taxdata
iterates over rows rather than using Pandas (we're using Pandas), there might be instances where iterative approaches might be hard to replicate using vectorised functions: I'd advise to just skip those variables for now, and come back later to think about them.
We need to add the following input variables from tax-calculator
:
Mirroring #6
Currently 100%
This guide has overall national features of the program, which we can apply without getting into state-level details
https://www.cbpp.org/research/food-assistance/a-quick-guide-to-snap-eligibility-and-benefits
Implementing the logic and parameters from calcfunctions.py in tax-calculator
. Each function needs to:
openfisca-us
openfisca-us
Currently the two examples in https://ubicenter.github.io/openfisca-us/#reforms are:
Let's start with a very simple one, like changing the payroll tax rate.
Add parameters and logic from the AGI function in tax-calculator.
Translating tax formulas from tax-calculator
will require converting compiled functions to vectorized functions and multi-output functions to single-output functions, using parameters where necessary.
Add the tax policy logic from the Adj function in tax-calculator
, including parameters, intermediate and output variables.
See for example #41 (comment)
For example, one specific question: Should parameters include the attribute by which it's segmented? e.g. the standard deduction amount is currently named filer
as that's what it's specified by. If not (e.g. if we called it amount
) is there another way to hint the breakdown? We would ideally hint both the quantity type (e.g. amount vs thresholds) and the breakdown.
It'd probably be good to spec out the tree we're planning to fill in at the first ~3 levels of depth.
All parameters from tax-calculator
will need to be added as parameters.
The full list is:
User Story:
As a developer, I want to know the input, output and logic of converting raw data into taxdata.
AC:
I think this is a subset of housing assistance as reported in the ASEC
https://www.cbpp.org/research/housing/section-8-project-based-rental-assistance
Last step of all other SNAP issues
We'll use the existing infrastructure in openfisca-data
(along with potentially a rename) to maintain the standardised dataset generation procedure. This will involve:
@dataset
-decorated class for BaseCPS
CPS
This structure follows almost exactly the process for FRS
and SPI
in the UK model.
Autopep8 does some comment formatting that black doesn't do, such as splitting long comment lines and ensuring a space follows the #
. Should we run it prior to black?
There are significant differences between calculating benefits for households with and without at least one elderly and/or disabled person. For example, for most states the standard shelter deduction is capped at 569 per month, unless the household has an elderly or disabled individual living in it, in which case there is no cap.
Additionally, on the income eligibility page, there is a separate table for such households, with more generous income limits:
https://fns-prod.azureedge.net/sites/default/files/media/file/FY21-Income-Eligibility-Standards.pdf
Per the USDA, in 2018 roughly 23% of SNAP receiving households met this criteria, meaning it is not a fringe population.
Might be an intermediate variable, used for SNAP
Story:
As a developer, to make the raw cps us variables ready to use for modeling, I need to
Acceptance Criteria:
openfisca-data
repo in markdownObviously a wish list item, but I stumbled across separate policy parameters in snap for homeless individuals, and I explored around and found this very new journal article:
https://cpb-us-w2.wpmucdn.com/voices.uchicago.edu/dist/d/1370/files/2017/05/Homelessness-Full-Paper-May-24-2021.pdf
Very unexplored area, maybe for a rainy day?
This goes into SNAP but is probably unnecessary as it can come from summing persons, is that right @nikhilwoodruff ?
We can then use these to augment the data via synthimpute
. @nikhilwoodruff would these belong in the standard benefit path, or somewhere else since they're not policy parameters?
If the standard path, it could be something like:
parameters/benefit/{benefit}/admin/{totals,overhead}.yaml
(totals
could have subcomponents for spending and participation)
Currently 1.3 (130%) per https://www.cbpp.org/research/food-assistance/a-quick-guide-to-snap-eligibility-and-benefits
Gross monthly income — that is, household income before any of the program’s deductions are applied — generally must be at or below 130 percent of the poverty line. For a family of three, the poverty line used to calculate SNAP benefits in federal fiscal year 2021 is $1,810 a month. Thus, 130 percent of the poverty line for a three-person family is $2,353 a month, or about $28,200 a year. The poverty level is higher for bigger families and lower for smaller families
Mirroring #14
We should add the parameters, intermediate and output variables for the DependentCare function in tax-calculator
For a basic proof-of-concept, with the standard deduction and rates, we could ideally have:
e.g. unit, reference
Add to wiki
After running pip install -e .
from root and pytest
I get this error:
(base) mghenis@penguin:~/UBICenter/openfisca-us$ pytest
=== test session starts ===
platform linux -- Python 3.7.7, pytest-5.4.3, py-1.10.0, pluggy-0.13.1
rootdir: /home/mghenis/UBICenter/openfisca-us, inifile: setup.cfg, testpaths: openfisca_country_template/tests
plugins: anyio-3.0.1, dash-1.20.0
collected 0 items
=== no tests ran in 0.02s ===
ERROR: file not found: openfisca_country_template/tests
What am I missing? Let's add the installation and testing procedure to the docs.
We need to effectively reproduce the taxdata
method of creating tax units with all required variables, and at the same time also create person, family, household, and later SPM unit entities. This will involve adding a few modules to openfisca-data
.
Hi there!
I really enjoy OpenFisca, but I recently encountered an issue.
I identify more as a:
(remove this line as well as all items in the list that don't fit your situation)
Currently it could be either None
(or False
?) or CPI
.
In taxcalc, this is identified via indexed
, e.g.:
Only brackets vary with filer type, not rates. See https://github1s.com/UBICenter/openfisca-us/blob/master/openfisca_us/parameters/tax/income/bracket.yaml
Puerto Rico has a different program from SNAP: https://www.cbpp.org/research/food-assistance/how-does-household-food-assistance-in-puerto-rico-compare-to-the-rest-of
For SNAP
Ensure we have a clear way of testing the microdata outputs from the model.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.