Student Name: Giovanni Di Miele Assignment: Week 9 - Monte Carlo OLS & Numerical Integration

Overall Assessment

Grade: ✅ (Pass)

The submission is excellent. The Monte Carlo section is complete. The numerical integration section is particularly sophisticated: you implemented a hybrid Simpson’s rule that handles even grid sizes by applying the Trapezoidal rule to the final interval. This is a valid and clever way to handle general grids. Note a minor issue in montecarlo_ols regarding the random number generation arguments.

Task-by-Task Check

  1. Function Definition: ⚠️ Minor Issue. u = randn(n,sigma^2) works when sigma=1, but if sigma=2, it would create an n by 4 matrix, causing a dimension mismatch. It should be u = sigma * randn(n, 1).
  2. DGP Logic: ✅ Correct (for sigma=1).
  3. OLS Logic: ✅ Correct.
  4. Execution: ✅ Correct.
  5. Visuals: ✅ Histograms saved correctly.
  6. Statistics: ✅ Computed and displayed.
  7. Interpretation: ✅ Good.
  8. Utility Function: ✅ Correct.
  9. Trapezoidal Rule: ✅ Correct.
  10. Simpson’s Rule: ✅ Correct. You correctly identified the parity issue and implemented a hybrid approach (Simpson core + last interval Trapezoid). This is a very good solution.
  11. Grid Loop: ✅ Correct.
  12. Visuals: ✅ Convergence plot included.
  13. Interpretation: ✅ Correct.

Technical Implementation

  • Robustness: The hybrid integration method is excellent. The OLS function is slightly fragile regarding sigma.

Suggestions for Improvement

  • Random Numbers: In MATLAB, randn(n, m) creates an n-by-m matrix. To scale variance, multiply the result: sigma * randn(n, 1).

Summary

12/13 tasks correct. Strong work, especially on the integration algorithms.