Week 6
Week 6 – Optimization & Calibration
Learning Outcomes By the end of this week, students will be able to:
- Understand the difference between unconstrained and constrained optimization.
- Use MATLAB’s built-in optimization functions (
fminsearch
,fmincon
). - Implement simple search methods (e.g., golden section search) manually.
- Calibrate model parameters to match economic targets.
- Assess goodness of fit for calibration exercises.
Suggested Readings
- Greenwood & Marto, Numerical Methods for Macroeconomists, Ch. 3 (Optimization) – focus on unconstrained search and constrained optimization.
In-Class Activities
- Implement golden section search to maximize a quadratic function.
- Use
fminsearch
to minimize a negative Cobb–Douglas utility function $U(c, l) = c^{\alpha} l^{1-\alpha}$. - Constrained optimization example with
fmincon
:- Maximize utility subject to budget and time constraints.
- Calibration exercise:
- Target steady-state labor supply = 0.3 of time endowment.
- Choose preference parameter $\alpha$ to match target.
Homework / Practice
- Calibrate a simple Solow model parameter (e.g., savings rate) to match observed output growth over time.
- Compare results from:
- Manual search (looping over candidate values).
- Built-in MATLAB optimization functions.
- Plot the objective function over a parameter range and mark the optimum.
Files
- Slides Week 6 – Slides from lecture.
- codes_week6 on Matlab online
- week6.m – Example script from lecture.
- solve_lstar.m – Helper function for in class example.
- make_fig_opt_curve.m – File to reproduce figure for: “Visualizing Optimization” slide.
- make_fig_golden_vs_fminsearch.m – File to reproduce figure for: “Comparing Search Methods” slide.
- week6_challenge_starter.m – Starter file for the challenge.
Homework submission
- Submit your homework here
- Please upload your homework as a single zip file. Access it’s now open with any email address! But remember to name your file with your full name and or student ID.
- The submission should include the .m file used to produce the results.
- You can modify you submission until the beginning of week 7.