This repository provides a computational implementation of the seminal Aiyagari (1994) model of uninsured idiosyncratic risk and aggregate saving. The model demonstrates how precautionary saving motives and liquidity constraints affect aggregate economic outcomes in a heterogeneous agent framework.
- Two Solution Approaches: MarkovConsumerType and DolARK methods using the HARK framework
- Complete Parameter Replication: All parameter combinations from original Aiyagari (1994) Table II
- High Accuracy Results: Replication within 0.05 percentage points for interest rates
- Modern Tools: Poetry and conda environment management for reproducibility
- Educational Focus: Detailed documentation for learning heterogeneous agent models
# Install dependencies
poetry install
# Run quick demonstration (one notebook, ~5 minutes)
./reproduce_min.sh
# Run full reproduction (both notebooks, ~20 minutes)
./reproduce.sh# Create environment
conda env create -f binder/environment.yml
conda activate Aiyagari1994QJE
# Run reproduction
./reproduce.shClick the Binder badge above to run in your browser without local installation.
-
AiyagariMarkovHARK.ipynb: Primary implementation using MarkovConsumerType- Detailed equilibrium analysis
- Complete parameter space exploration
- Comparison with original Aiyagari results
-
AiyagariDolARK.ipynb: Alternative implementation using DolARK methods- Different solution approach for verification
- Computational method comparison
CITATION.cff: Bibliographic metadata for proper citationreproduce.sh: Complete reproduction script (both notebooks)reproduce_min.sh: Quick demonstration script (primary notebook only)pyproject.toml: Poetry configuration for local developmentbinder/environment.yml: Conda environment for reproducibility
The Aiyagari model features:
- Heterogeneous Agents: Infinitely-lived households facing idiosyncratic income shocks
- Incomplete Markets: No insurance against individual income risk
- Borrowing Constraints: Agents cannot borrow against future income
- Precautionary Saving: Individual risk leads to aggregate capital accumulation
- Equilibrium Analysis: Endogenous interest rate clears asset market
This implementation successfully replicates:
- Table II from Aiyagari (1994): Interest rates and saving rates across parameter combinations
- Parameter Effects: How risk aversion (θ), income persistence (ρ), and volatility (σ) affect outcomes
- Comparative Statics: Systematic analysis of equilibrium responses
- Graduate-level macroeconomic theory
- Some Python programming experience
- Basic dynamic programming knowledge
- Familiarity with numerical methods
- Understand incomplete markets with heterogeneous agents
- Master HARK computational framework
- Analyze precautionary saving effects
- Compare numerical with analytical solutions
- Tauchen Discretization: AR(1) income process → discrete Markov chain
- Value Function Iteration: Individual dynamic programming
- Bisection Search: Equilibrium interest rate computation
- Monte Carlo Simulation: Aggregate consistency verification
- Vectorized operations for efficiency
- Robust numerical methods
- Comprehensive error handling
- Detailed logging and progress tracking
If you use this implementation, please cite:
@software{edwards2024aiyagari,
author = {Edwards, Adam},
title = {Aiyagari (1994QJE): Uninsured Idiosyncratic Risk and Aggregate Saving - Computational Implementation},
url = {https://github.com/econ-ark/Aiyagari1994QJE},
version = {1.0.0},
year = {2024}
}And the original paper:
@article{aiyagari1994uninsured,
title = {Uninsured idiosyncratic risk and aggregate saving},
author = {Aiyagari, S. Rao},
journal = {The Quarterly Journal of Economics},
volume = {109},
number = {3},
pages = {659--684},
year = {1994},
publisher = {Oxford University Press},
doi = {10.2307/2118417}
}This project is licensed under the Apache 2.0 License - see the LICENSE file for details.
This is part of the Econ-ARK project. For questions or contributions, please:
- Check the Econ-ARK documentation
- Open an issue on GitHub
- Contact the development team