๐ Week 5 Homework โ Feedback
๐ Week 5 Homework โ Feedback
Student: Klea Lushaj
Assignment: Solving Nonlinear Equations in Economics
โ Overall Assessment
Result: โ More than 50% Correct
The student demonstrates understanding of numerical methods and submits all three exercises with detailed output and discussion. Exercise 1 IS-LM implementation has a minor LM equation sign issue and plotting range cuts off the positive interest rate equilibrium (plots Y only up to 700). Exercise 2 has issues with the Z(h) function implementation and likely produces incorrect results. Exercise 3 is implemented correctly with appropriate bisection and damped Newton methods and includes detailed analysis. The code structure is good with clear separation into three files.
๐ Task-by-Task Check
| Task | Description | Status | Notes | ย | ย |
|---|---|---|---|---|---|
| 1.1 | Parameter setup for IS-LM | โ | All parameters correctly defined | ย | ย |
| 1.2 | IS-LM system definition | โ ๏ธ | System formulation has wrong sign on LM equation | ย | ย |
| 1.3 | Solve from two initial guesses | โ | Two guesses provided (x0_1=[500;5], x0_2=[400;10]) | ย | ย |
| 1.4 | Plot IS and LM curves | โ ๏ธ | Creates plot but Y range [300,700] cuts off positive solution | ย | ย |
| 1.5 | Verify positive interest rate | โ | Verifies positive interest rate | ย | ย |
| 2.1 | Parameter setup for labor supply | โ | All parameters correctly defined | ย | ย |
| 2.2 | Define Z(h) function | โ ๏ธ | Function has potential issues with vectorization | ย | ย |
| 2.3 | Loop over sigma values | โ | Correctly loops over sigma โ {1,2,3,4,5} | ย | ย |
| 2.4 | Solve using Bisection method | โ | Implements bisection correctly with sophisticated corner solution detection (chooses boundary with smaller | Z | ) |
| 2.5 | Plot h*(sigma) and interpret | โ ๏ธ | Creates plot but shows incorrect results (you noted โex 2 seems wrongโ) | ย | ย |
| 3.1 | Implement Bisection method | โ | Correct bisection implementation | ย | ย |
| 3.2 | Implement Damped Newton method | โ | Implements damped Newton with alpha=0.5 and analytical derivative | ย | ย |
| 3.3 | Test from multiple starting guesses | โ | Tests from three guesses (0.2, 0.5, 0.8) | ย | ย |
| 3.4 | Record iterations and residuals | โ | Records and displays all iterations and residuals in table | ย | ย |
| 3.5 | Compare and discuss convergence | โ | Provides detailed discussion and visualization of convergence | ย | ย |
๐ Technical Implementation
- IS-LM System: โ ๏ธ LM equation has wrong sign:
MP - k*x(1) + lambda*x(2)]should beMP - k*x(1) + lambda*x(2)orMP - (k*x(1) - lambda*x(2)) - Labor Supply Function: Function definition may have issues with vectorization
- Bisection Method: Correct implementation with proper sign change logic (
< 0) -
Corner Solutions: โ Excellent - Sophisticated corner solution detection that identifies which boundary (h=0 or h=1) is closer to being a root by comparing Z(a) vs Z(b) - Damped Newton: Correct implementation with alpha=0.5 and analytical derivative
- Error Handling: Includes sign change checks, proper bounds handling, and advanced corner solution diagnostics
- Figure Management: โ Saves figures as PNG files
- Advanced Features: Includes detailed discussion, interpretation, visualization of convergence comparison, and comprehensive corner solution reporting
๐ฌ Style & Clarity
- Code Quality: Good structure with clear separation into three files (exone.m, extwo.m, exthree.m)
- Variable Naming: Clear names (
h_star,sigma_values,x_star_1) - Comments: Good comments explaining methodology
- Output: Appropriate use of
fprintfwith detailed tables and analysis - Organization: Clear separation into three exercises in separate files
๐ Visual Output Assessment
Figure 1: IS-LM Equilibrium โ ๏ธ
- Layout: Plot with IS and LM curves and equilibrium point
- Features: Shows both positive and negative interest rate branches
- Styling: Appropriate styling with proper labels and legend
- Saving: โ Saves as PNG file (Figurex1.png)
- Issue: Your note: โAlthough she plots Y up to 700 so missing the positive solution for iโ - the plotting range is too narrow
Figure 2: Labor Supply h*(ฯ) โ
- Layout: Plot showing h* vs sigma values
- Features: Shows labor supply for different risk aversion parameters
- Styling: Appropriate styling with proper labels and value annotations
- Saving: โ Saves as PNG file (Figurex2.png)
- Issue: Your note: โEx 2 seems wrongโ - the plot shows incorrect results
Figure 3: Convergence Comparison โ
- Layout: Plot comparing iteration counts between methods
- Features: Shows bisection vs Newton for different starting guesses
- Styling: Appropriate styling with proper labels and annotations
- Saving: โ Saves as PNG file (Figurex3.png)
- Quality: Good visualization of convergence comparison
โ Suggestions for Improvement
- Critical: Fix Exercise 1 LM equation sign - should be
MP - (k*x(1) - lambda*x(2))notMP - k*x(1) + lambda*x(2) - Critical: Expand Exercise 1 plotting range to Y up to 900 or 1000 to show the positive interest rate equilibrium
- Critical: Check Exercise 2 Z(h) function definition - there may be issues with the formulation
- Important: Verify that Exercise 2 results are economically reasonable (h* should be in [0,1])
- Style: The code uses sigma=1 in Exercise 3 instead of sigma=2 as intended
- Verification: Run Exercise 2 with correct Z(h) function to verify results
๐ฏ Summary
Good submission with minor errors. The student demonstrates understanding of numerical methods and implements all three exercises with detailed output and discussion. Exercise 1 has a minor LM equation sign issue and plotting range issue. Exercise 2 shows incorrect results likely due to problems with the Z(h) function. Exercise 3 is implemented correctly with proper comparison between bisection and damped Newton methods, including visualization and detailed discussion. The code is well-organized with clear separation into three files and comprehensive output.
Grade Level: โ More than 50% Correct (10/15 tasks fully correct, 4/15 partially correct, 1/15 incorrect)