Functions to Get Micro-data#

get_micro_data.py modules

ogusa.get_micro_data#


ogusa.get_micro_data.cap_inc_mtr(calc1)[source]#

This function computes the marginal tax rate on capital income, which is calculated as a weighted average of the marginal tax rates on different sources of capital income.

Parameters:

calc1 (Tax-Calculator Calculator object) – TC calculator

Returns:

array with marginal tax rates

for each observation in the TC Records object

Return type:

mtr_combined_capinc (Numpy array)

ogusa.get_micro_data.get_calculator(baseline, calculator_start_year, reform=None, data=None, gfactors=None, weights=None, records_start_year=2011)[source]#

This function creates the tax calculator object with the policy specified in reform and the data specified with the data kwarg.

Parameters:
  • baseline (boolean) – True if baseline tax policy

  • calculator_start_year (int) – first year of budget window

  • reform (dictionary) – IIT policy reform parameters, None if baseline

  • data (DataFrame or str) – DataFrame or path to datafile for Records object

  • gfactors (Tax-Calculator GrowthFactors object) – growth factors to use to extrapolate data over budget window

  • weights (DataFrame) – weights for Records object

  • records_start_year (int) – the start year for the data and weights dfs (default is set to the PUF start year as defined in the Tax-Calculator project)

Returns:

Calculator object with

current_year equal to calculator_start_year

Return type:

calc1 (Tax-Calculator Calculator object)

ogusa.get_micro_data.get_data(baseline=False, start_year=2021, reform={}, data=None, path='/home/runner/work/OG-USA/OG-USA/ogusa', client=None, num_workers=1)[source]#

This function creates dataframes of micro data with marginal tax rates and information to compute effective tax rates from the Tax-Calculator output. The resulting dictionary of dataframes is returned and saved to disk in a pickle file.

Parameters:
  • baseline (boolean) – True if baseline tax policy

  • calculator_start_year (int) – first year of budget window

  • reform (dictionary) – IIT policy reform parameters, None if baseline

  • data (DataFrame or str) – DataFrame or path to datafile for Records object

  • path (str) – path to save microdata files to

  • client (Dask Client object) – client for Dask multiprocessing

  • num_workers (int) – number of workers to use for Dask multiprocessing

Returns:

dict of Pandas Dataframe, one for each

year from start_year to the maximum year Tax-Calculator can analyze

taxcalc_version (str): version of Tax-Calculator used

Return type:

micro_data_dict (dict)

ogusa.get_micro_data.taxcalc_advance(baseline, start_year, reform, data, year)[source]#

This function advances the year used in Tax-Calculator, compute taxes and rates, and save the results to a dictionary.

Parameters:
  • calc1 (Tax-Calculator Calculator object) – TC calculator

  • year (int) – year to begin advancing from

Returns:

a dictionary of microdata with marginal tax

rates and other information computed in TC

Return type:

tax_dict (dict)