Exemplo n.º 1
0
def test_get_biz_tax():
    # Test function for business tax receipts
    p = Specifications()
    new_param_values = {
        'cit_rate': [0.20],
        'delta_tau_annual': [0.06]
    }
    p.update_specifications(new_param_values)
    p.T = 3
    w = np.array([1.2, 1.1, 1.2])
    Y = np.array([3.0, 7.0, 3.0])
    L = np.array([2.0, 3.0, 2.0])
    K = np.array([5.0, 6.0, 5.0])
    biz_tax = tax.get_biz_tax(w, Y, L, K, p, 'TPI')
    assert np.allclose(biz_tax, np.array([0.0102, 0.11356, 0.0102]))
Exemplo n.º 2
0
    ineq = Inequality(dist, pop_weights, ability_weights, S, J)
    top_share = ineq.top_share(0.05)
    assert np.allclose(top_share, 0.285714286)


def test_to_timepath_shape():
    '''
    Test of function that converts vector to time path conformable array
    '''
    in_array = np.ones(40)
    test_array = utils.to_timepath_shape(in_array)
    assert test_array.shape == (40, 1, 1)


p = Specifications()
p.T = 40
p.S = 3
p.J = 1
x1 = np.ones((p.S, p.J)) * 0.4
xT = np.ones((p.S, p.J)) * 5.0
expected1 = np.tile(
    np.array([
        0.4, 0.51794872, 0.63589744, 0.75384615, 0.87179487, 0.98974359,
        1.10769231, 1.22564103, 1.34358974, 1.46153846, 1.57948718, 1.6974359,
        1.81538462, 1.93333333, 2.05128205, 2.16923077, 2.28717949, 2.40512821,
        2.52307692, 2.64102564, 2.75897436, 2.87692308, 2.99487179, 3.11282051,
        3.23076923, 3.34871795, 3.46666667, 3.58461538, 3.7025641, 3.82051282,
        3.93846154, 4.05641026, 4.17435897, 4.29230769, 4.41025641, 4.52820513,
        4.64615385, 4.76410256, 4.88205128, 5., 5.0, 5.0, 5.0
    ]).reshape(p.T + p.S, 1, 1), (1, p.S, p.J))
expected2 = np.tile(
Exemplo n.º 3
0
p = Specifications()
p.tax_func_type = 'DEP'
p.J = 1
p.S = 3
p.lambdas = np.array([1.0])
p.e = np.array([0.5, 0.45, 0.3]).reshape(3, 1)
p.h_wealth = np.ones(p.T + p.S) * 1
p.p_wealth = np.ones(p.T + p.S) * 2
p.m_wealth = np.ones(p.T + p.S) * 3
p.tau_payroll = np.ones(p.T + p.S) * 0.15
p.tau_bq = np.ones(p.T + p.S) * 0.1
p.retire = (np.ones(p.T + p.S) * 2).astype(int)
p1 = copy.deepcopy(p)
p2 = copy.deepcopy(p)
p3 = copy.deepcopy(p)
p3.T = 3
p4 = copy.deepcopy(p)
p5 = copy.deepcopy(p)
p5.e = np.array([[0.3, 0.2], [0.5, 0.4], [0.45, 0.3]])
p5.J = 2
p5.T = 3
p5.lambdas = np.array([0.65, 0.35])
# set variables and other parameters for each case
r1 = 0.04
w1 = 1.2
b1 = np.array([0.4, 0.3, 0.5])
n1 = np.array([0.8, 0.4, 0.7])
BQ1 = np.array([0.3])
bq1 = BQ1 / p1.lambdas[0]
tr1 = np.array([0.12])
theta1 = np.array([0.225])
Exemplo n.º 4
0
@pytest.mark.parametrize('n,params,expected',
                         test_data,
                         ids=['1', '2', '3', '4', '5', '6', '7', '8'])
def test_marg_ut_labor(n, params, expected):
    # Test marginal utility of labor calculation
    test_value = household.marg_ut_labor(n, params.chi_n, params)

    assert np.allclose(test_value, expected)


p1 = Specifications()
p1.zeta = np.array([[0.1, 0.3], [0.15, 0.4], [0.05, 0.0]])
p1.S = 3
p1.J = 2
p1.T = 3
p1.lambdas = np.array([0.6, 0.4])
p1.omega_SS = np.array([0.25, 0.25, 0.5])
p1.omega = np.tile(p1.omega_SS.reshape((1, p1.S)), (p1.T, 1))
BQ1 = 2.5
p1.use_zeta = True
expected1 = np.array([[1.66666667, 7.5], [2.5, 10.0], [0.416666667, 0.0]])
p2 = Specifications()
p2.zeta = np.array([[0.1, 0.3], [0.15, 0.4], [0.05, 0.0]])
p2.S = 3
p2.J = 2
p2.T = 3
p2.lambdas = np.array([0.6, 0.4])
p2.omega_SS = np.array([0.25, 0.25, 0.5])
p2.omega = np.tile(p2.omega_SS.reshape((1, p2.S)), (p2.T, 1))
p2.use_zeta = True