🌍 Week 4 Homework β€” Feedback

Student: Anna Cottura
Assignment: Extended IS–LM and Cholesky Decomposition


βœ… Overall Assessment

Result: βœ… More than 50% Correct

The student demonstrates good code organization, comprehensive comments, and implements most components correctly. However, there is a critical error in the A matrix construction that leads to economically incorrect results. The Cholesky decomposition and stochastic simulation are implemented correctly, but the IS-LM system setup contains fundamental mistakes. Additionally, figures are not saved in the code. Important: The original file name had spaces which prevented it from running properly.


πŸ” Task-by-Task Check

Task Description Status Notes
1 Parameter setup & system definition ❌ Critical Error: A matrix is [1, alpha; beta, -gamma] instead of [1, alpha; -beta, gamma]. Missing negative sign on beta. Excellent parameter definitions and comments.
2 Equilibrium solution ⚠️ Solves system correctly given the wrong A matrix, but results are economically incorrect due to matrix error. Uses both A\b and inv(A)*b for comparison.
3 Comparative statics setup βœ… Correctly creates G grid using linspace(50, 150, 101), loops through values, and stores results in Y_grid and i_grid arrays. Good range choice.
4 Plotting comparative statics βœ… Creates proper separate plots for Y vs G and i vs G, good styling, proper labels, and uses set(gcf,'Name',...) for figure names. No figure saving in code.
5 Cholesky decomposition βœ… Correctly defines Sigma matrix, computes eigenvalues, checks positive definiteness, computes L using chol(Sigma, 'lower'), and verifies reconstruction.
6 Stochastic simulation setup βœ… Correctly generates u ~ N(0,I) with proper dimensions (2Γ—10000), transforms to eps = L*u, and sets random seed (123).
7 Equilibrium distribution analysis βœ… Correctly computes empirical variances and covariances. Results are based on wrong underlying system but method is correct.
8 Visualization of stochastic results βœ… Creates scatter plot correctly with proper labels and styling. No figure saving in code.

πŸ“ˆ Technical Implementation

  • Critical Matrix Error: A matrix [1, alpha; beta, -gamma] should be [1, alpha; -beta, gamma] (missing negative sign on beta)
  • Code Structure: Excellent organization with clear sections and comprehensive comments
  • Numerical Methods: Uses correct A\b method and includes comparison with inv(A)*b
  • G Grid: Uses linspace(50, 150, 101) which is economically reasonable and shows good range
  • Figure Management: Missing saveas() commands in code, but uses set(gcf,'Name',...) for figure names
  • Advanced Features: Includes eigenvalue checking, efficient computation with AinvL = A \ L, and comprehensive output
  • Error Handling: Checks positive definiteness of Sigma matrix
  • Efficient Computation: Uses AinvL * U for efficient matrix operations

πŸ’¬ Style & Clarity

  • Code Quality: Excellent structure with clear section headers and comprehensive comments
  • Variable Naming: Logical names (Y_grid, i_grid, Y_sim, i_sim, i_rate)
  • Comments: Outstanding comments explaining economic theory and mathematical concepts
  • Output: Excellent use of fprintf and disp for displaying results
  • Organization: Clear separation into logical sections with proper headers
  • Documentation: Includes economic interpretation of parameters and equations
  • Advanced: Includes theoretical discussion of matrix operations and efficient computation

πŸ“Š Visual Output Assessment

Please remember to save the figures in the Figures folder!

Figure 1: Y vs G ⚠️

  • Layout: Separate plot for Y vs G
  • Relationships: Shows relationships, but based on wrong A matrix
  • Labels: Proper axis labels and title
  • Styling: Good styling with grid
  • Saving: No figure saving in code, but uses set(gcf,'Name','Y_vs_G')
  • Issue: Wrong relationships due to matrix error

Figure 2: i vs G ⚠️

  • Layout: Separate plot for i vs G
  • Relationships: Shows relationships, but based on wrong A matrix
  • Labels: Proper axis labels and title
  • Styling: Good styling with grid
  • Saving: No figure saving in code, but uses set(gcf,'Name','i_vs_G')
  • Issue: Wrong relationships due to matrix error

Figure 3: Scatter Plot ⚠️

  • Distribution: Scatter plot showing correlated shocks
  • Correlation: Shows correlation structure correctly
  • Styling: Good use of small markers (β€˜.’, β€˜MarkerSize’, 4)
  • Saving: No figure saving in code, but uses set(gcf,'Name','Scatter_Y_i')
  • Issue: Results based on incorrect underlying system due to matrix error

βœ… Suggestions for Improvement

  1. Critical: Fix A matrix to [1, alpha; -beta, gamma] instead of [1, alpha; beta, -gamma]
  2. Important: Add saveas() commands to save figures automatically
  3. Style: Consider using subplots for comparative statics to match solution format
  4. Verification: Check that results are economically reasonable
  5. Advanced: Consider adding theoretical vs empirical covariance comparison

🎯 Summary

Excellent implementation with critical economic error. The student demonstrates outstanding programming skills, comprehensive comments, and proper figure management. However, the missing negative sign in the A matrix prevents correct economic interpretation of the IS-LM system.

Grade Level: βœ… More than 50% Correct (6/8 tasks fully correct, 1/8 partially correct, 1/8 incorrect)