Tax-Brain Class Object#
taxbrain
taxbrain.taxbrain#
- class taxbrain.taxbrain.TaxBrain(start_year: int, end_year: int = 2034, microdata: str | dict = 'CPS', reform: str | dict = None, behavior: dict = None, assump=None, base_policy: str | dict = None, corp_revenue: dict | list | array = None, corp_incidence_assumptions: dict = None, verbose=False, stacked=False)[source]#
- differences_table(year: int, groupby: str, tax_to_diff: str, pop_quantiles: bool = False) DataFrame [source]#
Method to create a differences table
- Parameters:
year (int) – which year the difference table should be from
groupby (str) – determines how the rows in the table are sorted options: ‘weighted_deciles’, ‘standard_income_bins’, ‘soi_agi_bin’
tax_to_diff (str) – which tax to take the difference of options: ‘iitax’, ‘payrolltax’, ‘combined’
pop_quantiles (bool) – whether weighted_deciles contain an equal number of tax units (False) or people (True)
- Returns:
table – differences table
- Return type:
Pandas DataFrame
- distribution_table(year: int, groupby: str, income_measure: str, calc: str, pop_quantiles: bool = False) DataFrame [source]#
Method to create a distribution table
- Parameters:
year (int) – which year the distribution table data should be from
groupby (str) – determines how the rows in the table are sorted options: ‘weighted_deciles’, ‘standard_income_bins’, ‘soi_agi_bin’
income_measure (str) – determines which variable is used to sort the rows in the table options: ‘expanded_income’ or ‘expanded_income_baseline’
calc (which calculator to use: base or reform) – which calculator to use, can take either ‘REFORM’ or ‘BASE’
calc
pop_quantiles (bool) – whether or not weighted_deciles contain equal number of tax units (False) or people (True)
- Returns:
table – distribution table
- Return type:
Pandas DataFrame
- multi_var_table(varlist: list, calc: str, include_total: bool = False) DataFrame [source]#
Create a Pandas DataFrame with multiple variables from the specified data source
- Parameters:
varlist (list) – list of variables to include in the table
calc (str) – specify reform or base calculator data, can take either ‘REFORM’ or ‘BASE’
include_total (bool) – If true the returned DataFrame will include a “total” column
- Returns:
df – A Pandas DataFrame containing the weighted sum of each variable passed in the varlist argument for each year in the analysis.
- Return type:
Pandas DataFrame
- run(varlist: list = ['surtax', 'c05800', 'c04600', 'c04800', 'ubi', 'refund', 'aftertax_income', 'c09600', 'expanded_income', 'othertaxes', 'XTOT', 'combined', 'taxbc', 'c04470', 'benefit_value_total', 'benefit_cost_total', 'payrolltax', 's006', 'iitax', 'c62100', 'c07100', 'standard', 'c00100'], client=None, num_workers=1)[source]#
Run the calculators. TaxBrain will determine whether to do a static or partial equilibrium run based on the user’s inputs when initializing the TaxBrain object.
- Parameters:
varlist (list) – variables from the microdata to be stored in each year
- Return type:
None
- weighted_totals(var: str, include_total: bool = False) DataFrame [source]#
Create a pandas DataFrame that shows the weighted sum or a specified variable under the baseline policy, reform policy, and the difference between the two.
- Parameters:
var (str) – Variable name for variable you want the weighted total of.
include_total (bool) – If true the returned DataFrame will include a “total” columns
- Returns:
A Pandas DataFrame with rows for the baseline total, reform total, and the difference between the two.
- Return type:
Pandas DataFrame