[Tom] July 31 edits of some old and new lectures - #1020
Conversation
|
@thomassargent30 just running CI now to check this builds all our assets and then will merge once I get green. |
There was a problem hiding this comment.
Pull request overview
This PR updates and extends the lecture materials by adding new MyST/Jupytext lectures and refactoring existing ones to improve the coherence of the VAR/Kalman and LQ permanent income “lecture suite” narratives.
Changes:
- Add two new lectures:
var_subsets(VARs for subvectors via Kalman filtering) andlq_robust_bewley(robustness + Bewley economy via observational equivalence). - Refactor and retitle/relabel significant parts of
lq_robust_smoothingandkalman_filter_varto align with the expanded lecture sequence and new follow-on lectures. - Update the book TOC and bibliography to include new lectures and citations; minor plotting API update in
ar1_turningpts.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| lectures/var_subsets.md | New lecture introducing VAR subsystem theory + executable code (includes a blocking syntax error in one f-string). |
| lectures/lq_robust_smoothing.md | Major restructure/rewrite to serve as the 3rd lecture in a 4-part LQ permanent income sequence, adding scalar closed-form results and reorganizing content. |
| lectures/lq_robust_bewley.md | New lecture extending robust smoothing results to a Bewley setting with heterogeneous robustness types. |
| lectures/lq_permanent_income.md | Update lecture-sequence references to reflect 4-part suite and link to the new lq_robust_bewley. |
| lectures/lq_bewley_complete_markets.md | Update lecture-sequence references to reflect 4-part suite and link to the new lq_robust_bewley. |
| lectures/kalman_filter_var.md | Add header/contents, tighten definitions, update a worked example section to point to the new var_subsets lecture, and adjust code ordering/comments. |
| lectures/ar1_turningpts.md | Replace az.plot_trace_dist with az.plot_trace for ArviZ plotting. |
| lectures/_toc.yml | Add var_subsets and lq_robust_bewley to the Jupyter Book TOC; also add sargent_surico. |
| lectures/_static/quant-econ.bib | Add bibliography entries (e.g., Sargent–Surico 2011, Lucas 1980, etc.). |
Build failure in
|
The lecture installs arviz unpinned, and `pip install arviz` now resolves
1.2.0 -- the rewrite that dispatches to arviz-base/arviz-stats/arviz-plots.
Two calls still used the 0.x API.
`az.from_dict` took the posterior group as its first positional argument in
0.x, so a flat {var_name: array} mapping worked. In 1.x the first argument is
{group_name: {var_name: array}}, so each entry of FREE was read as a group and
dict_to_dataset() was handed a raw ndarray, failing the HTML build with
`AttributeError: 'numpy.ndarray' object has no attribute 'items'`.
`az.summary` no longer emits hdi_3%/hdi_97%; it defaults to an 89% ETI. Ask
for ci_kind='hdi', ci_prob=0.94 to keep the interval the 0.x default gave, and
select the new hdi94_lb/hdi94_ub columns. Execution stopped at the from_dict
cell above, so this second break never reached the CI log.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Fix pushed — d169164I've pushed the two arviz 1.x fixes to
The first one is what failed the Five lines changed in total, no prose edits, and no other arviz calls needed touching — How it was checkedI could not run the lecture end to end locally, since it needs a live FRED pull plus jax and a GPU, so CI on this PR is the real test. What I did verify, against a scratch install of arviz 1.2.0: the original One thing to be aware of for future edits: 1.x Follow-up filedThe unrelated |
|
@thomassargent30 applied a couple of fixes to enable this to work with the latest version of |
The NUTS cell exceeds the 2400s per-cell execution timeout set in lectures/_config.yml when it runs on the GPU CI runner, so the notebook dies with a CellTimeoutError and the HTML build fails. Executed locally on CPU, the same cell takes ~160s and the whole lecture takes ~5 minutes across all 52 code cells. Scaling by the ratio between local and CI timings for the non-jax part of the lecture puts the CPU cost of that cell at roughly 10 minutes on the runner, well inside the timeout. Why the GPU is so much slower here has not been confirmed. Pinning the platform is the change that makes the lecture build; the underlying cause is worth a separate look. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
📖 Netlify Preview Ready!Preview URL: https://pr-1020--sunny-cactus-210e3e.netlify.app Commit: 📚 Changed Lectures
Build Info
|
Green — d812aa6CI passes now. Two commits were needed, and the second one only became visible once the first was fixed.
The second one is the interesting one. That cell takes 157 seconds locally on a laptop CPU, and more than 2400 seconds on the Why the GPU is so much slower has not been established — Unrelated and still open: the |
✅ Translation sync completed (zh-cn)Target repo: QuantEcon/lecture-python.zh-cn
|
This PR are edits to old and new lectures in support of work that Tom is currently doing.