Week 10 Common Errors and Feedback Summary
Week 10 Common Errors and Feedback Summary
1. Overview
This week’s homework focused on the Stochastic Growth Model, Precautionary Savings, and the Endogenous Grid Method (EGM). Overall, the submissions were of high quality. Most of you successfully implemented the EGM (or a hybrid version) and correctly analyzed the effects of uncertainty and risk aversion on savings behavior.
2. Common Issues & Technical Remarks
A. Method Selection: EGM vs. VFI
The assignment asked for the Endogenous Grid Method (EGM) (or Coleman Policy Iteration).
- Observation: A few of you used Value Function Iteration (VFI).
- Feedback: While VFI is a valid method and gives correct results if the grid is fine enough, it is computationally much more expensive than EGM. EGM exploits the first-order conditions (Euler equation) to avoid the maximization step on the grid, making it orders of magnitude faster and more accurate for continuous-choice problems.
B. Efficiency in EGM: fzero vs. Interpolation
In the EGM step where you map total assets ($c + k’$) back to current capital ($k$), you need to invert the resource constraint: \(Res(k) = z k^\alpha + (1-\delta)k = \text{TotalAssets}\)
- Observation: Many of you used
fzeroinside the loop (for every grid point) to solve this equation. - Feedback: This works, but it’s slow. A more efficient approach is to:
- Pre-calculate the resource vector $R_{vec} = z K_{grid}^\alpha + (1-\delta)K_{grid}$ once for each state $z$.
- Use linear interpolation (
interp1) to map fromTotalAssetsback toK_grid. Since the resource function is monotonic, this inversion via interpolation is fast and accurate.
C. Simulation & Averaging
- Observation: A minor issue in some codes was how the simulation mean was calculated.
- Feedback: Always remember to discard the initial “burn-in” period (e.g., the first 100 periods) to ensure your statistics reflect the long-run stationary distribution, not the transition from the arbitrary initial condition.
3. Economic Interpretation
You generally did a very good job interpreting the results:
- Precautionary Savings: You correctly found that $\bar{K}{stoch} > \bar{K}{det}$. Uncertainty induces agents to save more to “self-insure” against bad productivity shocks.
- Risk Aversion: You correctly found that higher risk aversion ($\sigma=5$) leads to even higher capital accumulation compared to Log utility ($\sigma=1$). Agents who dislike consumption fluctuations more will hold a larger buffer stock of savings.
4. Best Practices Checklist for Next Time
- Check the requested method: If EGM is asked, try to implement it instead of falling back to VFI.
- Optimize loops: Avoid optimization solvers (
fzero,fminbnd) inside large loops if a direct calculation or interpolation is possible. - Verify arguments: If you change a function’s signature (inputs), make sure to update all calls to that function in your main script.
5. Conclusion
This was a technically challenging topic. Successfully implementing EGM is a significant milestone in computational economics. Correct work!