Releases: QuantEcon/lecture-python.myst
Releases · QuantEcon/lecture-python.myst
Release list
publish-2026jul02
What's Changed
Full Changelog: publish-2026jul01...publish-2026jul02
publish-2026jul01
[unemployment_shocks] Rigorous LOO derivation + jax-only computation …
publish-2026jun29
Add unemployment dynamics lectures (linear + nonlinear) (#928)
* Add unemployment dynamics lectures (linear + nonlinear)
Implements issue #910 as a self-contained pair of "Data and Empirics"
lectures on Bayesian time-series modeling of US unemployment, estimated
with NUTS in NumPyro. Drops the fisheries throughline and the sinh
cautionary tale from the original draft.
unemployment_linear.md — A Linear Model of Unemployment
- Random walk (mass escapes every bounded interval) -> linear AR(1).
- The "is it a random walk?" question: monthly phi crowds against 1
(~9yr half-life), annual phi ~0.81; stationary spread and half-life.
- Honest account of what's wrong with the linear model: near unit root,
unbounded pull, constant reversion speed.
- Exercises tie to ar1_turningpts: plug-in vs posterior-integrated
predictive fan charts, and a Wecker-style path statistic (max
unemployment over the next 8 years).
- Distinct from ar1_bayes by design: real data, the random-walk question.
unemployment_nonlinear.md — A Nonlinear Model of Unemployment
- Motivated by the linear model's weaknesses; saturating tanh restoring
force with a bounded pull, canonical form u_{t+1}=u_t+b*tanh(l(u_t-ubar))+e.
- Dynamics: 45-degree/cobweb, the separate roles of beta and lambda,
iso-(beta*lambda) "ridge before estimation", stationary distribution.
- Identification contrast: monthly (lambda->0, beta-lambda ridge,
~random walk) vs annual (lambda identified, ridge dissolves).
- Honest linear-vs-nonlinear verdict: fitted restoring forces coincide in
the data-rich center and diverge only at recession extremes.
Both verified end-to-end (NUTS, 4 chains, R-hat=1.0); added to _toc.yml
under Data and Empirics.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* unemployment_linear: flag the random-walk vs natural-rate debate
Connect the "is unemployment a random walk?" discussion to the
natural-rate vs hysteresis debate of the 1980s-90s:
- Overview now flags the debate (Friedman's natural rate vs
Blanchard-Summers hysteresis), with the Nelson-Plosser irony that
unemployment was their one stationary series.
- A note in the phi-section explains why near-unit-root phi makes the
debate hard to settle (low test power) and points to the nonlinear
resolution pursued in unemployment_nonlinear.
- Adds 5 references to _static/quant-econ.bib (Friedman 1968,
Nelson-Plosser 1982, Blanchard-Summers 1986, Røed 1997,
Kapetanios-Shin-Snell 2003).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* unemployment lectures: reframe linear->nonlinear motivation around recurrence
Replace the "linear pull is unbounded, which is bad" argument with a
safer, positive observation: viewed linearly the data look like a random
walk, yet unemployment stays in a band for decades. The linear model can
reconcile these only on a knife-edge (phi just below 1); nonlinearity
reconciles them structurally -- random-walk-like in normal times, with a
firmer restoring force far from the natural rate that guarantees
recurrence.
- unemployment_linear: rename "What's unsatisfying..." to "Random walk,
yet recurrent" and rewrite around the reconciliation; update the bridge
prose under the scatter. Also incorporates John's Overview edits plus
minor grammar fixes.
- unemployment_nonlinear: reframe the Overview and conclusion to match.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* unemployment lectures: numbered figures, half-life rewrite, trim linear
- Add numbered MyST figures (mystnb caption + name) and {numref}
references throughout both lectures (4 in linear, 10 in nonlinear);
leave exercise-solution figures uncaptioned to avoid the LaTeX-float
PDF-build issue.
- Redesign the random-walk figure in the linear lecture: drop the 90%
band and observed line; mark the observed min/max with dashed lines
and shade the band between them.
- Rewrite the half-life discussion with a student-friendly derivation
(geometric/radioactive-style decay -> solve phi^k = 1/2).
- Shorten the linear lecture by cutting the "Random walk, yet recurrent"
section; the preceding note already bridges to unemployment_nonlinear
and the recurrence framing remains in that lecture's overview.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* unemployment_linear: restructure around the monthly->annual narrative
Reorganize the linear lecture into a tighter logical flow:
- start with monthly data only and fit the linear AR(1), working through
the mechanics and reading the posterior output (the "applying Bayesian
methods to real data" teaching section);
- find phi ~ 1 and connect it to the natural-rate vs hysteresis debate
(moved here from the Overview), including the Nelson-Plosser irony;
- ask whether it could be a unit root and give two reasons it is not:
(a) annual data show clear reversion -- framed as a statistical-power
point (a single linear AR(1) predicts phi_annual ~ phi_monthly^12), not
evidence of nonlinearity, with the half-life discussion deferred here to
emphasize robust annual reversion; (b) a literal random walk would
wander out of the historical band;
- reconcile: a linear model fits only on a knife-edge (phi indistinguishable
from one, constant reversion speed), which motivates the nonlinear model
in the sequel.
Single-panel monthly data plot; figures and {numref} references retained.
Verified end-to-end on GPU.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* unemployment_linear: slim down the narrative
Tighten the prose throughout (incorporates John's edits): trim the
overview and the monthly-fit commentary, drop the half-life subsection,
and shorten the reconciliation. Fixes: restore an accurate heading ("A
random walk would wander off" — a 1-D random walk is recurrent, not
transient) and three small typos/grammar slips (coefficient, accommodate,
"a random walk").
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* unemployment_nonlinear: rebuild around an S-shaped map
Replace the additive-tanh-restoring-force model with the S-shaped map
u_{t+1} = ubar + A*tanh(phi*(u-ubar)/A) + eps, which hugs the 45-degree
line through the normal band (random-walk-like) and flattens toward
asymptotes ubar +/- A outside it (bounded, recurrent). This ties the two
lectures together: phi is the same persistence as the linear model, and
the linear model is the A->infinity limit.
Rewrites every section (model, dynamics, estimation, linear-vs-nonlinear,
exercises). Estimation now shows monthly phi~1 with A unidentified
(consistent with linear) versus annual phi<1 with a finite ceiling, and a
note is honest that the growing pull at the extremes is a simplification.
Verified on GPU: figures render, fits converge (r_hat~1), PPC band stays
positive.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* Restructure unemployment lectures around shocks, not curves
Reframe the two-lecture sequence so the narrative is honest end-to-end.
Lecture 1 (unemployment_linear): reorder around the historical argument.
Lead with the natural-rate vs hysteresis debate, reject a literal random
walk via the wander-off argument, then fit the AR(1) on [0,1) with the
exclusion of 1 justified by that argument. Focus on the mechanics of
fitting and the monthly-vs-annual contrast. Close with the asymmetry the
symmetric Gaussian model cannot capture (heavy-tailed, right-skewed
residuals), motivating the sequel.
Lecture 2 (renamed unemployment_nonlinear -> unemployment_shocks,
"Asymmetry and Large Shocks in Unemployment"): drop the S-shaped mean
model, which cross-validation showed barely beat a straight line. Model
the shocks instead: a linear reversion with a two-component
(quiet/recession-jump) innovation. Reproduces the sawtooth and the
right-skew of annual changes. Teach LOO model comparison in detail
(jump beats linear by ~10 elpd, ~1.7 se) with its exchangeability
caveat, plus a posterior predictive check on the asymmetry. Persistence
is shown to be robust to the shock model, so the two questions are
answered independently.
Verified end-to-end on GPU: both lectures execute, fits converge
(r_hat ~ 1), all figures and cross-references resolve.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* unemployment_linear: reorder flow and expand the residual diagnostic
Reorganize around estimate -> why it can't be a literal random walk
(wander-off) -> corroborate with annual data. Fix the resulting forward
reference in the Priors section, tidy the natural-rate/hysteresis history
so the Nelson-Plosser irony is consistent with the body, and fix two
small typos.
Expand "What the linear model misses" into a slow, step-by-step
explanation of the residual diagnostic: what the model assumes about the
shocks, how we recover them by plugging in posterior medians (stated
plainly), and how matching the overlaid Gaussian's variance isolates a
difference in shape. Adds the skewness formula and a note that the full
Bayesian version is the posterior predictive check in the sequel.
Verified on GPU: executes, residual skewness 0.39 unchanged.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* unemployment lectures: expand the LOO discussion and sync the prose
Turn the model-comparison section of unemployment_shocks into a proper,
self-contained treatment of Bayesian model comparison: the guiding
principle (out-of-sample prediction, not in-sample fit), the log score
and expected log predictive density, the leave-one-out estimate, and the
importance-sampling trick that makes it computable from a single fit --
shown by hand (harmonic mean of the per-draw likelihoods) and matched
against ArviZ's PSIS, with the Pareto-k diagnostic, p_loo, and the
relation to AIC/BIC.
Also bring the framing into line with where the two lectures ended up:
elevate LOO from an aside to a stated payoff, add the two reusable tools
(posterior predictive checks and cross-validation) to the conclusion, and
tighten a redundant transition in the linear lecture.
Verified on GPU: shocks lecture executes, by-hand LOO numbers
(elpd -93.9 vs -105.7, difference 11.8 +/- 5.7) match az.loo.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* unemployment lectures: tighten prose, add LFO note, sharpen LOO derivation
Shocks lecture:
- Add a short "Accommodating the time series structure" subsection
explaining leave-future-out CV, why it is the formally correct measure
for a time series, and why it costs more (no importance-sampling
shortcut); we ran it and it points the same way (verified on GPU).
- Make the LOO derivation rigorous: spell out the importance-sampling
steps from the leave-one-out posterior to the harmonic mean, and
introduce S (the number of posterior draws) explicitly.
- Rename "Scoring a prediction" -> "Leave-one-out cross-validation" to
match its content; reinstate the elpd definition and a sentence on why
the predictive scores are summed in logs; trim an unsupported
persistence claim from the conclusion. Incorporates John's cuts.
Linear lecture: incorporate John's cuts and reordering; fix a sentence
fragment, a missing period, and a dash inconsistency.
Both lectures convert and (where code changed earlier) execute on GPU.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* misc
* unemployment_linear: deep-link the NUTS reference to the bayes_nonconj anchor
Now that the (nuts)= anchor is on main (merged), switch the plain
{doc}`bayes_nonconj` NUTS link to {ref}`introduction to NUTS <nuts>`.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* unemployment_shocks: drop numref to fig-ppc to fix PDF build
The merged toolchain (myst v3.0.1) fails to register the LaTeX label for
the one wide 3-panel figure (fig-ppc), so {numref}`fig-ppc` raised
"undefined label" and failed the PDF build. Reference the panels directly
in the prose instead; the figure and its caption are unchanged.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* unemployment_shocks: install arviz (not in environment.yml)
The model-comparison section imports arviz, but arviz is not in the build
environment.yml — every lecture that uses it (ar1_bayes, ar1_turningpts)
pip-installs it. Re-add the install cell that was wrongly removed; the
HTML build re-executed the notebook and failed on ModuleNotFoundError.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
publish-2026jun22
What's Changed
- [kalman] update RV notation by @longye-tian in #900
- ⬆️ Bump actions/checkout from 6 to 7 by @dependabot[bot] in #922
- ⬆️ Bump quantecon/actions from 0.6.0 to 0.8.0 by @dependabot[bot] in #921
- Adding Tom's new lectures on Kalman Filter and Robust Income by @thomassargent30 in #931
Full Changelog: publish-2026jun19...publish-2026jun22
publish-2026jun19
Add explanatory notes to bayes_nonconj: NUTS and variational inferenc…
publish-2026jun18
What's Changed
- [kalman] Fix errors, modernize code, and unify notation by @jstac in #908
- RunsOn v3: switch disk=large → volume=80gb by @mmcky in #909
- Rewrite the Non-Conjugate Priors lecture by @jstac in #913
- Reduce repetition of the beta posterior derivation by @jstac in #912
Full Changelog: publish-2026jun16...publish-2026jun18
publish-2026jun16
What's Changed
- [kalman_2] update exposition of first three sections by @longye-tian in #903
- [kalman_2] Update code and descriptions by @HumphreyYang in #907
Full Changelog: publish-2026jun09...publish-2026jun16
publish-2026jun09
What's Changed
- [kalman] update exposition and notation by @longye-tian in #897
- ⬆️ Bump quantecon-book-theme from 0.20.3 to 0.21.0 by @dependabot[bot] in #896
Full Changelog: publish-2026jun06...publish-2026jun09
publish-2026jun06
What's Changed
- Polish prob_meaning: plot styling, notation, flow by @jstac in #886
- Add new lecture: Aiyagari model with Endogenous Grid Method by @jstac in #676
- ⬆️ Bump softprops/action-gh-release from 2 to 3 by @dependabot[bot] in #854
- ⬆️ Bump quantecon-book-theme from 0.20.2 to 0.20.3 by @dependabot[bot] in #855
- ⬆️ Bump conda-incubator/setup-miniconda from 3 to 4 by @dependabot[bot] in #861
- ⬆️ Bump dawidd6/action-download-artifact from 20 to 21 by @dependabot[bot] in #864
- [inventory_dynamics] Update terminology in inventory dynamics (#449) by @HG-Cheng in #860
- [kalman] Kalman exercise prediction timing by @longye-tian in #895
- Add Three Lectures on Long-term Risk and Learning by @HumphreyYang in #889
New Contributors
Full Changelog: publish-2026may29...publish-2026jun06
publish-may-29
Update rng usage in stats_examples.md (#873) Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>