Skip to content
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

Merged
merged 5 commits into from
Feb 13, 2024

Conversation

timmens
Copy link
Member

@timmens timmens commented Feb 6, 2024

In this PR, I adjust the stochastic state transitions to allow for dependence on discrete choice variables.

Specifically, I

  1. Add the choice grids when computing next_weights (see changes in src/lcm/model_functions.py)
  2. Add a state transition that depends on a discrete choice to the stochastic example models and extend the test

Copy link

codecov bot commented Feb 13, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (3195dc8) 98.07% compared to head (cf34ca0) 98.07%.

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.
📢 Have feedback on the report? Share it here.

Copy link
Member

@hmgaudecker hmgaudecker left a 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/create_params.py Show resolved Hide resolved
@@ -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
Copy link
Member

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?

Copy link
Member Author

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).

"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]]],
Copy link
Member

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 ?

Copy link
Member Author

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.

@timmens timmens merged commit e72f3ba into main Feb 13, 2024
6 checks passed
@timmens timmens deleted the stochastic-transitions branch February 13, 2024 12:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants