Week 9 Homework Feedback: Ignazio Nunzi
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
- Function Definition: ⚠️ Partial. You defined the function in a separate file, but the signature is
montecarlo_ols(n, R, beta0, beta1)instead of includingsigma. Your code inside hardcodesu = randn(n,1)which is equivalent to $\sigma=1$. - DGP Logic: ✅ Correct (assuming $\sigma=1$).
- OLS Logic: ✅ Correct manual implementation
(X'X)\(X'y). - Execution: ✅ Loops over multiple sample sizes ($50, 200, 500, 1000$).
- Visuals: ✅ Individual histograms plus an overlay histogram at the end.
- Statistics: ✅ Computes and displays variance (and coverage in the first section).
- Interpretation: ✅ Good discussion implied by the overlay plot.
Part 2: Numerical Integration
- Utility Function: ✅ CRRA with $\gamma=2$ correctly implemented.
- Trapezoidal Rule: ✅ Correct manual implementation.
- Simpson’s Rule: ✅ Correct manual implementation. You correctly handle the “even intervals” requirement by defining $N$ as intervals and creating $N+1$ points.
- Grid Loop: ❌ Missing. The homework asked to loop over $N \in {50, 200, 1000}$ to show convergence. You only calculated for $N=500$.
- Visuals: ❌ Missing. No convergence plot (Integral vs N) was generated.
- 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
- Follow Function Signatures: Always match the requested inputs/outputs exactly. The homework asked for
montecarlo_ols(..., sigma). - Complete All Loops: Ensure you run the analysis for all requested values (grid sizes) to generate the convergence plots.
- Save Figures: Add
saveasorexportgraphicsto 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).