Skip to content

Conversation

@jstac
Copy link
Contributor

@jstac jstac commented Nov 5, 2025

This PR adds a new lecture aiyagari_egm.md that combines the Aiyagari model with the Endogenous Grid Method (EGM).
Overview

The lecture combines two important computational methods:

Aiyagari model - a heterogeneous agent model with incomplete markets
Endogenous Grid Method (EGM) - an efficient algorithm for solving dynamic programming problems

Key Features
Theory and Implementation

Combines concepts from egm_policy_iter.md and aiyagari.md
Uses EGM to solve the household problem (avoiding costly root-finding)
Uses simulation to compute aggregate capital (instead of analytical stationary distribution)

Code Components

EGM operator for the Aiyagari model - Corrected implementation, converges in ~90 iterations
Simulation-based aggregation - Simulates 10,000+ households via Monte Carlo
Equilibrium computation - Uses bisection to find equilibrium capital stock (K* ≈ 8)
Wealth distribution analysis - Histograms, Lorenz curves, and Gini coefficient
Educational content - Comparison with standard approach and four exercises

Implementation Details
Fixes Applied

EGM operator: Corrected endogenous grid computation
Asset grid: Increased a_max from 20 to 50 to handle high savings rates
Simulation: Added asset clipping to prevent extrapolation issues

Testing

EGM iteration converges properly
Simulation produces stable results
Equilibrium computation works correctly
Wealth distribution can be computed
All code cells are functional

- Combines Aiyagari model with EGM solution method
- Replaces Howard policy iteration with EGM-based Coleman-Reffett operator
- Computes aggregate capital via simulation instead of stationary distribution
- Includes wealth distribution analysis and Lorenz curves
- Provides comparison with standard approach and extension exercises
- Corrected endogenous grid method logic for Aiyagari model
- Fixed computation of endogenous asset grid: a = (c + a' - wz)/(1+r)
- Added proper handling of borrowing constraint in interpolation
- EGM now converges in ~90 iterations (previously diverged)
- Verified with test suite: all tests pass
- Increased asset grid maximum from 20 to 50 to handle high savings
- Added asset clipping to prevent extrapolation issues in simulation
- Added comments explaining interpolation/extrapolation behavior
- Verified equilibrium computation: K* ≈ 8 (reasonable for these parameters)
- All tests now pass with stable, reasonable results
@github-actions
Copy link

github-actions bot commented Nov 5, 2025

📖 Netlify Preview Ready!

Preview URL: https://pr-675--sunny-cactus-210e3e.netlify.app (b483555)

📚 Changed Lecture Pages: aiyagari, aiyagari_egm

- Added aiyagari_egm.md to _toc.yml
- Placed directly after aiyagari.md in Multiple Agent Models section
@github-actions
Copy link

github-actions bot commented Nov 5, 2025

📖 Netlify Preview Ready!

Preview URL: https://pr-675--sunny-cactus-210e3e.netlify.app (f8ff48d)

📚 Changed Lecture Pages: aiyagari, aiyagari_egm

@jstac
Copy link
Contributor Author

jstac commented Nov 5, 2025

This is an experimental project --- do not merge.

@jstac
Copy link
Contributor Author

jstac commented Nov 5, 2025

Closing this PR in favor of #676 which uses a local branch instead of a Claude-generated branch.

@jstac jstac closed this Nov 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants