[wealth_dynamics] Update code and exercises#322
Conversation
✅ Deploy Preview for incomparable-parfait-2417f8 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
| w_{t+1} = (1 + r_{t+1}) s(w_t) + y_{t+1} | ||
| ``` | ||
|
|
||
| In the simulations below, $z_{t+1}$ and the period $t+1$ idiosyncratic shocks |
There was a problem hiding this comment.
Actually I think we can skip this sentence @longye-tian . (It makes the next one redundant and it's not really necessary.)
|
Many thanks @longye-tian . One small change above. Also, could you please update PRNGKey to key? https://docs.jax.dev/en/latest/jax.random.html (Perhaps we should do this globally in one pass?) |
Many thanks @jstac for your review, that sounds good to me. I updated this lecture first. I use codex to do a quick scan. There are still 22 I’d be happy to put together a separate PR replacing |
|
Many thanks @longye-tian , I'm going to merge this. Much appreciated. Regarding the PRNGKey issue, it would be great if you could put in a PR. Please also update the doc links, as you mentioned. Perhaps the best thing to do is open an issue and ping @mmcky , so he knows what's going on --- since this will touch a lot of lectures. He might have comments on how to proceed. |
|
thanks @jstac and @longye-tian |
Hi @jstac
This PR update the lecture
wealth_dynamicsaccording to #321 .In particular, this PR:
Added a brief opening sentence explaining that large cross-section simulations make the lecture a natural fit for JAX.
Fixed the savings-threshold notation so the text uses
\hat w, matching the displayed savings rule.Added a timing note clarifying that period
t+1shocks are drawn before updating wealth fromw_ttow_{t+1}.Made Numba and JAX cross-section updates consistently skip
z_sequence[0]and usez_sequence[1:].Updated the first JAX loop to split the PRNG key before drawing random shocks.
Fixed Exercises 2 and 3 so the equality benchmark is plotted as the 45-degree line.
Corrected Exercise 3 to say
\mu_r = -\sigma_r^2 / 2holds the lognormal mean constant, not the variance.Added a note explaining that reused PRNG seeds support common-random-number comparisons across parameter values.