Tax-Brain Class Object

taxbrain

taxbrain.taxbrain

class taxbrain.taxbrain.TaxBrain(start_year: int, end_year: int = 2030, microdata: Optional[Union[str, dict]] = None, use_cps: bool = False, reform: Optional[Union[str, dict]] = None, behavior: Optional[dict] = None, assump=None, base_policy: Optional[Union[str, dict]] = None, verbose=False)[source]
differences_table(year: int, groupby: str, tax_to_diff: str, pop_quantiles: bool = False)pandas.core.frame.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)pandas.core.frame.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)pandas.core.frame.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 = ['c04600', 'payrolltax', 'iitax', 'c07100', 'XTOT', 'c04800', 'c09600', 'refund', 'taxbc', 'othertaxes', 'c04470', 'expanded_income', 'c00100', 'standard', 'aftertax_income', 'benefit_cost_total', 'ubi', 'surtax', 'benefit_value_total', 'c05800', 's006', 'combined', 'c62100'], 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

Returns

Return type

None

weighted_totals(var: str, include_total: bool = False)pandas.core.frame.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