def ETR_income(r, w, b, n, factor, e, etr_params, p): ''' Calculates effective personal income tax rate. Args: r (array_like): real interest rate w (array_like): real wage rate b (Numpy array): savings n (Numpy array): labor supply factor (scalar): scaling factor converting model units to dollars e (Numpy array): effective labor units etr_params (Numpy array): effective tax rate function parameters p (OG-USA Specifications object): model parameters Returns: tau (Numpy array): effective tax rate on total income ''' X = (w * e * n) * factor Y = (r * b) * factor tau = get_tax_rates(etr_params, X, Y, None, p.tax_func_type, 'etr', for_estimation=False) return tau
def MTR_income(r, w, b, n, factor, mtr_capital, e, etr_params, mtr_params, p): r''' Generates the marginal tax rate on labor income for households. Args: r (array_like): real interest rate w (array_like): real wage rate b (Numpy array): savings n (Numpy array): labor supply factor (scalar): scaling factor converting model units to dollars mtr_capital (bool): whether to compute the marginal tax rate on capital income or labor income e (Numpy array): effective labor units etr_params (Numpy array): effective tax rate function parameters p (OG-USA Specifications object): model parameters Returns: tau (Numpy array): marginal tax rate on income source ''' X = (w * e * n) * factor Y = (r * b) * factor if p.analytical_mtrs: tau = get_tax_rates(etr_params, X, Y, None, p.tax_func_type, 'mtr', p.analytical_mtrs, mtr_capital, for_estimation=False) else: tau = get_tax_rates(mtr_params, X, Y, None, p.tax_func_type, 'mtr', p.analytical_mtrs, mtr_capital, for_estimation=False) return tau
def test_get_tax_rates(tax_func_type, rate_type, params, for_estimation, expected): ''' Teset of txfunc.get_tax_rates() function. There are 6 cases to test: 1) DEP function, for estimation 2) DEP function, not for estimation 3) GS function, etr 4) GS function, mtr 5) DEP_totalinc function, for estimation 6) DEP_totalinc function, not for estimation ''' wgts = np.array([0.1, 0.25, 0.55, 0.1]) X = np.array([32.0, 44.0, 1.6, 0.4]) Y = np.array([32.0, 55.0, 0.9, 0.03]) test_txrates = txfunc.get_tax_rates(params, X, Y, wgts, tax_func_type, rate_type, for_estimation) assert np.allclose(test_txrates, expected)