Commit 30c2e5c
Add transient income innovation to IFP model and wealth inequality analysis (#745)
* teaked timing discussion in ifp_egm
* Add transient income innovation to IFP model and wealth inequality analysis
This commit modifies the income fluctuation problem (IFP) model to include
a transient IID income shock, following the specification in ifp_advanced.
Changes to ifp_egm.md:
1. Income process modification:
- Changed from Y_t = exp(Z_t) to Y_t = exp(a_y * η_t + Z_t * b_y)
- Added IID shock η_t ~ N(0,1) to create transient income fluctuations
- Updated Euler equation to integrate over η shocks using Monte Carlo
- Kept interest rate R constant throughout (as specified)
2. Implementation updates:
- Added parameters a_y=0.2, b_y=0.5, shock_draw_size=100
- Updated NumPy implementation with numba.jit optimization
- Updated JAX implementation with separate utility functions
- Modified simulation code to draw η shocks during dynamics
- Updated all code cells to unpack new IFP parameters
3. New wealth inequality analysis section:
- Added Gini coefficient computation
- Added top 1% wealth share computation
- Analyzed how inequality varies with interest rate r
- Tested 12 interest rate values from 0 to 0.015
- Generated plots showing Gini and top 1% vs interest rate
4. Performance optimization:
- Added @numba.jit decorators to u_prime, u_prime_inv, Y, and K_numpy
- Created separate JAX versions to avoid numba/JAX conflicts
Changes to ifp_advanced.md:
- Updated shock_draw_size from 50 to 100 in both Numba and JAX implementations
The modifications maintain consistency with ifp_advanced while keeping R
constant in ifp_egm. The transient income shock creates more realistic
wealth inequality through increased precautionary savings.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Refactor ifp_egm: use JAX throughout and improve code organization
- Convert Gini coefficient and top share calculations from NumPy to JAX
- Embed utility functions (u_prime, u_prime_inv) and income function (y)
inside K_numpy and K operators to simplify function signatures
- Introduce z_prime variable for better readability in nested loops
- Fix y_bar(k) to correctly implement mathematical definition of expected
labor income conditional on current state
- Use vmap for vectorization in y_bar computation
- Remove redundant y_mean vector in favor of direct y_bar(k) calls
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Fix simulate_household to use embedded y function
- Add local y function inside simulate_household to replace removed y_jax
- Maintains consistency with refactoring pattern used in K_numpy and K
- All tests pass successfully
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Improve ifp_egm lecture: add JAX dependency, fix grammar, enhance documentation
- Add jax to pip install requirements
- Improve y_bar function docstring with clearer mathematical notation
- Fix grammar and consistency in introduction
- Add spacing in K_numpy function for readability
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 9571a33 commit 30c2e5c
2 files changed
+376
-116
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
376 | 376 | | |
377 | 377 | | |
378 | 378 | | |
379 | | - | |
| 379 | + | |
380 | 380 | | |
381 | 381 | | |
382 | 382 | | |
| |||
665 | 665 | | |
666 | 666 | | |
667 | 667 | | |
668 | | - | |
| 668 | + | |
669 | 669 | | |
670 | 670 | | |
671 | 671 | | |
| |||
0 commit comments