-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow for dependence on discrete choices in stochastic transitions #53
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #53 +/- ##
=======================================
Coverage 98.07% 98.07%
=======================================
Files 45 45
Lines 2491 2491
=======================================
Hits 2443 2443
Misses 48 48 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent! Just some tiny stuff.
src/lcm/example_models_stochastic.py
Outdated
@@ -9,7 +9,7 @@ | |||
|
|||
|
|||
def utility(consumption, working, health, partner, delta, gamma): # noqa: ARG001 | |||
return jnp.log(consumption) + (gamma * health - delta) * working | |||
return jnp.log(consumption + 1) + (gamma * health - delta) * working |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this change necessary? The constraint consumption > 0
should be handled elsewhere, if possible. Not clear to me why consumption > -0.99999
is the easier thing to handle?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. Currently, we only have a proper constraint for consumption < wealth
. I changed the grids of the model for consumption
and wealth
to both start at 1 (in principle, any positive number would work).
src/lcm/example_models_stochastic.py
Outdated
"partner": jnp.array([[1.0, 0], [0.0, 1]]), | ||
"partner": jnp.array( | ||
[ | ||
[[[0, 1.0], [1.0, 0]], [[0, 1.0], [0.0, 1.0]]], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we rely on these somewhere? If possible, numbers like [[0.9, 0.1], [0.05, 0.95]]
or so would be even better (=more instructive for people using this as documentation). Same for health; beta
could be 0.95 ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very good point. We cannot change the degenerate distribution for the partner
shock because the tests use this, however, I added more comments and made the distribution of health
more realistic.
In this PR, I adjust the stochastic state transitions to allow for dependence on discrete choice variables.
Specifically, I
next_weights
(see changes insrc/lcm/model_functions.py
)