Student Name: Pablo Romanella Assignment: Week 9 - Monte Carlo OLS & Numerical Integration

Overall Assessment

Grade: ✅ (Pass)

The submission implements both parts of the assignment. The Monte Carlo simulation is correctly done. In the numerical integration section, the manual implementation of Simpson’s rule does not account for the requirement that the number of grid points must be odd (or the number of intervals even) for the standard 1/3 formula. Since the requested grid sizes included even numbers (50, 200, 1000), this leads to incorrect weighting for those specific cases.

Task-by-Task Check

  1. Function Definition: ✅ montecarlo_ols is correctly defined.
  2. DGP Logic: ✅ Correct.
  3. OLS Logic: ✅ Correct.
  4. Execution: ✅ Loops over sample sizes.
  5. Visuals: ✅ Histograms are clear.
  6. Statistics: ✅ Mean and variance reported.
  7. Interpretation: ✅ Correctly identifies variance reduction with sample size.
  8. Utility Function: ✅ Correct.
  9. Trapezoidal Rule: ✅ Correct trapz.
  10. Simpson’s Rule: ⚠️ Issue. The formula (h/3) * (f(1) + 4*sum... assumes an odd number of points (even number of intervals). For N=50, this formula does not align perfectly with the grid indices. You should check mod(N,2) and either truncate the grid or use a different handling for the last interval.
  11. Grid Loop: ✅ Correct.
  12. Visuals: ❌ The output text suggests plots are generated, but the code saveas(gcf... was not present in the submitted main script (or not successfully executed/saved in a way that persisted). Correction: You used savefig and saveas at the end.
  13. Interpretation: ✅ General interpretation is correct.

Technical Implementation

  • Code Structure: Simple and effective.
  • Issues: Simpson’s rule logic for even grids.

Suggestions for Improvement

  • Simpson’s Rule: Add a check if mod(N,2)==0 to handle even grid sizes (e.g., by using N-1 points or using Trapezoid for the last interval).

Summary

11/13 tasks correct. Good work, with a minor technical oversight on Simpson’s rule parity.