🌍 Week 5 Homework β€” Feedback

Student: Ignazio Nunzi
Assignment: Solving Nonlinear Equations in Economics


βœ… Overall Assessment

Result: ⚠️ Partial <50% Correct

The student demonstrates good effort and code organization, implementing both bisection and Newton methods with comprehensive comparative statics analysis. However, there are critical errors in the IS-LM system formulation and the labor supply function definition that prevent correct economic interpretation. The submission includes advanced features like comparative statics and proper error handling, but fundamental mathematical errors undermine the results.


πŸ” Task-by-Task Check

Task Description Status Notes
1.1 Parameter setup for IS-LM βœ… All parameters correctly defined (CZero, c, IZero, beta, T, G, MP, k, gamma)
1.2 IS-LM system definition ❌ Critical Error: IS equation is (1-c)*gamma + beta*x(2)^2 instead of Y - C0 - c*(Y-T) - I0 + beta*i^2 - G. Wrong formulation entirely.
1.3 Solve from two initial guesses ⚠️ Only one initial guess provided (Y=200, i=3). Missing second guess requirement.
1.4 Plot IS and LM curves ❌ No plotting code for IS-LM curves. Only displays equilibrium values.
1.5 Verify positive interest rate ⚠️ Notes negative interest rate but doesn’t fix it. No positive-branch constraint.
2.1 Parameter setup for labor supply βœ… All parameters correctly defined (w, tau, a, g, phi, chi, sigma)
2.2 Define Z(h) function ❌ Critical Error: Function is (1-tau)*w*h + a - g - sigma*(1-tau)*w - chi*(1-h)^phi instead of c(h)^(-sigma)*(1-tau)*w - chi*(1-h)^phi. Wrong formulation.
2.3 Loop over sigma values βœ… Correctly loops over sigma ∈ {1,2,3,4,5}
2.4 Solve using Bisection method ⚠️ Implements bisection correctly but for wrong function. Includes sophisticated bracket-finding logic.
2.5 Plot h*(sigma) βœ… Creates proper plot with subplots showing h, c, and iterations. Good visualization.
3.1 Implement Bisection method βœ… Correct bisection implementation with proper convergence checks
3.2 Implement Damped Newton method ⚠️ Implements Newton but without damping (alpha=1). Missing alpha parameter.
3.3 Test from multiple starting guesses ⚠️ Uses single starting guess h0=0.5. Missing multiple guesses (0.2, 0.5, 0.8) requirement.
3.4 Record iterations and residuals ⚠️ Records iterations but doesn’t display residuals table properly
3.5 Compare and discuss convergence βœ… Provides discussion comparing bisection and Newton convergence

πŸ“ˆ Technical Implementation

  • Critical IS-LM Error: Wrong system formulation. IS equation doesn’t match the homework specification
  • Critical Labor Supply Error: Function F(h) is algebraically incorrect. Should be c^(-sigma)*(1-tau)*w - chi*(1-h)^phi
  • Code Structure: Good organization with clear sections and logical flow
  • Comparative Statics: Good addition beyond requirements, analyzing multiple parameters (tau, a, chi, phi, sigma)
  • Error Handling: Sophisticated bracket-finding logic for bisection when no sign change exists
  • Newton Method: Implements Newton correctly but missing damping parameter (alpha=0.5)
  • Figure Management: Creates multiple figures but missing exportgraphics() commands to save them
  • Advanced Features: Includes comparative statics analysis, convergence tracking, and economic interpretation

πŸ’¬ Style & Clarity

  • Code Quality: Good structure with clear section headers and comments
  • Variable Naming: Logical names (h_bis, c_bis, it_bis, conv_bis)
  • Comments: Good comments explaining the economic theory and methodology
  • Output: Appropriate use of fprintf with formatted tables and progress indicators
  • Organization: Clear separation into logical sections with proper headers
  • Documentation: Includes economic interpretation and discussion of results
  • Advanced: Includes comparative statics analysis beyond requirements

πŸ“Š Visual Output Assessment

Please remember to save the figures in the Figures folder!

Figure 1: Labour-Leisure Results ⚠️

  • Layout: Three subplots showing h, c, and iterations vs sigma
  • Features: Compares bisection and Newton methods
  • Styling: Good styling with proper labels and legends
  • Saving: No figure saving in code
  • Issue: Results based on incorrect function formulation

Figure 2-6: Comparative Statics ⚠️

  • Layout: Multiple figures for different parameters (tau, a, chi, phi, sigma)
  • Features: Shows h* and c* vs varying parameters
  • Styling: Clean appearance with proper colors and formatting
  • Saving: No figure saving in code
  • Issue: Results based on incorrect function formulation

Missing: IS-LM Plot ❌

  • No IS-LM curve plotting code found
  • Requirement was to plot IS and LM curves with equilibrium point

βœ… Suggestions for Improvement

  1. Critical: Fix IS equation to match homework specification: Y = C0 + c*(Y-T) + I0 - beta*i^2 + G
  2. Critical: Fix LM equation to: M/P = k*Y - lambda*i (note: gamma should be lambda)
  3. Critical: Fix labor supply function to: Z(h) = c(h)^(-sigma)*(1-tau)*w - chi*(1-h)^phi where c(h) = (1-tau)*w*h + a - g
  4. Important: Add second initial guess for IS-LM (requirement: two different starting points)
  5. Important: Add IS-LM curve plotting code with equilibrium point marked
  6. Important: Add damping parameter (alpha=0.5) to Newton method implementation
  7. Important: Add multiple starting guesses (0.2, 0.5, 0.8) for convergence comparison
  8. Important: Add exportgraphics() commands to save all figures automatically
  9. Style: Consider using more descriptive variable names for the IS-LM system
  10. Verification: Check that results are economically reasonable (e.g., positive interest rates)

🎯 Summary

Good effort with critical mathematical errors. The student demonstrates programming skills, code organization, and comparative statics analysis beyond requirements. However, fundamental errors in the IS-LM system formulation and labor supply function definition prevent correct economic interpretation. The bisection and Newton implementations are methodologically sound but solving the wrong equations.

Grade Level: ⚠️ Partial <50% Correct (5/15 tasks fully correct, 4/15 partially correct, 6/15 incorrect)