Skip to content

Add gradual_liberalization_network lecture and extend organizational_equilibrium - #399

Merged
mmcky merged 3 commits into
mainfrom
oct_Seoul2
Oct 29, 2026
Merged

mmcky merged 3 commits into
mainfrom
oct_Seoul2

Conversation

@mmcky

@mmcky mmcky commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

New lecture gradual_liberalization_network ("Gradual Liberalization in a Global Production Network"), placed after organizational_equilibrium: a three-country, five-sector version of the Bassetto-Huo-Rios-Rull (2026) trade model with intermediate inputs, solved by exact hat algebra from illustrative shares. It decomposes the effect of tariffs on worker welfare, derives a first-order condition on cross-sector wage inequality under which the Markov and best constant tariffs are positive, computes Markov, Ramsey, and organizational equilibrium tariff paths and their response to a protectionist shock, and discusses trade blocs (Bonadio et al. 2026). Three exercises with dropdown solutions.

Additions to organizational_equilibrium: two decompositions of worker welfare, a table matching the growth and tariff models, a three-step computing recipe, workers' consumption paths across equilibria, and a table comparing the equilibria after a temporary shock.

Adds bib entries Armington1969, HuoLevchenkoPandalaiNayar2025, and BonadioEtAl2026.

…equilibrium

New lecture gradual_liberalization_network ("Gradual Liberalization in a
Global Production Network"), placed after organizational_equilibrium:
a three-country, five-sector version of the Bassetto-Huo-Rios-Rull (2026)
trade model with intermediate inputs, solved by exact hat algebra from
illustrative shares. It decomposes the effect of tariffs on worker
welfare, derives a first-order condition on cross-sector wage inequality
under which the Markov and best constant tariffs are positive, computes
Markov, Ramsey, and organizational equilibrium tariff paths and their
response to a protectionist shock, and discusses trade blocs (Bonadio
et al. 2026). Three exercises with dropdown solutions.

Additions to organizational_equilibrium: two decompositions of worker
welfare, a table matching the growth and tariff models, a three-step
computing recipe, workers' consumption paths across equilibria, and a
table comparing the equilibria after a temporary shock.

Adds bib entries Armington1969, HuoLevchenkoPandalaiNayar2025, and
BonadioEtAl2026.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings October 29, 2026 09:37
@netlify

netlify Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

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

Name Link
🔨 Latest commit 02c1ef6
🔍 Latest deploy log https://app.netlify.com/projects/lustrous-melomakarona-3ee73e/deploys/6ae31d53808781aefb98a162
😎 Deploy Preview https://deploy-preview-399--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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Verifying the solver's many hardcoded numeric claims in the 1140-line lecture requires a CI notebook execution that cannot be run here, leaving quorum unmet.

No open issues 🎉

What changed in this PR

This PR adds a new QuantEcon lecture, gradual_liberalization_network ("Gradual Liberalization in a Global Production Network"), and extends the existing organizational_equilibrium lecture with additional welfare decompositions, comparison tables, and worker-consumption analysis. The new lecture builds a small three-country, five-sector version of the Bassetto–Huo–Ríos-Rull (2026) trade model with intermediate inputs, solved by exact hat algebra from illustrative shares, and reuses the dynamic policy machinery of organizational_equilibrium to compute Markov, Ramsey, and organizational-equilibrium tariff paths plus their response to a protectionist shock. It fits into the "tariff/trade-cooperation" cluster of lectures, serving as the multi-country, multi-sector sequel to organizational_equilibrium.

Changes:

  • New 1140-line lecture gradual_liberalization_network.md (model setup, separability, solving-in-changes solver, welfare decompositions, a first-order condition gln-condition, dynamic tariff paths, trade-blocs discussion, and three exercises with dropdown solutions).
  • Extends organizational_equilibrium.md: static() now also returns real wages ω_i, two welfare decompositions, a growth-vs-tariff model mapping table, a three-step organizational-equilibrium recipe, workers' consumption paths across equilibria, and a post-shock comparison table, with cross-links to the new lecture.
  • Registers the lecture in _toc.yml and adds three BibTeX entries (Armington1969, HuoLevchenkoPandalaiNayar2025, BonadioEtAl2026).

I reviewed the Python code, the mathematics, and the cross-references in detail. All static() call sites in organizational_equilibrium.md were correctly updated for the new 6-tuple return (e.g., [2:] → [2:4]), the decomposition and consumption-path cells are algebraically consistent, and I numerically confirmed that ψ_i stays positive over the wider [0, 1.5] grid (min ≈ 0.34) so the np.log/argmax are safe and the "peaks at about 85 percent" claim matches the computed value. In the new lecture, the revenue_system/solve_changes einsum dimensions and exponents match the stated equations, calibration arrays (λ, Φ, each Ξ row, α_k+α_l+α_x) sum to one, the first-order condition derivation matches gln-condition, all cross-cell variables are defined before use, and every {eq}/{ref}/{doc}/{cite} reference resolves. I did not find concrete defects to flag.

Note: the lecture quotes many hardcoded numerical results in prose that are generated by the heavy exact-hat-algebra solver; their correctness ultimately depends on a successful CI notebook execution, which I could not run in this environment.

File Description
lectures/​gradual_liberalization_network.md New lecture: multi-country/multi-sector tariff model, exact-hat-algebra solver, welfare decompositions, dynamic tariff paths, exercises.
lectures/​organizational_equilibrium.md Adds real-wage output to static(), two welfare decompositions, model-mapping and post-shock tables, consumption-path analysis, and cross-links to the new lecture.
lectures/​_toc.yml Registers gradual_liberalization_network after organizational_equilibrium.
lectures/​_static/​quant-econ.bib Adds Armington1969, HuoLevchenkoPandalaiNayar2025, BonadioEtAl2026.

Review effort: Balanced

Style guide:
- Shorten six figure captions to six words or fewer (qe-fig-004).
- gradual_liberalization_network: bold the defined terms "static
  separability" and "exact hat algebra", which were in italics
  (qe-writing-005).

gradual_liberalization_network:
- Find the 5, 10 and 30 percent grid indices by value instead of
  hard-coding them, so they stay correct if tau_grid changes.
- Rename the Ramsey horizon from N, which the text uses for the number
  of countries, to horizon.
- Use h as the summation index in U_t so it does not clash with
  capital k_nj.
- Describe the sector bar chart accurately: gains fall with baseline
  consumption for the three lowest-paid groups, but the two best-paid
  groups are not in order.
- Drop an f-string with no placeholders.

organizational_equilibrium:
- Print how the gain in equality splits between wage changes and the
  rebate, which the text asserts but the cell did not compute.
- Reword the Ramsey import-sector recovery to match the printout: back
  to the Markov level in period 5, above it from period 6.

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

mmcky commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor Author

Review

The economics and the code hold up. I've pushed one commit of style fixes and small cleanups (54d54a7). The remaining questions are about claims concerning other papers and are collected in #400.

What I checked

  • Execution: every code cell in both lectures runs without errors. gradual_liberalization_network takes about 4 seconds and organizational_equilibrium about 1 second.
  • Numbers in the prose: every number quoted in the text matches the code output. Examples include the 14.5% Markov and 1.2% best constant tariffs, the organizational path 11.8 → 7.9 → 4.8 → 3.7%, Ramsey reaching free trade in year 31, the 17-year delay after the shock, and the exercise thresholds. In organizational_equilibrium they include the 85% welfare peak, the 0.23 dip in logs, and the four periods (28 years) before import-sector workers gain. I also checked claims the code doesn't print, such as the return to capital falling from 5.2% to 4.5% and the transition-map slopes (0 at the Markov tariff, about 1 at the best constant tariff).
  • Derivations: the separability argument, the hat-algebra price equation, the revenue system (the code matches the equations), the Markov and best constant objectives, and the first-order condition with its thresholds of 4.48 and 7.95 are all correct.
  • Ramsey solver: L-BFGS-B stops after 6 iterations, which looked premature, but re-solving with tight tolerances gives the same path.

Changes in 54d54a7 and 02c1ef6

Lecture Change
both Shortened six figure captions to six words or fewer (qe-fig-004)
gradual_liberalization_network Bolded the defined terms "static separability" and "exact hat algebra" in the Overview (qe-writing-005)
gradual_liberalization_network The 5, 10 and 30 percent grid indices are now found by value instead of hard-coded, so they stay correct if τ_grid changes
gradual_liberalization_network Renamed the Ramsey horizon from N, which the text uses for the number of countries, to horizon
gradual_liberalization_network Corrected the description of the sector bar chart: gains fall with baseline consumption for the three lowest-paid groups, but the two best-paid groups are not in order
gradual_liberalization_network Dropped an f-string with no placeholders
organizational_equilibrium Added a print line showing how the gain in equality splits between wage changes (0.113) and the rebate (0.061), which the text asserts but the cell did not compute
organizational_equilibrium Reworded the Ramsey import-sector recovery to match the printout: back to the Markov level in period 5, above it from period 6

After these edits, both lectures produce the same output as before, plus the one new print line.

Open questions for the author

See #400. It covers an inference in the new lecture about what drives the G7 tariff in Bassetto, Huo, and Ríos-Rull (2026), two figures and the bib year for Bonadio et al., and three figures from Bassetto, Huo, and Ríos-Rull (2026) that I couldn't check against the paper. None of them affects the code or its results.

Recommendation

Merge once the CI tests job passes. #400 can be settled before merging or as a follow-up.

@github-actions

github-actions Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

@github-actions
github-actions Bot temporarily deployed to pull request October 29, 2026 10:02 Inactive
The index is a dummy variable, so k is correct; the switch to h in the
previous commit was cosmetic.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mmcky
mmcky merged commit f808621 into main Oct 29, 2026
9 checks passed
@mmcky
mmcky deleted the oct_Seoul2 branch October 29, 2026 10:31

This branch was successfully deployed

1 active deployment
pull request — 02c1ef69 Deployed Oct 29, 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.

3 participants