Week 10 Homework Feedback: Alessia Canuto
Week 10 Homework Feedback: Alessia Canuto
Overall Assessment
Grade: ✅ (Pass)
Correct submission. You have correctly implemented the Endogenous Grid Method (EGM) with a hybrid approach (using fzero), simulated the economies, and analyzed the effects of uncertainty and risk aversion. Your code is well-structured, and your results are accurate.
Task-by-Task Check
Task 1: Quantifying Precautionary Savings
- Parameter & Grid Setup: ✅ Correctly defined.
- Solution Method: ✅ EGM implemented correctly (using a root-finder for the resource constraint inversion).
- Deterministic Case: ✅ Solved with low $\sigma_\epsilon$.
- Stochastic Case: ✅ Solved with $\sigma_\epsilon = 0.04$.
- Simulation: ✅ Correctly simulated (1000 periods).
- Comparison: ✅ Precautionary savings premium calculated correctly.
Task 2: The Role of Risk Aversion
- Sigma Variation: ✅ Handled $\sigma=1$ and $\sigma=5$.
- Solving Sigma Cases: ✅ Models re-solved correctly.
- Policy Plot: ✅ Both policy functions plotted on the same graph.
- Simulation Comparison: ✅ Mean capital compared.
- Interpretation: ✅ Correct discussion of the results.
Technical Implementation
- Code Structure: Very clean. The separation into
solve_egm_policy.mandrun_simulation.mis good practice. - EGM Implementation: You used
fzeroto invert the resource constraint ($k_{endo}$ finder). While this is mathematically correct and works fine here, the “pure” EGM typically uses interpolation or analytical inversion (if possible) to be faster. Usingfzeroinside the loop makes it slightly slower (more like the Coleman method efficiency-wise), but simpler to implement for general production functions. - File Management: Good.
Visual Output
- The plot for Task 2 is clear, labeled, and legible.
Suggestions for Improvement
- EGM Efficiency: In the
solve_egm_policyfunction, instead of usingfzeroto findk_endofor every grid point, you can simply calculate total assets $A = c + k’$ and then interpolate. Since $TotalAssets(k) = A(z)k^\alpha + (1-\delta)k$ is monotonic, you can compute this vector for the wholeK_gridonce per $z$, and then useinterp1to map back from Assets to $k$. This avoids the loop withfzero.
Summary
11/11 tasks correct. Correct work!