def ccc_initialize(self, call_tc=False): ''' ParametersBase reads JSON file and sets attributes to self Next call self.compute_default_params for further initialization Args: call_tc (bool): whether to use Tax-Calculator to estimate marginal tax rates Returns: None ''' if call_tc: # Find individual income tax rates from Tax-Calculator indiv_rates = get_rates(self.baseline, self.year, self.iit_reform, self.data) self.tau_nc = indiv_rates['tau_nc'] self.tau_div = indiv_rates['tau_div'] self.tau_int = indiv_rates['tau_int'] self.tau_scg = indiv_rates['tau_scg'] self.tau_lcg = indiv_rates['tau_lcg'] self.tau_td = indiv_rates['tau_td'] self.tau_h = indiv_rates['tau_h'] # does cheap calculations to find parameter values self.compute_default_params()
def test_get_rates(): ''' Test of the get_rates() functions ''' p = Specification() # has default tax rates, with should equal TC test_dict = tc.get_rates(baseline=False, start_year=2019, reform={}, data='cps') for k, v in test_dict.items(): assert (np.allclose(v, p.__dict__[k]))
def __init__(self, test=False, time_path=True, baseline=False, year=DEFAULT_START_YEAR, call_tc=False, iit_reform={}, data='cps'): super(Specifications, self).__init__() # reads in default parameter values self._vals = self._params_dict_from_json_file() self.test = test self.baseline = baseline self.year = year self.iit_reform = iit_reform self.data = data # put Cost-of-Capital-Calculator version in parameters to save # for reference self.ccc_version = pkg_resources.get_distribution("ccc").version if call_tc: # Find individual income tax rates from Tax-Calculator indiv_rates = get_rates(self.baseline, self.year, self.iit_reform, self.data) else: # Set indiv rates to some values indiv_rates = {'tau_nc': np.array([0.1929392]), 'tau_div': np.array([0.1882453]), 'tau_int': np.array([0.31239301]), 'tau_scg': np.array([0.29068557]), 'tau_lcg': np.array([0.18837299]), 'tau_td': np.array([0.21860396]), 'tau_h': np.array([0.04376291])} self.tau_nc = indiv_rates['tau_nc'] self.tau_div = indiv_rates['tau_div'] self.tau_int = indiv_rates['tau_int'] self.tau_scg = indiv_rates['tau_scg'] self.tau_lcg = indiv_rates['tau_lcg'] self.tau_xcg = 0.00 # tax rate on capital gains held to death self.tau_td = indiv_rates['tau_td'] self.tau_h = indiv_rates['tau_h'] # does cheap calculations to find parameter values self.initialize() self.parameter_warnings = '' self.parameter_errors = '' self._ignore_errors = False
def initialize(self, call_tc=False): """ ParametersBase reads JSON file and sets attributes to self Next call self.compute_default_params for further initialization Parameters: ----------- run_micro: boolean that indicates whether to estimate tax funtions from microsim model """ if call_tc: # Find individual income tax rates from Tax-Calculator indiv_rates = get_rates(self.baseline, self.year, self.iit_reform, self.data) self.tau_nc = indiv_rates['tau_nc'] self.tau_div = indiv_rates['tau_div'] self.tau_int = indiv_rates['tau_int'] self.tau_scg = indiv_rates['tau_scg'] self.tau_lcg = indiv_rates['tau_lcg'] self.tau_xcg = 0.00 # tax rate on capital gains held to death self.tau_td = indiv_rates['tau_td'] self.tau_h = indiv_rates['tau_h'] # does cheap calculations to find parameter values self.compute_default_params()
def test_tc_start_year(year): ''' Test that different start years work in functions calling Tax-Calculator ''' get_rates(True, year)
def compute_default_params(self): """ Does cheap calculations to return parameter values """ # Find individual income tax rates from Tax-Calculator # maybe have an if statement to go to tax-calc? indiv_rates = get_rates(self.baseline, self.start_year, self.iit_reform, self.data) self.tau_nc = indiv_rates['tau_nc'] self.tau_div = indiv_rates['tau_div'] self.tau_int = indiv_rates['tau_int'] self.tau_scg = indiv_rates['tau_scg'] self.tau_lcg = indiv_rates['tau_lcg'] self.tau_xcg = 0.00 # tax rate on capital gains held to death self.tau_td = indiv_rates['tau_td'] self.tau_h = indiv_rates['tau_h'] u_c = self.CIT_rate if not self.PT_entity_tax_ind: u_nc = self.tau_nc else: u_nc = self.PT_entity_tax_rate self.u_array = np.array([u_c, u_nc]) sprime_c_td = ((1 / self.Y_td) * np.log(( (1 - self.tau_td) * np.exp(self.nominal_interest_rate * self.Y_td)) + self.tau_td) - self.inflation_rate) s_c_d_td = (self.gamma * (self.nominal_interest_rate - self.inflation_rate) + (1 - self.gamma) * sprime_c_td) s_c_d = (self.alpha_c_d_ft * (((1 - self.tau_int) * self.nominal_interest_rate) - self.inflation_rate) + self.alpha_c_d_td * s_c_d_td + self.alpha_c_d_nt * (self.nominal_interest_rate - self.inflation_rate)) s_nc_d_td = s_c_d_td s_nc_d = (self.alpha_nc_d_ft * (((1 - self.tau_int) * self.nominal_interest_rate) - self.inflation_rate) + self.alpha_nc_d_td * s_nc_d_td + self.alpha_nc_d_nt * (self.nominal_interest_rate - self.inflation_rate)) g_scg = ((1 / self.Y_scg) * np.log(((1 - self.tau_scg) * np.exp( (self.inflation_rate + self.m * self.E_c) * self.Y_scg)) + self.tau_scg) - self.inflation_rate) g_lcg = ((1 / self.Y_lcg) * np.log(((1 - self.tau_lcg) * np.exp( (self.inflation_rate + self.m * self.E_c) * self.Y_lcg)) + self.tau_lcg) - self.inflation_rate) g = (self.omega_scg * g_scg + self.omega_lcg * g_lcg + self.omega_xcg * self.m * self.E_c) s_c_e_ft = (1 - self.m) * self.E_c * (1 - self.tau_div) + g s_c_e_td = ((1 / self.Y_td) * np.log(((1 - self.tau_td) * np.exp( (self.inflation_rate + self.E_c) * self.Y_td)) + self.tau_td) - self.inflation_rate) s_c_e = (self.alpha_c_e_ft * s_c_e_ft + self.alpha_c_e_td * s_c_e_td + self.alpha_c_e_nt * self.E_c) s_c = self.f_c * s_c_d + (1 - self.f_c) * s_c_e E_nc = s_c_e E_array = np.array([self.E_c, E_nc]) s_nc_e = E_nc s_nc = self.f_nc * s_nc_d + (1 - self.f_nc) * s_nc_e s_array = np.array([[s_c, s_nc], [s_c_d, s_nc_d], [s_c_e, s_nc_e]]) f_array = np.array([[self.f_c, self.f_nc], [1, 1], [0, 0]]) ace_array = np.array([self.ace, self.ace_nc]) r = ( f_array * (self.nominal_interest_rate * (1 - (1 - self.int_haircut) * self.u_array)) + (1 - f_array) * (E_array + self.inflation_rate - E_array * self.r_ace * ace_array)) r_prime = (f_array * self.nominal_interest_rate + (1 - f_array) * (E_array + self.inflation_rate)) # if no entity level taxes on pass-throughs, ensure mettr and metr # on non-corp entities the same if not self.PT_entity_tax_ind: r_prime[:, 1] = s_array[:, 1] + self.inflation_rate # If entity level tax, assume distribute earnings at same rate corps # distribute dividends and these are taxed at dividends tax rate # (which seems likely). Also implicitly assumed that if entity # level tax, then only additional taxes on pass-through income are # capital gains and dividend taxes else: # keep debt and equity financing ratio the same even though now # entity level tax that might now favor debt s_array[0, 1] = self.f_nc * s_nc_d + (1 - self.f_nc) * s_c_e s_array[2, 1] = s_c_e self.delta = get_econ_depr() self.tax_methods = { 'DB 200%': 2.0, 'DB 150%': 1.5, 'SL': 1.0, 'Economic': 1.0, 'Expensing': 1.0 } self.financing_list = ['', '_d', '_e'] self.entity_list = ['_c', '_nc'] # Create dictionaries with depreciation system and rate of bonus # depreciation by asset class class_list = [3, 5, 7, 10, 15, 20, 25, 27.5, 39] class_list_str = [(str(i) if i != 27.5 else '27_5') for i in class_list] self.deprec_system = {} self.bonus_deprec = {} for cl in class_list_str: self.deprec_system[cl] = getattr(self, 'DeprecSystem_{}yr'.format(cl)) self.bonus_deprec[cl] = getattr(self, 'BonusDeprec_{}yr'.format(cl)) tax_methods = { 'DB 200%': 2.0, 'DB 150%': 1.5, 'SL': 1.0, 'Economic': 1.0, 'Expensing': 1.0 } self.financing_list = ['', '_d', '_e'] self.entity_list = ['_c', '_nc'] self.z = calc_tax_depr_rates(r, self.inflation_rate, self.delta, self.bonus_deprec, self.deprec_system, self.inventory_expensing, self.land_expensing, tax_methods, self.financing_list, self.entity_list)