Skip to content

Commit

Permalink
Implement requested changes and correct typo
Browse files Browse the repository at this point in the history
  • Loading branch information
timmens committed Feb 29, 2024
1 parent e4ebed3 commit 21a05f9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
9 changes: 2 additions & 7 deletions examples/long_running.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Example specification for a consumption-savings model with health and leisure."""
"""Example specification for a consumption-savings model with health and exercise."""

import jax.numpy as jnp

Expand Down Expand Up @@ -33,10 +33,6 @@ def labor_income(wage, working):
return wage * working


def working(leisure):
return 1 - leisure


def wage(age):
return 1 + 0.1 * age

Expand Down Expand Up @@ -74,12 +70,11 @@ def consumption_constraint(consumption, wealth, labor_income):
"next_health": next_health,
"consumption_constraint": consumption_constraint,
"labor_income": labor_income,
"working": working,
"wage": wage,
"age": age,
},
"choices": {
"leisure": {"options": [0, 1]},
"working": {"options": [0, 1]},
"consumption": {
"grid_type": "linspace",
"start": 1,
Expand Down
15 changes: 11 additions & 4 deletions tests/test_analytical_solution.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
"""Testing against the analytical solution by Iskhakov et al (2017)."""
"""Testing against the analytical solution of Iskhakov et al. (2017).
The benchmark is taken from 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).
"""

import numpy as np
import pytest
Expand All @@ -12,7 +19,7 @@
# Model specifications
# ======================================================================================

ISKHAVOV_2017_PARAMS = {
ISKHAKOV_2017_PARAMS = {
"beta": 0.98,
"utility": {"disutility_of_work": None},
"next_wealth": {
Expand All @@ -24,11 +31,11 @@
TEST_CASES = {
"iskhakov_2017_five_periods": {
"model": {**BASE_MODEL_WITH_FILTERS, "n_periods": 5},
"params": {**ISKHAVOV_2017_PARAMS, "utility": {"disutility_of_work": 1.0}},
"params": {**ISKHAKOV_2017_PARAMS, "utility": {"disutility_of_work": 1.0}},
},
"iskhakov_2017_low_delta": {
"model": {**BASE_MODEL_WITH_FILTERS, "n_periods": 3},
"params": {**ISKHAVOV_2017_PARAMS, "utility": {"disutility_of_work": 0.1}},
"params": {**ISKHAKOV_2017_PARAMS, "utility": {"disutility_of_work": 0.1}},
},
}

Expand Down

0 comments on commit 21a05f9

Please sign in to comment.