Skip to content

[wealth_dynamics] Update code and exercises#322

Merged
jstac merged 7 commits into
mainfrom
wealth_update
Jun 25, 2026
Merged

[wealth_dynamics] Update code and exercises#322
jstac merged 7 commits into
mainfrom
wealth_update

Conversation

@longye-tian

@longye-tian longye-tian commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Hi @jstac

This PR update the lecture wealth_dynamics according 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+1 shocks are drawn before updating wealth from w_t to w_{t+1}.

  • Made Numba and JAX cross-section updates consistently skip z_sequence[0] and use z_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 / 2 holds the lognormal mean constant, not the variance.

  • Added a note explaining that reused PRNG seeds support common-random-number comparisons across parameter values.

@netlify

netlify Bot commented Jun 19, 2026

Copy link
Copy Markdown

Deploy Preview for incomparable-parfait-2417f8 ready!

Name Link
🔨 Latest commit a6182e4
🔍 Latest deploy log https://app.netlify.com/projects/incomparable-parfait-2417f8/deploys/6a38a4991a0acc0008936695
😎 Deploy Preview https://deploy-preview-322--incomparable-parfait-2417f8.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@longye-tian longye-tian linked an issue Jun 19, 2026 that may be closed by this pull request
8 tasks
@longye-tian longye-tian self-assigned this Jun 19, 2026
@longye-tian longye-tian added the enhancement New feature or request label Jun 19, 2026
@github-actions

github-actions Bot commented Jun 19, 2026

Copy link
Copy Markdown

@github-actions github-actions Bot temporarily deployed to pull request June 19, 2026 07:17 Inactive
@github-actions github-actions Bot temporarily deployed to pull request June 19, 2026 07:19 Inactive
@longye-tian longye-tian marked this pull request as ready for review June 21, 2026 12:58
@longye-tian longye-tian requested a review from jstac June 21, 2026 12:58
Comment thread lectures/wealth_dynamics.md Outdated
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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually I think we can skip this sentence @longye-tian . (It makes the next one redundant and it's not really necessary.)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Roger that 🫡

@jstac

jstac commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

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

@longye-tian

longye-tian commented Jun 22, 2026

Copy link
Copy Markdown
Contributor Author

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 PRNGKey occurrences across the JAX lecture series, so I think a focused PR replacing those with key would be worthwhile. I/codex also noticed a few old jax.readthedocs.io links that could be updated to docs.jax.dev, perhaps as a separate small cleanup.

I’d be happy to put together a separate PR replacing PRNGKey with key across the JAX lecture series if you’d like.

@github-actions github-actions Bot temporarily deployed to pull request June 22, 2026 03:07 Inactive
@github-actions github-actions Bot temporarily deployed to pull request June 22, 2026 03:10 Inactive
@jstac

jstac commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

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.

@jstac jstac merged commit abea4ec into main Jun 25, 2026
7 checks passed
@jstac jstac deleted the wealth_update branch June 25, 2026 21:37
@mmcky

mmcky commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

thanks @jstac and @longye-tian

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[wealth_dynamics] Some suggestions on content and code

3 participants