🌍 Week 5 Homework β€” Feedback

Student: Felice Urciuoli
Assignment: Solving Nonlinear Equations in Economics


βœ… Overall Assessment

Result: βœ… More than 50% Correct

Good submission with correct IS-LM implementation and proper numerical methods. The student demonstrates strong understanding of the mathematical formulations and implements both bisection and damped Newton methods correctly. However, there are critical issues: (1) Exercise 2 shows incorrect results - h* values approach 1.0 as sigma increases, which is economically unreasonable since higher risk aversion should decrease labor supply, and (2) missing figure saving. The IS-LM system is perfectly implemented, but the labor supply results suggest a fundamental issue with the economic interpretation or parameter values.


πŸ” Task-by-Task Check

Task Description Status Notes
1.1 Parameter setup for IS-LM βœ… All parameters correctly defined (C0, c, I0, beta, T, G, MP, k, lambda)
1.2 IS-LM system definition βœ… Correct formulation [Y-(C0+c*(Y-T)+I0-beta*i^2+G); MP-(k*Y-lambda*i)]
1.3 Solve from two initial guesses βœ… Two guesses provided (z0_1=[300;3], z0_2=[150;1.5]) and both converge to same equilibrium
1.4 Plot IS and LM curves βœ… Creates proper IS-LM plot with curves, equilibrium point, and positive branch constraint
1.5 Verify positive interest rate βœ… Correctly implements positive branch constraint with sqrt(max(num/beta, 0))
2.1 Parameter setup for labor supply βœ… All parameters correctly defined (w, tau, a, g, phi, chi)
2.2 Define Z(h) function βœ… Correct formulation c_h(h)^(-sigma)*(1-tau)*w - chi*(1-h)^phi
2.3 Loop over sigma values βœ… Correctly loops over sigma ∈ {1,2,3,4,5}
2.4 Solve using Bisection method ❌ Critical Error: Wrong sign change logic fa * fc <= 0 instead of fa * fc < 0. Causes convergence to wrong root (h* β†’ 1)
2.5 Plot h*(sigma) ❌ Critical Error: Creates plot but shows incorrect results (h* approaching 1.0 as sigma increases, which is economically unreasonable)
3.1 Implement Bisection method βœ… Correct bisection implementation with proper convergence criteria
3.2 Implement Damped Newton method βœ… Implements damped Newton with alpha=0.5 and proper derivative
3.3 Test from multiple starting guesses βœ… Tests from three starting points (0.2, 0.5, 0.8) as required
3.4 Record iterations and residuals βœ… Records and displays iterations for each method and starting point
3.5 Compare and discuss convergence βœ… Provides clear output comparing bisection vs Newton convergence

πŸ“ˆ Technical Implementation

  • IS-LM System: Correct formulation and implementation with proper Newton method
  • Labor Supply Function: Correct economic formulation with proper consumption function
  • Bisection Method: Good implementation with proper convergence criteria
  • Damped Newton: Correct implementation with alpha=0.5 damping and derivative protection
  • Code Structure: Clean organization with clear sections and good comments
  • Error Handling: Includes protection against small derivatives and proper convergence checks
  • Figure Management: Creates proper figures but missing exportgraphics() commands
  • Advanced Features: Implements custom Newton method instead of relying on built-in functions

πŸ’¬ Style & Clarity

  • Code Quality: Good structure with clear section headers and comments
  • Variable Naming: Logical names (z0_1, z0_2, hstars, sigmas)
  • Comments: Good comments explaining the methodology and economic interpretation
  • Output: Professional use of fprintf with formatted results and convergence information
  • Organization: Clear separation into logical sections with proper headers
  • Documentation: Includes economic interpretation and convergence analysis
  • Local Functions: Well-implemented local functions for Newton and bisection methods

πŸ“Š Visual Output Assessment

Please remember to save the figures in the Figures folder!

Figure 1: IS-LM Equilibrium βœ…

  • Layout: Clean plot showing IS and LM curves with equilibrium point
  • Features: Correctly implements positive branch constraint for IS curve
  • Styling: Good styling with proper labels, legend, and grid
  • Saving: No figure saving in code
  • Quality: Shows correct economic interpretation

Figure 2: Labor Supply h*(Οƒ) ❌

  • Layout: Stem plot showing h* vs sigma values
  • Features: Shows incorrect results (h* approaching 1.0 as sigma increases)
  • Styling: Clean appearance with proper labels and grid
  • Saving: No figure saving in code
  • Issue: Results are economically unreasonable - higher risk aversion should decrease labor supply

βœ… Suggestions for Improvement

  1. Critical: Fix bisection sign change logic: change fa * fc <= 0 to fa * fc < 0 in line 121
  2. Critical: The <= condition causes convergence to wrong root when fc = 0 exactly
  3. Important: Add exportgraphics() commands to save all figures automatically
  4. Important: Add sign change verification before starting bisection (check if fa * fb < 0)
  5. Style: Consider adding more detailed economic interpretation of results
  6. Verification: Add verification that solutions satisfy original equations Z(h*) β‰ˆ 0

🎯 Summary

Good work with correct IS-LM implementation but critical bisection algorithm error. The student demonstrates strong understanding of numerical methods and implements the IS-LM system perfectly. The labor supply function formulation is mathematically correct, and the damped Newton method is implemented accurately. However, there’s a critical error in the bisection algorithm: using fa * fc <= 0 instead of fa * fc < 0 for sign change detection. This causes the algorithm to converge to the wrong root (h* β†’ 1) instead of the true interior solution. This is a classic numerical analysis error that leads to economically unreasonable results.

Grade Level: βœ… More than 50% Correct (11/15 tasks fully correct, 2/15 incorrect)

Good submission with critical numerical algorithm error ⚠️