[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
|
#28) * Annotate the seven new upstream data refs — unblocks the strict build The audit-dashboard build has been red since the 2026-07-27 schedule. It is not broken code: build_audit.py scans the live main of the 8 lecture repos, and --strict exits 1 when any reference has neither a manifest nor an annotation. Three upstream additions landed refs this file had never seen, so every data-lectures PR since has failed on drift it did not cause (most recently #27). The gap, and where each ref came from: NEWQDATA.csv, and phillips_drifts_volatilities / phillips_lost_conquest / phillips_two_stories — added by QuantEcon/lecture-python.myst#1001 (Jul 26), the first four warnings on the Jul 27 schedule polars — added by QuantEcon/lecture-python-programming#408 (Jul 30), a Polars rewrite of pandas' FRED and yfinance sections sargent_surico — added by QuantEcon/lecture-python.myst#1020 (Aug 1) Series lists are read off the lecture sources rather than inferred. The six API entries are annotated incidental except polars, which mirrors pandas' lesson framing — the fetch itself is the teaching point there. NEWQDATA.csv is recorded verbatim: the lecture cites it as Cogley and Sargent's quarterly dataset and commits no builder beside it. The note flags it as a migration candidate — it is read from lecture-python.myst main by raw URL, and the lecture already documents every transformation and rebuilds the post-2000Q4 continuation from FRED. Verified against clones of all 8 repos: `build_audit.py scan --strict` goes from exit 1 with 7 warnings to exit 0 with none. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * Drop the us_adult_heights annotation — the manifest owns it now This file's header states the rule: migrated datasets do not get `datasets:` entries, because the manifest is their source of truth. The other six manifest-backed datasets follow it; us_adult_heights.csv was left behind when #27 migrated it out of lecture-python-intro. Not cosmetic. `class` and `title` already came from the manifest, but `flags` and `note` are annotation-only, so the dashboard was rendering "NHANES-derived, extraction not scripted" for a dataset whose manifest records builder_status: committed with the builder in scripts/ — the exact claim #27 disproved by reproducing the file byte for byte. Strict scan stays green: the manifest already supplies class `constructed` and the real title. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
This PR are edits to old and new lectures in support of work that Tom is currently doing.