Feedback on Week 9 Homework: Numerical Approximation & Simulation

Student: Giovanni Rampello Assignment: Week 9 - Monte Carlo OLS & Numerical Integration

Overall Assessment

Grade: ✅ (Pass)

Your submission covers the main requirements of the assignment. The Monte Carlo simulation is correctly implemented and analyzed. In the numerical integration part, there is a technical issue with the application of Simpson’s rule to even grid sizes, and the visual analysis of convergence is missing.

Task-by-Task Check

Part 1: Monte Carlo OLS

  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 with normal approximation are correctly generated.
  6. Statistics: ✅ Empirical mean and variance calculated.
  7. Interpretation: ✅ Good answers to the questions in the comments.

Part 2: Numerical Integration

  1. Utility Function: ✅ CRRA utility correctly defined.
  2. Trapezoidal Rule: ✅ Correctly implemented using trapz.
  3. Simpson’s Rule: ⚠️ Parity Issue. You applied the standard Simpson’s 1/3 rule formula to grids of size $N \in {50, 200, 1000}$. Since these $N$ are even, the number of intervals is odd. The formula you used (h/3) * (u(1) + 4*sum(...) + 2*sum(...) + u(end)) implicitly skips the second-to-last point (index $N-1$) when $N$ is even, leading to an incorrect approximation.
  4. Grid Loop: ✅ Integration performed over grid sizes.
  5. Visuals: ⚠️ Missing Convergence Plot. You printed the results in a table, which is good, but the assignment expected a plot of the integral value (or error) vs. $N$ to visualize the convergence behavior.
  6. Interpretation: ✅ Good interpretation in comments.

Technical Implementation

  • Code Structure: Clean and readable.
  • Simpson’s Rule: To fix the parity issue, you should either use an odd $N$ (like 51, 201) or handle the even $N$ case by adjusting the grid (e.g., using Simpson’s on the first $N-1$ points and Trapezoidal on the last interval).

Style & Clarity

  • Output: Results are clearly displayed in the command window.
  • Documentation: Good comments answering the questions.

Suggestions for Improvement

  1. Algorithm Constraints: Always check if the input parameters (like grid size) satisfy the requirements of the numerical method (like Simpson’s rule needing even intervals).
  2. Visualizing Convergence: A plot is often more effective than a table for showing how quickly a numerical method approaches the true value.

Summary

A solid effort. The OLS part is well done. The integration part needs a correction regarding the grid size requirement for Simpson’s rule.

Tasks Correct: 11/13