Week 10 Homework Feedback: Alice Ciavatta
Week 10 Homework Feedback: Alice Ciavatta
Overall Assessment
Grade: ✅ (Pass)
You demonstrated a strong understanding of the EGM method and set up the problem correctly. However, there is a critical bug in your code that prevents the simulation and results calculation from running correctly. You passed the wrong number of arguments to your simulate_model function, and you treated the output vector as a scalar mean. Despite this, your core implementation of the difficult part (EGM) is correct, and you meet the criteria for a pass.
Task-by-Task Check
Task 1: Quantifying Precautionary Savings
- Parameter & Grid Setup: ✅ Correct.
- Solution Method: ✅ EGM logic is conceptually correct (computing MU from future state).
- Deterministic Case: ✅ Solved.
- Stochastic Case: ✅ Solved.
- Simulation: ❌ Critical Error: Your
simulate_modelfunction expects 7 arguments (Kgrid, Kpol, Z, P, alpha, delta, T) but you call it with 6 (..., Tsim, burn). This mismaps the arguments (assigningTsimtoalpha, etc.) and leavesTundefined, which causes a crash. - Comparison: ❌ Because the simulation returns a vector (the whole path), your calculation
(kbar_sto - kbar_det)/kbar_detwould act element-wise on the whole series rather than on the mean, even if the function ran.
Task 2: The Role of Risk Aversion
- Sigma Variation: ✅ Setup is correct.
- Solving Sigma Cases: ✅ Solved.
- Policy Plot: ✅ Generated correctly.
- Simulation Comparison: ❌ Same simulation error as above.
- Interpretation: ✅ Your written discussion is correct, even if the code calculating the specific numbers was broken.
Technical Implementation
- EGM Logic: Your
solve_egmfunction is sophisticated. The way you computeMU_oldby calculating implied consumption from the policy function is a valid approach. - Bugs: The mismatch in function arguments suggests you might have edited the function definition without updating the calls.
Visual Output
- The policy function plot is saved and looks correct.
Suggestions for Improvement
- Debugging: Always run your final script from a fresh workspace (
clear all) before submitting to catch argument mismatches. - Averaging: Remember that
simulate_modelreturns the path of capital. You need to takemean(kbar_det)after the function returns to get the scalar value for comparison.
Summary
8/11 tasks correct (logic is good, but execution fails on simulation). I’ve marked this as a Pass because the hard part (EGM) was done well, but please be careful with function arguments.