Refactor McCall lecture: Emphasize persistent and transitory wage shocks#691
Refactor McCall lecture: Emphasize persistent and transitory wage shocks#691
Conversation
|
@jstac the
|
Build FixesFixed three Jupyter Book build errors that were preventing the documentation from building correctly: 1. Missing equation reference in
|
|
@jstac the We just need to drop the nested |
…mplementation 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>
…tory 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>
f72b693 to
7b03c71
Compare
Rebase CompletePR #690 has been merged into main, and this PR has been successfully rebased onto the updated main branch. What Changed in the Rebase
Current StatusThis PR is now ready to merge and contains:
Ready for final review and merge! 🚀 |
lectures/mccall_persist_trans.md
Outdated
| display_name: Python 3 | ||
| language: python | ||
| name: python3 | ||
| jupyter: |
There was a problem hiding this comment.
@jstac I think this will cause a build warning.
|
|
||
| Here is a plot of the results. | ||
|
|
||
| ```{code-cell} ipython3 |
There was a problem hiding this comment.
@jstac these changes aren't correct, many of the code cells have been written to markdown highlighted code rather than respecting the MyST syntax.
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>
MyST Format FixFixed to use proper MyST format instead of plain markdown. Changes MadeUsed to properly convert the file:
The file is now consistent with all other lectures in the repository and will be properly processed by Jupyter Book. |
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>
Additional MyST Format FixFound and fixed one more file with incorrect format: This was the only remaining lecture file in the entire repository using plain markdown format instead of MyST. Changes
All 91 lecture files in the repository are now using consistent MyST format. 🎉 |
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>
Fixed Build ErrorsThe bibliography entries were lost during the rebase. I've re-added them:
This fixes the build warnings: The build should now pass. ✅ |
|
📖 Netlify Preview Ready! Preview URL: https://pr-691--sunny-cactus-210e3e.netlify.app (4a1c8b7) 📚 Changed Lecture Pages: mccall_fitted_vfi, mccall_model_with_sep_markov |
|
I've got the green light @mmcky . i'll check it over and then hopefully merge and make it live 🤞 |
|
@jstac this is looking pretty good (from a 10,000ft perspective). I just noticed one of the Solutions may be a
|
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>
Fixed Duplicate ContentRemoved a duplicate section in What was duplicated:
Result: 41 lines of duplicate content removed. The file now flows correctly from the Value Function Iteration section directly into the Fitting section. ✅ |
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>
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>
|
Thanks @mmcky , I'm just fixing that. There was some weird repetition in that lecture as well. rebuilding again. I'll take it from here if you like. |
Thanks @mmcky, I appreciate it :-) I'm very tired and making mistakes. This should build OK and if it does I'll hand over to you for one more quick look and then please just go ahead and make it live. I'll work through it all again over the next couple of days and polish it. It will be good enough for lecturing from tomorrow. |
|
📖 Netlify Preview Ready! Preview URL: https://pr-691--sunny-cactus-210e3e.netlify.app (2052a7a) 📚 Changed Lecture Pages: mccall_fitted_vfi, mccall_model_with_sep_markov |
|
📖 Netlify Preview Ready! Preview URL: https://pr-691--sunny-cactus-210e3e.netlify.app (e05cf18) 📚 Changed Lecture Pages: mccall_model_with_sep_markov |
|
📖 Netlify Preview Ready! Preview URL: https://pr-691--sunny-cactus-210e3e.netlify.app (56a02dd) 📚 Changed Lecture Pages: mccall_fitted_vfi, mccall_model_with_sep_markov |
|
The magical green badge of success. Over to you @mmcky . Please make live when you are ready. I'll get up early tomorrow and review everything on the live site, possibly make some small changes. |
Quality Check ✅Excellent work on this refactoring! Both documents are in great shape and ready to merge. Key Strengths:
One Minor Typo Found:In Should be: "In that lecture we mixed..." or "That lecture mixed..." This is minor enough not to block merging—can be fixed in a follow-up if needed. Recommendation: Approve for Merge 🚀@jstac we could also adjust some titles in mccall_model_with_sep_markov to be in line with QE style. I will merge this now to make it live and loop back around to these minor pickups tomorrow. |

Summary
This PR refactors the McCall job search lecture to better emphasize the decomposition of wages into persistent and transitory components. The file has been renamed from
mccall_correlated.mdtomccall_persist_trans.mdto distinguish it from the earliermccall_model_with_sep_markov.mdlecture, which also deals with correlated wages.Changes
File and Title
mccall_correlated.md→mccall_persist_trans.md_toc.ymlto reflect the filename changeOverview Section
baseline model <mccall_model>- IID wage offersJob Search III <mccall_model_with_sep_markov>- correlated wages with separationJob Search IV <mccall_fitted_vfi>- fitted value function iterationCode Improvements
jrabbreviation: Changedimport jax.random as jrtoimport jax.randomfor explicit, clearer codedraw_τ→draw_duration(clearer name without Greek letter)compute_unemployment_durationnow serves as a clean wrapper functionJobSearchModel→ModelModel()constructorText Quality
Fixed grammatical errors throughout:
Benefits
Testing
draw_durationfunction works correctly🤖 Generated with Claude Code