Skip to content

Commit

Permalink
Add ISKHAKOV_ET_AL_2017 model
Browse files Browse the repository at this point in the history
  • Loading branch information
timmens committed Feb 29, 2024
1 parent 5173642 commit 17b1376
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 32 deletions.
45 changes: 15 additions & 30 deletions tests/test_analytical_solution.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,52 +7,37 @@
"""

from copy import deepcopy

import numpy as np
import pytest
from lcm._config import TEST_DATA
from lcm.entry_point import get_lcm_function
from numpy.testing import assert_array_almost_equal as aaae

from tests.test_models.deterministic import BASE_MODEL_WITH_FILTERS
from tests.test_models.deterministic import get_model_config, get_params

# ======================================================================================
# Model specifications
# ======================================================================================


def _get_iskhakov_2017_model(n_periods):
model_config = deepcopy(BASE_MODEL_WITH_FILTERS)
model_config["n_periods"] = n_periods
# remove age and wage functions, as they are not modelled in Iskhakov et al. (2017)
model_config["functions"] = {
name: func
for name, func in model_config["functions"].items()
if name not in ("age", "wage")
}
return model_config


def _get_iskhakov_2017_params(disutility_of_work):
return {
"beta": 0.98,
"utility": {"disutility_of_work": disutility_of_work},
"next_wealth": {
"interest_rate": 0.0,
},
"labor_income": {"wage": 20.0},
}


TEST_CASES = {
"iskhakov_2017_five_periods": {
"model": _get_iskhakov_2017_model(n_periods=5),
"params": _get_iskhakov_2017_params(disutility_of_work=1.0),
"model": get_model_config("iskhakov_et_al_2017", n_periods=5),
"params": get_params(
beta=0.98,
disutility_of_work=1.0,
interest_rate=0.0,
wage=20.0,
),
},
"iskhakov_2017_low_delta": {
"model": _get_iskhakov_2017_model(n_periods=3),
"params": _get_iskhakov_2017_params(disutility_of_work=0.1),
"model": get_model_config("iskhakov_et_al_2017", n_periods=3),
"params": get_params(
beta=0.98,
disutility_of_work=0.1,
interest_rate=0.0,
wage=20.0,
),
},
}

Expand Down
35 changes: 34 additions & 1 deletion tests/test_models/deterministic.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Example specifications of a deterministic consumption-saving model.
This specification builds on the example model presented in the paper: "The endogenous
The specification builds on the example model presented in the paper: "The endogenous
grid method for discrete-continuous dynamic choice models with (or without) taste
shocks" by Fedor Iskhakov, Thomas H. Jørgensen, John Rust and Bertel Schjerning (2017,
https://doi.org/10.3982/QE643).
Expand Down Expand Up @@ -186,6 +186,38 @@ def absorbing_retirement_filter(retirement, lagged_retirement):
}


ISKHAKOV_ET_AL_2017 = {
"functions": {
"utility": utility_with_filter,
"next_wealth": next_wealth,
"next_lagged_retirement": lambda retirement: retirement,
"consumption_constraint": consumption_constraint,
"absorbing_retirement_filter": absorbing_retirement_filter,
"labor_income": labor_income,
"working": working,
},
"choices": {
"retirement": {"options": [0, 1]},
"consumption": {
"grid_type": "linspace",
"start": 1,
"stop": 400,
"n_points": N_GRID_POINTS["consumption"],
},
},
"states": {
"wealth": {
"grid_type": "linspace",
"start": 1,
"stop": 400,
"n_points": N_GRID_POINTS["wealth"],
},
"lagged_retirement": {"options": [0, 1]},
},
"n_periods": 3,
}


# ======================================================================================
# Get models and params
# ======================================================================================
Expand All @@ -194,6 +226,7 @@ def absorbing_retirement_filter(retirement, lagged_retirement):
"base": BASE_MODEL,
"fully_discrete": BASE_MODEL_FULLY_DISCRETE,
"with_filters": BASE_MODEL_WITH_FILTERS,
"iskhakov_et_al_2017": ISKHAKOV_ET_AL_2017,
}


Expand Down
2 changes: 1 addition & 1 deletion tests/test_models/stochastic.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Example specifications of a stochastic consumption-saving model.
"""Example specification of a stochastic consumption-saving model.
This specification is motivated by the example model presented in the paper: "The
endogenous grid method for discrete-continuous dynamic choice models with (or without)
Expand Down

0 comments on commit 17b1376

Please sign in to comment.