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

  1. Parameter & Grid Setup: ✅ Correct.
  2. Solution Method: ✅ EGM logic is conceptually correct (computing MU from future state).
  3. Deterministic Case: ✅ Solved.
  4. Stochastic Case: ✅ Solved.
  5. Simulation: ❌ Critical Error: Your simulate_model function expects 7 arguments (Kgrid, Kpol, Z, P, alpha, delta, T) but you call it with 6 (..., Tsim, burn). This mismaps the arguments (assigning Tsim to alpha, etc.) and leaves T undefined, which causes a crash.
  6. Comparison: ❌ Because the simulation returns a vector (the whole path), your calculation (kbar_sto - kbar_det)/kbar_det would act element-wise on the whole series rather than on the mean, even if the function ran.

Task 2: The Role of Risk Aversion

  1. Sigma Variation: ✅ Setup is correct.
  2. Solving Sigma Cases: ✅ Solved.
  3. Policy Plot: ✅ Generated correctly.
  4. Simulation Comparison: ❌ Same simulation error as above.
  5. Interpretation: ✅ Your written discussion is correct, even if the code calculating the specific numbers was broken.

Technical Implementation

  • EGM Logic: Your solve_egm function is sophisticated. The way you compute MU_old by 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

  1. Debugging: Always run your final script from a fresh workspace (clear all) before submitting to catch argument mismatches.
  2. Averaging: Remember that simulate_model returns the path of capital. You need to take mean(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.