def test_lucas_op_fixed_point():
    "lucastree: are prices a fixed point of lucas_operator"
    # transform from p to f
    old_f = prices / (grid ** gamma)

    # compute new f
    new_f = tree.lucas_operator(old_f)

    # transform from f to p
    new_p = new_f * grid**gamma

    # test if close. Make it one order of magnitude less than tol used
    # to compute prices
    assert_less_equal(max_abs_diff(new_p, prices), _tol*10)
def test_lucas_op_fixed_point():
    "lucastree: are prices a fixed point of lucas_operator"
    # transform from p to f
    old_f = prices / (grid**gamma)

    # compute new f
    new_f = tree.lucas_operator(old_f)

    # transform from f to p
    new_p = new_f * grid**gamma

    # test if close. Make it one order of magnitude less than tol used
    # to compute prices
    assert_less_equal(max_abs_diff(new_p, prices), _tol * 10)
Exemple #3
0
def test_v_vfi_fixed_point():
    "odu: v from vfi is fixed point"
    assert_less_equal(max_abs_diff(v, new_v), _tol * 10)
def test_analytical_policy():
    "optgrowth: approx sigma matches analytical"
    sigma = gm.compute_greedy(v)
    assert_less_equal(max_abs_diff(sigma, true_sigma), 1e-2)
def test_vf_fixed_point():
    "optgrowth: solution is fixed point of bellman"
    new_v = gm.bellman_operator(v)
    assert_less_equal(max_abs_diff(v[1:-1], new_v[1:-1]), 5e-2)
def test_analytical_vf():
    "optgrowth: approx v matches analytical"
    true_v = v_star(gm.grid)
    assert_less_equal(max_abs_diff(v[1:-1], true_v[1:-1]), 5e-2)
 def test_coleman_fp(self):
     "ifp: solution to coleman is a fixed point"
     new_c = self.cp.coleman_operator(self.c_pfi)
     self.assertLessEqual(max_abs_diff(self.c_pfi, new_c), 1e-3)
def test_v_vfi_fixed_point():
    "odu: v from vfi is fixed point"
    assert_less_equal(max_abs_diff(v, new_v), _tol*10)
 def test_bellman_coleman_solutions_agree(self):
     "ifp: bellman and coleman solutions agree"
     self.assertLessEqual(max_abs_diff(self.c_vfi, self.c_pfi), 0.2)
 def test_bellman_sol_fixed_point(self):
     "jv: solution to bellman is fixed point"
     new_V = self.jv.bellman_operator(self.V)
     self.assertLessEqual(max_abs_diff(new_V, self.V), 1e-4)
 def test_coleman_fp(self):
     "ifp: solution to coleman is a fixed point"
     new_c = self.cp.coleman_operator(self.c_pfi)
     self.assertLessEqual(max_abs_diff(self.c_pfi, new_c), 1e-3)
 def test_bellman_fp(self):
     "ifp: solution to bellman is a fixed point"
     new_v = self.cp.bellman_operator(self.v_vfi)
     self.assertLessEqual(max_abs_diff(self.v_vfi, new_v), 1e-3)
 def test_bellman_coleman_solutions_agree(self):
     "ifp: bellman and coleman solutions agree"
     self.assertLessEqual(max_abs_diff(self.c_vfi, self.c_pfi), 0.2)
def test_phi_pfi_fixed_point():
    "odu: phi from pfi is fixed point"
    new_phi = sp.res_wage_operator(phi_pfi)
    assert_less_equal(max_abs_diff(new_phi, phi_pfi), _tol*10)
Exemple #15
0
def test_phi_pfi_fixed_point():
    "odu: phi from pfi is fixed point"
    new_phi = sp.res_wage_operator(phi_pfi)
    assert_less_equal(max_abs_diff(new_phi, phi_pfi), _tol * 10)
 def test_bellman_fp(self):
     "ifp: solution to bellman is a fixed point"
     new_v = self.cp.bellman_operator(self.v_vfi)
     self.assertLessEqual(max_abs_diff(self.v_vfi, new_v), 1e-3)
 def test_bellman_sol_fixed_point(self):
     "jv: solution to bellman is fixed point"
     new_V = self.jv.bellman_operator(self.V)
     self.assertLessEqual(max_abs_diff(new_V, self.V), 1e-4)