π Week 5 Homework β Feedback
π 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
fprintfwith 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
- Critical: Fix bisection sign change logic: change
fa * fc <= 0tofa * fc < 0in line 121 - Critical: The
<=condition causes convergence to wrong root whenfc = 0exactly - Important: Add
exportgraphics()commands to save all figures automatically - Important: Add sign change verification before starting bisection (check if
fa * fb < 0) - Style: Consider adding more detailed economic interpretation of results
- 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 β οΈ