Пример #1
0
@pytest.mark.parametrize('c,sigma,expected',
                         test_data,
                         ids=['Scalar 0', 'Scalar 1', 'Vector'])
def test_marg_ut_cons(c, sigma, expected):
    # Test marginal utility of consumption calculation
    test_value = household.marg_ut_cons(c, sigma)

    assert np.allclose(test_value, expected)


# Tuples in order: n, p, expected result
p1 = Specifications()
p1.b_ellipse = 0.527
p1.upsilon = 1.497
p1.ltilde = 1.0
p1.chi_n = 3.3

p2 = Specifications()
p2.b_ellipse = 0.527
p2.upsilon = 0.9
p2.ltilde = 1.0
p2.chi_n = 3.3

p3 = Specifications()
p3.b_ellipse = 0.527
p3.upsilon = 0.9
p3.ltilde = 2.3
p3.chi_n = 3.3

p4 = Specifications()
p4.b_ellipse = 2.6
Пример #2
0
    guid='_example',
    data='cps',
    client=client,
    num_workers=num_workers)


def chi_n_func(s, a0, a1, a2, a3, a4):
    chi_n = a0 + a1 * s + a2 * s**2 + a3 * s**3 + a4 * s**4
    return chi_n


a0 = 1
a1 = 0
a2 = 0
a3 = 0
a4 = 0

params_init = np.array([a0, a1, a2, a3, a4])

labor_data = np.array([167, 165, 165, 165, 165, 166, 165, 165, 164, 166, 164])
labor_moments = labor_data * 12 / (365 * 17.5)
data_moments = np.array(list(labor_moments.flatten()))
ages = np.linspace(20, 100, p.S)
p.chi_n = chi_n_func(ages, a0, a1, a2, a3, a4)
### had to add this to make it work:
ss_output = SS.run_SS(p, client)
model_moments = calc_moments(ss_output, p.omega_SS, p.lambdas, p.S, p.J)

print(labor_moments)
print(model_moments)