def calcDepAdjustment(corp): """ Calculates the adjustment factor for assets, depreciation and investment corp: indicator for whether corporate or noncorporate data """ # Create Asset object policy = Policy() asset1 = Asset(policy.parameters_dataframe(), corp) asset1.calc_all() # Get unscaled depreciation for all years totalAnnualDepreciation = asset1.calcDep_allyears() # Get IRS data depreciation_data = copy.deepcopy(asset1.data.depreciationIRS_data) depreciation_data['dep_model'] = totalAnnualDepreciation[40:54] if corp: depreciation_data['scale'] = (depreciation_data['dep_Ccorp'] / depreciation_data['dep_model']) else: depreciation_data['scale'] = ( (depreciation_data['dep_Scorp'] + depreciation_data['dep_sp'] + depreciation_data['dep_partner']) / depreciation_data['dep_model']) adj_factor = (sum(depreciation_data['scale']) / len(depreciation_data['scale'])) # depreciation_data.to_csv('depr_data_' + str(corp) + '.csv') return adj_factor
def calcIDAdjustment(corp, eta=0.4): """ Calculates the adjustment factors for the corporate and noncorporate debt and interest. eta: retirement rate of existing debt """ policy = Policy() policy_params_df = policy.parameters_dataframe() # Create Asset object asset = Asset(policy_params_df, corp) asset.calc_all() # Get asset forecast forecast = asset.get_forecast() # Create Debt object debt = Debt(policy_params_df, forecast, corp=corp) debt.calc_all() # Get unscaled net interest deduction NID_gross = debt.NID[38:54] # Get net interest deduction from historical IRS data if corp: NID_irs = np.array(data1.debt_data_corp['NID_IRS'])[38:54] else: NID_irs = np.array(data1.debt_data_noncorp['ID_Scorp'][38:54] + data1.debt_data_noncorp['ID_sp'][38:54] + data1.debt_data_noncorp['ID_partner'][38:54]) NID_scale = sum(NID_irs / NID_gross) / 16.0 # 16 = 54 - 38 return NID_scale
def __init__(self, btax_params, earnings, data=None, assets=None, debts=None): # Create an associated Data object if isinstance(data, Data): self.data = data else: self.data = Data() if isinstance(btax_params, pd.DataFrame): self.btax_params = btax_params else: raise ValueError('btax_params must be DataFrame') if assets is not None: if isinstance(assets, Asset): self.assets = assets else: raise ValueError('assets must be Asset object') else: self.assets = Asset(btax_params) self.assets.calc_all() if debts is not None: if isinstance(debts, Debt): self.debts = debts else: raise ValueError('debts must be Debt object') else: assets_forecast = self.assets.get_forecast() self.debts = Debt(btax_params, assets_forecast) self.debts.calc_all() # Use earnings to create DataFrame for results assert len(earnings) == 14 combined = pd.DataFrame({'year': range(2014,2028), 'ebitda': earnings}) # Add tax depreciation and net interest deductions combined['taxDep'] = self.assets.get_taxdep() combined['nid'] = self.debts.get_nid() self.combined_return = combined
def __init__(self, btax_params): # Store policy parameter objects if isinstance(btax_params, pd.DataFrame): self.btax_params = btax_params else: raise ValueError('btax_params must be DataFrame') # Create Data object self.data = Data() # Create Asset object and calculate self.asset = Asset(self.btax_params, corp=False, data=self.data) self.asset.calc_all() # Create earnings forecast self.create_earnings()
def calcIDAdjustment(corp, eta=0.4): """ Calculates the adjustment factors for the corporate and noncorporate debt and interest. eta: retirement rate of existing debt """ data = Data() policy = Policy() policy_params_df = policy.parameters_dataframe() # Create Asset object asset = Asset(policy_params_df, corp) asset.calc_all() # Get asset forecast forecast = asset.get_forecast() # Create Debt object debt = Debt(policy_params_df, forecast, corp=corp) debt.calc_all() # Get unscaled interest incomes and expenses intpaid_model = debt.int_expense[40:54] intinc_model = debt.int_income[40:54] muniinc_model = debt.muni_income[40:54] if corp: # Exclude anomalous results for 2007 paid_scale = (sum(intpaid[:7] / intpaid_model[:7]) + sum(intpaid[8:] / intpaid_model[8:])) / 13. inc_scale = (sum(taxint[:7] / intinc_model[:7]) + sum(taxint[8:] / intinc_model[8:])) / 13. muni_scale = (sum(ntaxint[:7] / muniinc_model[:7]) + sum(ntaxint[8:] / muniinc_model[8:]))/ 13. scales = [paid_scale, inc_scale, muni_scale] else: ID_irs = np.array(data.debt_data_noncorp['ID_Scorp'][40:54] + data.debt_data_noncorp['ID_sp'][40:54] + data.debt_data_noncorp['ID_partner'][40:54]) scales = sum(ID_irs / intpaid_model) / 14. assets14 = forecast[0] return (scales, assets14, intpaid_model, intinc_model, muniinc_model)
def __init__(self, btax_params): self.econ_params = copy.deepcopy(Data().econ_defaults) self.btax_params = btax_params self.asset_c = Asset(btax_params, corp=True) self.asset_c.build_deprLaw_matrices()
def __init__(self, btax_params, revenues, deductions, credit, dmne=None, data=None, assets=None, debts=None): # Create an associated Data object if isinstance(data, Data): self.data = data else: self.data = Data() if isinstance(btax_params, pd.DataFrame): self.btax_params = btax_params else: raise ValueError('btax_params must be DataFrame') if isinstance(revenues, pd.DataFrame): self.revenues = copy.deepcopy(revenues) else: raise ValueError('revenues must be in DataFrame') if isinstance(deductions, pd.DataFrame): self.deductions = copy.deepcopy(deductions) else: raise ValueError('deductions must be in DataFrame') if isinstance(credit, pd.DataFrame): self.credits = copy.deepcopy(credit) else: raise ValueError('credits must be in DataFrame') if dmne is None: # Note: Don't do this in general self.dmne = DomesticMNE(self.btax_params) self.dmne.calc_all() elif isinstance(dmne, DomesticMNE): self.dmne = dmne else: raise ValueError('dmne must be a DomesticMNE object') if assets is not None: if isinstance(assets, Asset): self.assets = assets else: raise ValueError('assets must be Asset object') else: self.assets = Asset(btax_params) self.assets.calc_all() if debts is not None: if isinstance(debts, Debt): self.debts = debts else: raise ValueError('debts must be Debt object') else: assets_forecast = self.assets.get_forecast() self.debts = Debt(btax_params, assets_forecast) self.debts.calc_all() # Prepare unmodeled components of tax return self.revenues['capgains'] = ( self.revenues['capgains'] * (1. - self.btax_params['capgains_corp_hc'])) self.revenues['domestic_divs'] = ( self.revenues['domestic_divs'] * self.btax_params['domestic_dividend_inclusion']) self.revenues['total'] = (self.revenues['receipts'] + self.revenues['rent'] + self.revenues['royalties'] + self.revenues['capgains'] + self.revenues['domestic_divs'] + self.revenues['other'] + self.dmne.dmne_results['foreign_taxinc']) self.deductions['charity'] = (self.deductions['charity'] * (1. - self.btax_params['charity_hc'])) self.deductions['statelocaltax'] = ( self.deductions['statelocaltax'] * (1. - self.btax_params['statelocaltax_hc'])) self.deductions['total'] = ( self.deductions['cogs'] + self.deductions['execcomp'] + self.deductions['wages'] + self.deductions['repairs'] + self.deductions['baddebt'] + self.deductions['rent'] + self.deductions['statelocaltax'] + self.deductions['charity'] + self.deductions['amortization'] + self.deductions['depletion'] + self.deductions['advertising'] + self.deductions['pensions'] + self.deductions['benefits'] + self.deductions['other']) combined = pd.DataFrame({ 'year': range(START_YEAR, END_YEAR + 1), 'ebitda': (self.revenues['total'] - self.deductions['total']) }) # Add tax depreciation combined['taxDep'] = self.assets.get_taxdep() self.combined_return = combined
assets14 = forecast[0] return (scales, assets14, intpaid_model, intinc_model, muniinc_model) (scales_corp, ast_c_14, intpaid_model, intinc_model, muniinc_model) = calcIDAdjustment(True) (scale_ncorp, ast_nc_14, _, _, _) = calcIDAdjustment(False) print(scales_corp) print(scale_ncorp) newdebt = copy.deepcopy(debt2) newdebt['L_c'] = debt2['L_c'] * scales_corp[0] newdebt['L_nc'] = debt2['L_nc'] * scale_ncorp newdebt['At_c'] = debt2['At_c'] * scales_corp[1] newdebt['An_c'] = debt2['An_c'] * scales_corp[2] newdebt.to_csv(OUTPUT_PATH + 'debt_history.csv') pol1 = Policy() # Create Asset object asset = Asset(pol1.parameters_dataframe(), True) asset.calc_all() # Create Debt object debt = Debt(pol1.parameters_dataframe(), asset.get_forecast(), corp=True) debt.calc_all() df1 = pd.DataFrame({'inc_mod': intinc_model * scales_corp[1], 'paid_mod': intpaid_model * scales_corp[0], 'muni_mod': muniinc_model * scales_corp[2], 'inc_irs': taxint, 'paid_irs': intpaid, 'muni_irs': ntaxint}) df1.to_csv('debt_fit.csv')