Skip to content

Commit

Permalink
Rename delta -> disutility_of_work
Browse files Browse the repository at this point in the history
  • Loading branch information
timmens committed Feb 28, 2024
1 parent 249c75c commit a61c5dc
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 12 deletions.
6 changes: 3 additions & 3 deletions examples/long_running.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
# --------------------------------------------------------------------------------------
# Utility function
# --------------------------------------------------------------------------------------
def utility(consumption, working, health, exercise, delta):
return jnp.log(consumption) - (delta - health) * working - exercise
def utility(consumption, working, health, exercise, disutility_of_work):
return jnp.log(consumption) - (disutility_of_work - health) * working - exercise


# --------------------------------------------------------------------------------------
Expand Down Expand Up @@ -107,6 +107,6 @@ def consumption_constraint(consumption, wealth):

PARAMS = {
"beta": 0.95,
"utility": {"delta": 0.05},
"utility": {"disutility_of_work": 0.05},
"next_wealth": {"interest_rate": 0.05},
}
8 changes: 4 additions & 4 deletions tests/test_models/phelps_deaton.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,19 @@
# --------------------------------------------------------------------------------------
# Utility functions
# --------------------------------------------------------------------------------------
def utility(consumption, working, delta):
return jnp.log(consumption) - delta * working
def utility(consumption, working, disutility_of_work):
return jnp.log(consumption) - disutility_of_work * working


def utility_with_filter(
consumption,
working,
delta,
disutility_of_work,
# Temporary workaround for bug described in issue #30, which requires us to pass
# all state variables to the utility function.
lagged_retirement, # noqa: ARG001, TODO: Remove unused arguments once #30 is fixed.
):
return utility(consumption=consumption, working=working, delta=delta)
return utility(consumption, working=working, disutility_of_work=disutility_of_work)


# --------------------------------------------------------------------------------------
Expand Down
18 changes: 13 additions & 5 deletions tests/test_models/stochastic.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
"""Example specifications of a simple Phelps-Deaton style stochastic model."""
"""Example specifications of a simple Phelps-Deaton style stochastic 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)
taste shocks" by Fedor Iskhakov, Thomas H. Jørgensen, John Rust and Bertel Schjerning
(2017, https://doi.org/10.3982/QE643).
See also the specifications in tests/test_models/phelps_deaton.py.
"""

import jax.numpy as jnp
import lcm
Expand Down Expand Up @@ -27,10 +36,9 @@ def utility(
# Temporary workaround for bug described in issue #30, which requires us to pass
# all state variables to the utility function.
partner, # noqa: ARG001, TODO: Remove unused arguments once #30 is fixed.
delta,
gamma,
disutility_of_work,
):
return jnp.log(consumption) + (gamma * health - delta) * working
return jnp.log(consumption) - (1 - health / 2) * disutility_of_work * working


# --------------------------------------------------------------------------------------
Expand Down Expand Up @@ -97,7 +105,7 @@ def consumption_constraint(consumption, wealth):

PARAMS = {
"beta": 0.95,
"utility": {"delta": 0.5, "gamma": 0.25},
"utility": {"disutility_of_work": 0.5},
"next_wealth": {"interest_rate": 0.05, "wage": 10.0},
"next_health": {},
"consumption_constraint": {},
Expand Down

0 comments on commit a61c5dc

Please sign in to comment.