Skip to content

Commit 374bf14

Browse files
jstacclaudemmcky
authored
Refactor McCall lecture: Emphasize persistent and transitory wage shocks (#691)
* Complete Job Search IV lecture: Add utility function and fitted VFI implementation Updated mccall_fitted_vfi.md to implement the continuous wage offer model with CRRA utility. Key changes: - Added CRRA utility function u(c, γ) = (c^(1-γ) - 1)/(1-γ) to mathematical formulation - Updated Model class to include ρ, ν, and γ parameters - Implemented Monte Carlo integration for computing conditional expectations (Pv_u)(w) - Updated Bellman operator T() to use u(w, γ) and u(c, γ) - Added get_greedy() function for computing optimal policy - Fixed all model unpacking throughout code - Implemented compute_expectation() using w' = w^ρ * exp(ν * z) with standard normal draws - Added Exercise 3: Exploring reservation wage as function of risk aversion γ - Reformatted text: each sentence on separate line for better version control Mathematical consistency: - Code now matches theory where wages and unemployment compensation enter through utility function - Monte Carlo approximation: (Pv_u)(w) ≈ (1/N) Σ v_u(w^ρ exp(ν z_i)) - Proper JAX implementation with interpolation for fitted value function iteration 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * Rename and refactor McCall lecture to emphasize persistent and transitory wage shocks Renamed mccall_correlated.md to mccall_persist_trans.md to better reflect the lecture's focus on the decomposition of wages into persistent and transitory components, distinguishing it from the earlier mccall_model_with_sep_markov.md lecture. Key changes: - Updated title to "Job Search V: Persistent and Transitory Wage Shocks" - Rewrote Overview section to: - Emphasize the persistent-transitory decomposition as the key innovation - Add references to baseline model (mccall_model) and Job Search III (mccall_model_with_sep_markov) - Explain why we return to permanent jobs (to isolate wage dynamics effects) - Note use of fitted value function iteration from Job Search IV - Replaced 'jr' abbreviation with explicit 'jax.random' throughout for clarity - Refactored draw_τ function: - Renamed to draw_duration for clarity - Extracted as standalone JIT-compiled function with explicit parameters - Prevents unnecessary recompilation when model parameters change - compute_unemployment_duration now serves as a clean wrapper - Simplified JobSearchModel class to Model - Changed Model instantiation to use positional arguments instead of keyword arguments - Fixed grammatical errors throughout the text (added missing commas, articles, etc.) - Updated _toc.yml to reflect filename change 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * fix: syntax for code-cell error * Convert mccall_persist_trans.md to MyST format Used jupytext to convert the file from markdown to MyST format: - Changed format_name from "markdown" to "myst" in YAML frontmatter - Converted all ```python code blocks to ```{code-cell} ipython directives - Removed extra "jupyter:" wrapper level in frontmatter - Updated format_version to match other lecture files (0.13) This ensures the file is properly processed as a MyST markdown file consistent with all other lectures in the repository. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * Convert mccall_model_with_sep_markov.md to MyST format Used jupytext to convert Job Search III lecture from markdown to MyST format: - Changed format_name from "markdown" to "myst" in YAML frontmatter - Converted all ```python code blocks to ```{code-cell} ipython3 directives - Removed extra "jupyter:" wrapper level in frontmatter - Updated format_version to match other lecture files (0.13) This was the only remaining lecture file in the repository using plain markdown format instead of MyST. All lectures are now consistent. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * Add missing bibliography entries for MaCurdy1982 and Meghir2004 Added two bibliography entries referenced in mccall_persist_trans.md: - MaCurdy (1982): "The use of time series processes to model the error structure of earnings in a longitudinal data analysis" - Meghir & Pistaferri (2004): "Income variance dynamics and heterogeneity" These are classic references on wage dynamics in labor economics, used to support the persistent-transitory decomposition approach in Job Search V. This fixes the build warnings: WARNING: could not find bibtex key "MaCurdy1982" WARNING: could not find bibtex key "Meghir2004" 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * Remove duplicate section in mccall_fitted_vfi.md Removed a duplicated section that repeated the Bellman operator explanation and P operator definitions. The section starting with "In the discrete case, we ended up iterating on the Bellman operator" was appearing twice (lines 97-135 and 140-177), along with a duplicate "### Fitting" header. Removed the duplicate at lines 140-177, keeping only the first occurrence. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * Replace \RR with \mathbb{R} in mccall_fitted_vfi.md Changed the LaTeX command for the real numbers from \RR to the standard \mathbb{R} notation for consistency with mathematical typesetting conventions. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * Remove incomplete exercise about mean-preserving spread Deleted the second exercise (mfv_ex2) which asked about mean-preserving spread and had an incomplete solution placeholder. The exercise was about exploring how reservation wage varies with volatility while holding mean constant. Renumbered the third exercise (mfv_ex3 about risk aversion) to become the new second exercise (mfv_ex2). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> --------- Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: mmcky <mamckay@gmail.com>
1 parent e2c1183 commit 374bf14

File tree

5 files changed

+137
-125
lines changed

5 files changed

+137
-125
lines changed

lectures/_static/quant-econ.bib

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2711,3 +2711,25 @@ @article{fischer2024improving
27112711
journal={arXiv preprint arXiv:2410.16076},
27122712
year={2024}
27132713
}
2714+
2715+
@article{MaCurdy1982,
2716+
title={The use of time series processes to model the error structure of earnings in a longitudinal data analysis},
2717+
author={MaCurdy, Thomas E.},
2718+
journal={Journal of Econometrics},
2719+
volume={18},
2720+
number={1},
2721+
pages={83--114},
2722+
year={1982},
2723+
publisher={Elsevier}
2724+
}
2725+
2726+
@article{Meghir2004,
2727+
title={Income variance dynamics and heterogeneity},
2728+
author={Meghir, Costas and Pistaferri, Luigi},
2729+
journal={Econometrica},
2730+
volume={72},
2731+
number={1},
2732+
pages={1--32},
2733+
year={2004},
2734+
publisher={Wiley Online Library}
2735+
}

lectures/_toc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ parts:
6767
- file: mccall_model_with_separation
6868
- file: mccall_model_with_sep_markov
6969
- file: mccall_fitted_vfi
70-
- file: mccall_correlated
70+
- file: mccall_persist_trans
7171
- file: career
7272
- file: jv
7373
- file: odu

lectures/mccall_fitted_vfi.md

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ $$
132132

133133
where $\psi$ is the standard normal density.
134134

135-
Here we are thinking of $v_u$ as a function on all of $\RR_+$.
135+
Here we are thinking of $v_u$ as a function on all of $\mathbb{R}_+$.
136136

137137

138138
### Fitting
@@ -473,33 +473,6 @@ This makes economic sense: when the value of being unemployed rises (through hig
473473
```{exercise}
474474
:label: mfv_ex2
475475
476-
Let us now consider how the agent responds to an increase in volatility.
477-
478-
To try to understand this, compute the reservation wage when the wage offer distribution is uniform on $(m - s, m + s)$ and $s$ varies.
479-
480-
The idea here is that we are holding the mean constant and spreading the support.
481-
482-
(This is a form of *mean-preserving spread*.)
483-
484-
Use `s_vals = jnp.linspace(1.0, 2.0, 15)` and `m = 2.0`.
485-
486-
State how you expect the reservation wage to vary with $s$.
487-
488-
Now compute it - is this as you expected?
489-
```
490-
491-
```{solution-start} mfv_ex2
492-
:class: dropdown
493-
```
494-
495-
Maybe add an exercise that explores a pure increase in volatility.
496-
497-
```{solution-end}
498-
```
499-
500-
```{exercise}
501-
:label: mfv_ex3
502-
503476
Create a plot that shows how the reservation wage changes with the risk aversion parameter $\gamma$.
504477
505478
Use `γ_vals = jnp.linspace(1.2, 2.5, 15)` and keep all other parameters at their default values.
@@ -508,7 +481,7 @@ How do you expect the reservation wage to vary with $\gamma$? Why?
508481
509482
```
510483

511-
```{solution-start} mfv_ex3
484+
```{solution-start} mfv_ex2
512485
:class: dropdown
513486
```
514487

lectures/mccall_model_with_sep_markov.md

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
11
---
2-
jupyter:
3-
jupytext:
4-
default_lexer: ipython3
5-
text_representation:
6-
extension: .md
7-
format_name: markdown
8-
format_version: '1.3'
9-
jupytext_version: 1.17.2
10-
kernelspec:
11-
display_name: Python 3 (ipykernel)
12-
language: python
13-
name: python3
2+
jupytext:
3+
text_representation:
4+
extension: .md
5+
format_name: myst
6+
format_version: 0.13
7+
jupytext_version: 1.17.2
8+
kernelspec:
9+
display_name: Python 3 (ipykernel)
10+
language: python
11+
name: python3
1412
---
1513

1614
(mccall_with_sep_markov)=
@@ -22,7 +20,7 @@ jupyter:
2220
</div>
2321
```
2422

25-
23+
+++
2624

2725
# Job Search III: Search with Separation and Markov Wages
2826

@@ -104,6 +102,7 @@ $$
104102
\right]
105103
$$
106104

105+
+++
107106

108107
## Computational Approach
109108

@@ -121,6 +120,7 @@ $$
121120

122121
2. Substitute into the unemployed agent's Bellman equation to get:
123122

123+
+++
124124

125125
$$
126126
v_u(w) =
@@ -137,6 +137,7 @@ $$
137137

138138
The optimal policy turns out to be a reservation wage strategy: accept all wages above some threshold.
139139

140+
+++
140141

141142
## Code
142143

@@ -334,6 +335,7 @@ plt.show()
334335

335336
Can you provide an intuitive economic story behind the outcome that you see in this figure?
336337

338+
+++
337339

338340
## Employment Simulation
339341

@@ -492,7 +494,7 @@ This is because she uses the wage $w$ from her last job to draw a new wage offer
492494
via $P(w, \cdot)$, and positive correlation means that a high current $w$ is
493495
often leads a high new draw.
494496

495-
497+
+++
496498

497499
## The Ergodic Property
498500

@@ -545,6 +547,7 @@ As a result, we can study steady-state unemployment either by:
545547

546548
Often the second approach is better for our purposes, since it's easier to parallelize.
547549

550+
+++
548551

549552
## Cross-Sectional Analysis
550553

0 commit comments

Comments
 (0)