Skip to content

Add policy_counterfactuals lecture: McKay-Wolf counterfactuals and invertibility - #392

Merged
jstac merged 3 commits into
mainfrom
wolf
Oct 14, 2026
Merged

jstac merged 3 commits into
mainfrom
wolf

Conversation

@jstac

@jstac jstac commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

Adds a new lecture, policy_counterfactuals, that adds a price-stabilizing tax rule to the single-good market of supply_demand_var / induced_priors and uses it to study McKay and Wolf (2023).

Main message: in a linear economy where policy affects private behaviour only through the expected path of the instrument, impulse responses to contemporaneous and news policy shocks under the baseline rule deliver exact, Lucas-critique-robust counterfactuals under another rule, without a structural model of the private sector.

Contents:

  • McKay–Wolf Proposition 1 verified to machine precision; comparison with Sims–Zha (surprises only) and Leeper–Zha "modest" interventions
  • approximation with a limited menu of policy shocks; sufficient statistics vs. an induced prior over parameters
  • invertibility: external instruments / local projections recover the non-fundamental supply shock; a price-stabilizing rule is observationally equivalent to more flexible supply, so fundamentalness depends on the policy rule
  • counterfactual second moments via Wold innovations (exact only under invertibility; error tiny here)
  • relation to the "dynamic programming squared" lectures (credibility, time inconsistency, sustainable plans, endogenous regimes)
  • exercises: optimal policy / targeting rule, time inconsistency, Wold-route error vs. σ_s, zeroing-out counterfactual, sign restrictions under two rules

Also adds forward links from supply_demand_var and induced_priors, and 8 new bib entries.

The lecture executes cleanly locally (~13 s); numerical claims in the text were checked against the output.

🤖 Generated with Claude Code

…vertibility

New lecture placed after induced_priors. It adds a price-stabilizing tax rule
to the supply_demand_var market and uses the extended market as a laboratory
for McKay and Wolf (2023):

- solves the market in sequence space and verifies McKay-Wolf Proposition 1
  exactly, with comparisons to Sims-Zha and to Leeper-Zha's "modest policy
  interventions", and least-squares approximation with few policy shocks
- shows that a price-stabilizing rule is observationally equivalent (for
  prices and quantities) to more flexible suppliers, and uses this to explain
  why invertibility of the supply shock depends on the policy rule
- contrasts a structural modeler's induced prior over the counterfactual with
  McKay-Wolf sufficient statistics
- sorts procedures by whether they need invertibility: external instruments
  recover the supply-shock response that VAR rotations cannot; the Wold-route
  counterfactual second moments are exact only under invertibility
- relates McKay-Wolf to the dynamic programming squared lectures (calvo,
  calvo_abreu, dyn_stack, opt_tax_recur, dovis_accounting_mf) and states the
  credibility, belief-neutrality, linearity, and rules-versus-institutions
  assumptions behind their counterfactuals
- exercises on optimal policy, time inconsistency, Wold-route errors,
  zeroing-out counterfactuals, and sign restrictions under different rules

Also adds cross-references from supply_demand_var and induced_priors, a TOC
entry, and bibliography entries for McKay-Wolf, Lucas (1976), Sims-Zha,
Leeper-Zha, Stock-Watson, Plagborg-Moller-Wolf, Bernanke-Gertler-Watson, and
Svensson.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@netlify

netlify Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for lustrous-melomakarona-3ee73e ready!

Name Link
🔨 Latest commit eb31875
🔍 Latest deploy log https://app.netlify.com/projects/lustrous-melomakarona-3ee73e/deploys/6acfa9b233e2901f4c138d8e
😎 Deploy Preview https://deploy-preview-392--lustrous-melomakarona-3ee73e.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@jstac jstac left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review comments: explicit typos/wording and suggestions for matching the QuantEcon style manual (QuantEcon.manual/manual/styleguide/).

Already compliant: lecture title in title case and section headings in sentence case; one-sentence paragraphs; Unicode Greek in code; np.random.default_rng; standalone !pip install cell with the standard sentence; ^\top for transposes; {doc} cross-links.

Main style gaps (details inline):

  1. figures lack mystnb captions/names; single-axis figures use ax.set_title; several line plots lack lw=2
  2. bold-face vectors for stacked paths (McKay–Wolf notation) vs. the manual's "no bold vectors"
  3. {cite} → {cite:t} where author names are part of the sentence
  4. new bib entries lack DOIs
  5. length: the DP² comparison is stated three times

I ran the lecture locally (it executes cleanly in about 13 s) and checked the numerical claims in the text against the output. All match except the two flagged at lines 645 and 1298.

Comment thread lectures/policy_counterfactuals.md Outdated
Comment thread lectures/policy_counterfactuals.md Outdated
Comment thread lectures/policy_counterfactuals.md Outdated
plt.show()
```

The error in quantity rises steadily with $g_s$: the more slowly suppliers can adjust, the more their

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not quite accurate: the quantity error does not rise steadily over the whole grid. It falls from about 1.4% at $g_s = 0.1$ to 0.2% at $g_s \approx 0.5$ and only then rises (to 12% at $g_s = 30$); the price error is hump-shaped, peaking near $g_s \approx 2$. Suggest "For $g_s$ above about 0.5, the error in quantity rises with $g_s$ ...". The summary bullet at line 1280 ("errors that grow with how forward-looking suppliers are") inherits this.

Comment thread lectures/policy_counterfactuals.md
Comment thread lectures/policy_counterfactuals.md Outdated
| Cholesky or sign-restricted rotations of VAR innovations | yes | miss the supply-shock response |
| local projection on an external instrument | no | recovers the supply-shock response |
| McKay–Wolf counterfactual for a given shock (Proposition 1) | no, given the impulse responses | exact |
| Sims–Zha counterfactual for a given shock | no, given the impulse responses | not robust to the Lucas critique: errors of roughly 5 to 10 percent |

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clarity: "roughly 5 to 10 percent" here is error relative to the size of the response, while the bullet at line 1283 ("about 30 percent") is error relative to the policy effect. Both are right, but next to each other they read as inconsistent. Suggest naming the denominator in both places.

Comment thread lectures/policy_counterfactuals.md Outdated
/ np.abs(split(x_true_g)[i]).max() for i in range(2)])
sz_errors = np.array(sz_errors)

fig, ax = plt.subplots(figsize=(8, 4))

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style manual (figures.md): single-axis figures should not carry an ax.set_title; move the title into a mystnb figure caption instead. Applies here and at lines 740/745 and 1002/1014. More generally, none of the figures outside the exercises have captions (mystnb: figure: caption/name metadata), while induced_priors does: worth adding captions + names to the figures at lines 395, 487, 579, 622, 665, 726, 769, 934, 1000, so they can be referenced with {numref}. (Figures inside the exercise/solution blocks must stay uncaptioned, since a caption breaks the PDF build there.) Multi-panel per-axis titles are fine.

Comment thread lectures/policy_counterfactuals.md Outdated
sz_errors = np.array(sz_errors)

fig, ax = plt.subplots(figsize=(8, 4))
ax.semilogx(g_grid, sz_errors[:, 0], 'o-', label="quantity")

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style manual (figures.md): line charts should use lw=2. Missing here and at 636, 677–678, 682, 741–742 and 1009. The manual also asks not to set figsize without good reason; the wide multi-panel figures arguably justify it, but the single-panel ones (634, 740, 1002) could use the default.

Comment thread lectures/policy_counterfactuals.md Outdated
shock, each normalized to raise quantity by one unit on impact.

```{code-cell} python3
rng = np.random.default_rng(0)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style manual (code.md): create the rng once and reuse it. A second generator is created here (default_rng(0)) after the one at line 777 (default_rng(1234)). Local generators inside the exercise solutions are fine.

Comment thread lectures/_static/quant-econ.bib Outdated
year = {2023},
volume = {91},
number = {5},
pages = {1695--1725}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style manual (references.md, bib rules 9 and 11): none of the eight new entries carries a doi; please add them from the publisher records (e.g. via curl -LH "Accept: application/x-bibtex" https://doi.org/<doi>). Also type Plagborg-Møller directly rather than Plagborg-M{\o}ller (PlagborgMollerWolf2021).

Comment thread lectures/supply_demand_var.md
@github-actions

github-actions Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

@github-actions
github-actions Bot temporarily deployed to pull request October 14, 2026 05:48 Inactive
- figures: add mystnb captions/names to main-text figures; drop embedded
  titles and explicit figsize on single-axis figures; lw=2 on line charts
- notation: plain letters for stacked time paths instead of bold, with the
  convention stated once; \mathbb{E} for expectations (also in
  supply_demand_var, for consistency between the two lectures)
- citations: {cite:t} where author names are part of the sentence
- bib: add DOIs to the eight new entries; type Plagborg-Møller directly
- overview: condense the "two responses to the Lucas critique" subsection
  to a pointer to the full treatment in pc_dp2
- bold only for definitions
- reuse a single rng
- correct the description of how the Sims-Zha error varies with g_s, and
  name the denominators of the Sims-Zha error figures in the summary table

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jstac

jstac commented Oct 14, 2026

Copy link
Copy Markdown
Contributor Author

bce58df addresses the unresolved review threads:

  • Figures: captions + names on all main-text figures (exercise figures left uncaptioned); no set_title/figsize on single-axis figures; lw=2 on line charts. The context that was in the removed title of the Sims–Zha-vs-$g_s$ figure is now in a sentence before it.
  • Notation: plain letters for stacked paths, with the convention ("a variable written without a time subscript denotes its entire time path") stated once in the McKay–Wolf framework subsection. \mathbb{E} throughout, in both this lecture and supply_demand_var.
  • Citations: {cite:t} where author names are part of the sentence.
  • Bib: DOIs added (checked against Crossref volume/issue/pages); Plagborg-Møller typed directly.
  • Overview: the "Two responses" subsection is reduced to a pointer to pc_dp2. The four bullets it dropped are all covered in pc_dp2 (credibility and belief-neutral shocks under "Credible rules and sustainable plans", linearity and institutions under "Endogenous policy regimes", all four in "What the method takes for granted").
  • Bold removed from non-definitions; a single rng is reused.
  • Accuracy: Sims–Zha error vs $g_s$ described correctly (quantity error rises beyond small $g_s$; price error peaks at intermediate $g_s$); the summary table names the denominators of its error figures.

The lecture executes cleanly locally. Reusing the rng changes the local-projection sample, with similar noise to before.

🤖 Generated with Claude Code

@github-actions
github-actions Bot temporarily deployed to pull request October 14, 2026 07:55 Inactive
…jump_lq

policy_regimes (new): a supply-demand market whose tax rule switches
regimes by a Markov chain, solved as a Markov jump LQ planning problem
with a correct linked-Riccati solver. Covers the two levels of the Lucas
critique, reversible vs permanent reforms, McKay-Wolf counterfactuals
from regime-switching data, and VARs fit to regime-switching data.

policy_counterfactuals: rule-based scenario analysis section, a pointer
to policy_regimes, corrections from fresh-eyes reviews (uniqueness
assumption, cost-parameter equivalence, limited-shock errors, relative
error scales), trimmed repetition, voice and style fixes, and citations
for Romer-Romer, Gertler-Karadi, and Ben Zeev-Khan.

markov_jump_lq: correct the Bellman equation and linked Riccati formula
(conditional expectation of next-period value matrices inside the
inverse), fix sign and transpose errors, note that quantecon.LQMarkov
currently implements the averaged recursion, and combine looped figures
into multi-panel figures.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions
github-actions Bot temporarily deployed to pull request October 14, 2026 16:27 Inactive
@jstac
jstac merged commit 6de87b7 into main Oct 14, 2026
9 checks passed
@jstac
jstac deleted the wolf branch October 14, 2026 20:43

This branch was previously deployed

1 inactive deployment
pull request — eb31875d Deployed Oct 14, 2026 by github-actions[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants