def test_shapes_invalid():
    δ_vals = np.array([1., 1.1, 1.2])
    P_δ = np.array([1 / 2, 1 / 2])

    with pytest.raises(ValueError) as e_info:
        Household(δ_vals=δ_vals, P_δ=P_δ)

    ζ_vals = np.array([0.5, 1.5, 2.5])
    P_ζ0 = np.array([1 / 2, 1 / 2])

    P_ζ1 = np.array([[1 / 3, 1 / 3, 1 / 3],
                     [1 / 3, 1 / 3, 1 / 3]])

    for P_ζ_invalid in [P_ζ0, P_ζ1]:
        with pytest.raises(ValueError) as e_info:
            Household(ζ_vals=ζ_vals, P_ζ=P_ζ1)
Exemplo n.º 2
0
    def test_higher_b_max(self):
        current_b_max = self.baseline_hh.b_vals.max()
        modified_b_max = current_b_max - 1.
        modified_b_vals = np.insert(self.baseline_hh.b_vals, -1, modified_b_max)
        modified_hh = Household(b_vals=modified_b_vals)
        modified_model = KnightianInnovationModel(modified_hh, Firm())

        do_test(self.baseline_model, modified_model)
Exemplo n.º 3
0
    def test_lower_b_min(self):
        current_b_min = self.baseline_hh.b_vals.min()
        modified_b_min = current_b_min - 1.
        modified_b_vals = np.insert(self.baseline_hh.b_vals, 0, modified_b_min)
        modified_hh = Household(b_vals=modified_b_vals)
        modified_model = KnightianInnovationModel(modified_hh, Firm())

        do_test(self.baseline_model, modified_model)
def test_P_δ_invalid():
    P_δ_neg = np.array([-0.5, 0.5])
    P_δ_1 = np.array([1.5, 0.5])
    P_δ_sum = np.array([0.25] * 5)

    for P_δ_invalid in [P_δ_neg, P_δ_1, P_δ_sum]:
        with pytest.raises(ValueError) as e_info:
            Household(P_δ=P_δ_invalid)
Exemplo n.º 5
0
    def setup(self):
        self.baseline_hh = Household()
        self.baseline_firms = Firm()
        self.baseline_model = KnightianInnovationModel(self.baseline_hh,
                                                       self.baseline_firms)
        self.baseline_model.solve_household_DP_problem()
        self.ϵ = 1.05

        check_weakly_increasing(self.baseline_model)
def test_invalid_aggregate():
    invalid_aggregate = -0.5

    hh = Household()
    firms = Firm()

    with pytest.raises(ValueError) as e_info:
        KnightianInnovationModel(hh, firms, K=invalid_aggregate)

    with pytest.raises(ValueError) as e_info:
        KnightianInnovationModel(hh, firms, L=invalid_aggregate)

    with pytest.raises(ValueError) as e_info:
        KnightianInnovationModel(hh, firms, M=invalid_aggregate)
Exemplo n.º 7
0
    def test_lower_risk_free_rate(self):
        modified_model = KnightianInnovationModel(Household(),
                                                  Firm(),
                                                  R=self.baseline_model.R / self.ϵ)

        do_test(self.baseline_model, modified_model)
Exemplo n.º 8
0
    def test_higher_δ(self):
        modified_hh = Household(δ_vals=self.baseline_hh.δ_vals * self.ϵ)
        modified_model = KnightianInnovationModel(modified_hh, Firm())

        do_test(self.baseline_model, modified_model)
Exemplo n.º 9
0
    def test_higher_γ(self):
        modified_model = KnightianInnovationModel(Household(),
                                                  Firm(),
                                                  γ=self.baseline_model.γ * self.ϵ)

        do_test(self.baseline_model, modified_model)
Exemplo n.º 10
0
    def test_higher_A(self):
        modified_firms = Firm(A=self.baseline_firms.A * self.ϵ)
        modified_model = KnightianInnovationModel(Household(),
                                                  modified_firms)

        do_test(self.baseline_model, modified_model)
def test_π_invalid():
    π = 1.1

    with pytest.raises(ValueError) as e_info:
        Household(π=π)
def test_β_invalid():
    β = 1.1

    with pytest.raises(ValueError) as e_info:
        Household(β=β)
def test_α_invalid():
    α = 1.1

    with pytest.raises(ValueError) as e_info:
        Household(α=α)