Week 9 Homework Feedback: Ignazio Nunzi

Assignment: “Week 9: Monte Carlo OLS & Numerical Integration”

Overall Assessment

Grade: ✅ (Pass)

The Monte Carlo simulation analysis is detailed, including coverage intervals and an overlay histogram. However, the montecarlo_ols function definition is missing the sigma parameter required by the instructions (it implicitly assumes $\sigma=1$). For the integration part, the methods are implemented correctly but the result is computed for only one grid size ($N=500$), missing the convergence analysis loop and plot requested in the homework.

Task-by-Task Check

Part 1: Monte Carlo OLS

  1. Function Definition: ⚠️ Partial. You defined the function in a separate file, but the signature is montecarlo_ols(n, R, beta0, beta1) instead of including sigma. Your code inside hardcodes u = randn(n,1) which is equivalent to $\sigma=1$.
  2. DGP Logic: ✅ Correct (assuming $\sigma=1$).
  3. OLS Logic: ✅ Correct manual implementation (X'X)\(X'y).
  4. Execution: ✅ Loops over multiple sample sizes ($50, 200, 500, 1000$).
  5. Visuals: ✅ Individual histograms plus an overlay histogram at the end.
  6. Statistics: ✅ Computes and displays variance (and coverage in the first section).
  7. Interpretation: ✅ Good discussion implied by the overlay plot.

Part 2: Numerical Integration

  1. Utility Function: ✅ CRRA with $\gamma=2$ correctly implemented.
  2. Trapezoidal Rule: ✅ Correct manual implementation.
  3. Simpson’s Rule: ✅ Correct manual implementation. You correctly handle the “even intervals” requirement by defining $N$ as intervals and creating $N+1$ points.
  4. Grid Loop: ❌ Missing. The homework asked to loop over $N \in {50, 200, 1000}$ to show convergence. You only calculated for $N=500$.
  5. Visuals: ❌ Missing. No convergence plot (Integral vs N) was generated.
  6. Interpretation: ⚠️ Partial. You compare the two methods for one point, but miss the convergence trend discussion.

Technical Implementation

  • Code Organization: Good. Function in separate file.
  • Figures: Figures generated but not saved (no saveas).

Suggestions for Improvement

  1. Follow Function Signatures: Always match the requested inputs/outputs exactly. The homework asked for montecarlo_ols(..., sigma).
  2. Complete All Loops: Ensure you run the analysis for all requested values (grid sizes) to generate the convergence plots.
  3. Save Figures: Add saveas or exportgraphics to save your plots.

Summary

9/13 tasks correct. Strong on the OLS visualization, but the numerical integration part was incomplete (missing the convergence loop and plot).