Student Name: Chiara Tombolini Assignment: Week 9 - Monte Carlo OLS & Numerical Integration

Overall Assessment

Grade: ⚠️ (Partial)

The submission has several issues preventing successful execution and correct results. First, the file structure is invalid (function defined at the top of a script). Second, the Simpson’s rule implementation detects even grids (which all required N values are) but then sets the result to NaN instead of adjusting the grid to calculate a value. This contradicts your comments stating that Simpson’s rule was “more accurate,” as your code actually produced no results for it.

Task-by-Task Check

  1. Function Definition: ⚠️ Structure Error. The function is at the top of the file. It must be at the end.
  2. DGP Logic: ✅ Correct.
  3. OLS Logic: ⚠️ Logic Error. You calculate mean and var of beta1_hat (lines 22-23) before the loop that fills it. This results in 0 values being printed initially.
  4. Execution: ⚠️ Script flow is broken by structure.
  5. Visuals: ✅ Code for histograms present.
  6. Statistics: ❌ Computed on empty vector initially.
  7. Interpretation: ✅ Text present.
  8. Utility Function: ✅ Correct.
  9. Trapezoidal Rule: ✅ Correct.
  10. Simpson’s Rule: ❌ Incorrect. You correctly identify that N is even, but instead of fixing it (e.g., by using N-1 points), you output NaN. Since N=50, 200, 1000 are all even, you get no Simpson results.
  11. Grid Loop: ✅ Correct.
  12. Visuals: ✅ Code present.
  13. Interpretation: ❌ Your comments claim Simpson is more accurate, but your code produced NaN for all cases. This suggests the interpretation was written without checking the results.

Technical Implementation

  • Structure: Invalid MATLAB file structure.
  • Logic: Printing stats of an empty vector.
  • Simpson: Returning NaN instead of handling the grid.

Suggestions for Improvement

  1. Move Function: Place montecarlo_ols at the end of the file.
  2. Fix Stats: Calculate mean/var after the loop in the function (or in the main script).
  3. Fix Simpson: If mod(N,2)==0, use c(1:end-1) and uc(1:end-1) to perform the calculation, rather than returning NaN.

Summary

5/13 tasks correct. Significant structural and logical errors need addressing.