phillips_credible_policies#
Series: lecture-python.myst
File:
lectures/phillips_credible_policies.mdAudit date: 2026-08-26
Corpus snapshot:
e25fdf2345Categories audited: writing, math, code, figures, references, links, admonitions (JAX out of scope)
Overall score: 8.5 / 10
Priority: LOW
Score breakdown#
Category |
Score |
One-line note |
|---|---|---|
Writing |
6.5/10 |
|
Math |
9.5/10 |
|
Code |
8.5/10 |
|
JAX |
out of scope |
JAX rules target |
Figures |
6/10 |
|
References |
10/10 |
no mechanical violations detected. |
Links |
9/10 |
|
Admonitions |
10/10 |
no mechanical violations detected. |
Issues#
Critical#
None found.
High severity#
None found.
Medium severity#
[qe-code-001] (reviewer) — Follow PEP8 unless closer to mathematical notation. Count: 4. Lines: 863, 714, 169, 236. Example: 863 puts
import pandas as pdin the middle of the lecture, 750 lines after the import cell at 109-113 that collects the other three (E402), and pandas is then used again at 999 in an exercise solution. 714 is an f-string with no placeholders,print(f"at δ = 0.2:")(F541). Docstring quoting is inconsistent within the file: 455-459 uses a proper triple-quoted docstring while fifteen other functions use a bare one-line double-quoted string (169, 175, 204, 209, 473, 563, 568, 643, 688, 711, 758, 763, 768, 784, 798). And fourteen code lines run past 79 characters (E501): 169, 236, 248, 462, 463, 696, 716, 768, 776, 784, 877, 881, 882, 1046. 708-710 also leaves one blank line before a top-leveldefwhere PEP8 asks for two.[qe-fig-001] — Do not set figure size unless necessary. Count: 3. Lines: 235, 816, 1045. Example: figsize=.
[qe-fig-003] — No matplotlib embedded titles. Count: 4. Lines: 248, 821, 825, 828. Example: .set_title.
[qe-fig-004] — Caption formatting conventions. Count: 2. Lines: 223, 805. Example: caption of 11 words.
[qe-link-002] — Use doc links for cross-series references. Count: 1. Lines: 82. Example: raw link to python-advanced.quantecon.org.
[qe-math-009] (reviewer) — Choose simplicity in mathematical notation. Count: 3. Lines: 409, 243, 423. Example: \(B\) is two different objects in the same section. 133-135 defines \(B(x)\) as the government’s one-period best response and the lecture uses it that way throughout (433 “\(\eta = B(y)\)”, 445, 507, 521, 549, 616, 684). Then 409 says “Let \(B(W)\) collect the \(w\) components of all admissible pairs”, and 423-426 works with that \(B\) - “\(B\) maps compact sets into compact sets”, “\(B\) is monotone”, “\(W_j = B(W_{j-1})\)”, “\(V = B(V)\)” - while 433-445, twenty lines later, is back to the best response. The code keeps them apart (
Bat 174,B_operatorat 454) and the math does not; the APS operator is conventionally \(\mathcal{B}\) or \(T\), and either would cost nothing. Second, the worst equilibrium value has two names: \(\underline v\) everywhere in the prose and displays (505, 514, 521, 748, 874, 1093, 1128, 1133) but \(v_{min}\) in both figures - the annotation at 243 and the suptitle at 828-829 - so the only place a reader meets the symbol visually is the one place it is spelled differently. Third, \(V\) is the set of SPE values at 423, 426 and 1023, while \(V^g\) is the value functional at 148, 294 and 303; the two are separated by a superscript alone and appear 130 lines apart.[qe-writing-002] (reviewer) — Keep writing clear, concise, and valuable. Count: 3. Lines: 253, 423, 340. Example: 253-254 says the wrong thing about the figure it annotates: “The vertical gap between the curves is the government’s one-period temptation to inflate less than expected.” The gap is \(r(y, B(y)) - r(y, y)\), the gain from deviating, and the direction of the deviation flips at the Nash rate. With the lecture’s own parameters (\(\theta = 1.25\), \(U^* = 5.5\), so \(y^N = 6.875\)), \(B(0) = 2.68 > 0\): at the Ramsey point marked \(v^R\) on that same figure the temptation is to inflate more than expected, and at \(y^\# = 10\), \(B(10) = 8.78 < 10\), so there it is to inflate less. The next sentence (256-257) is the one that is true - “it widens as expected inflation rises above the Nash rate” - so the paragraph describes only the right-hand half of a figure that spans \([0, y^\#]\), and the half it misdescribes is the half the Barro-Gordon argument at 626-658 depends on. Separately 423-426 puts four distinct theorems in one 58-word sentence (largest self-generating set, compactness preservation, monotonicity with its parenthesised statement, and monotone convergence from any \(W_0\) with \(B(W_0) \subseteq W_0\)), and 340-343 is 55 words with three subordinate clauses.
[qe-writing-003] (reviewer) — Maintain logical flow. Count: 2. Lines: 533, 462. Example: two terms are used in section titles long before they are defined. {prf:proposition}
cp_prop_worstat 533 is titled “The worst SPE is self-enforcing” andcp_prop_bestat 555 “The best SPE is self-rewarding”; the definition that gives those words meaning, {prf:definition}cp_selfenf, arrives at 726-732, 193 and 171 lines later. The bodies of the two propositions do spell out what they mean, which softens it, but 737-738 then reaches back up to them from below the definition (“{prf:ref}`cp_prop_worst`and{prf:ref}`cp_prop_best`say that these two structures are not curiosities”) - which is the order that would have worked if the definition had come first. Second, the source text’s own numbering leaks into a lecture that otherwise labels everything itself: the comment at 462 says# equation (10)where the lecture’s label for that display iscp_bound(443), and the two figure titles at 248 and 828 announce “Figure 4.1” and “Figures 4.2-4.4”, which are numbers in chapter 4 of{cite}`Sargent1999`and not in this lecture, whose figures arefig-cpol-schedulesandfig-cpol-three-methods.[qe-writing-007] (reviewer) — Use visual elements to enhance understanding. Count: 2. Lines: 489, 432. Example: the lecture’s whole claim to novelty is that APS iterate on sets rather than values (72-75: “APS iterate an operator that maps sets of continuation values into sets of values”), and the iteration itself is never drawn - it is reported as one line of text, “converged in 534 iterations” (489-491). One picture of \(W_0 \supset W_1 \supset W_2 \supset \cdots \to V\) as a stack of shrinking intervals, or the two endpoints against iteration number, would make the set-valued operator concrete in a way no other figure in the lecture does; the fixed point is plotted against \(\delta\) in exercise 2 (1037-1055) but the approach to it never is. Second, 432-434 asserts the simplification the whole computation rests on - “the constraint in
{prf:ref}`cp_admissible`binds hardest at \(\eta = B(y)\), so we may replace “for all \(\eta\)” by that single deviation” - and the payoff-schedule figure at 223-250 draws only the one-period halves of that comparison. A panel plotting \((1-\delta) r(y, \eta) + \delta \underline v\) against \(\eta\) for a fixed \(y\), with its maximum at \(\eta = B(y)\), would show the reader why one deviation suffices instead of asking them to take it.
Low severity#
[qe-fig-005] — Descriptive figure names for cross-referencing. Count: 1. Lines: 1037. Example: code-cell figure without mystnb figure metadata.
Strengths#
Bold-for-definitions and italic-for-emphasis are held exactly over 1136 lines, in both directions. Every term is bolded where it is coined - subgame perfect equilibria (45), dynamic programming squared (79), rational-expectations payoff (186), deviation payoff (189), promised value (311), admissible (403), self-generating (417), self-enforcing and self-rewarding (729-730) - and every emphasis is italic - reputation (40), continuum (52), worse (92), be (298), want (315), with equality (603), restart (677), everyone (949). Not one crossover, which is rare in this corpus.
The lecture states its own conclusion before building anything, quotes the source’s one-sentence version of it (57, “the multiplicity of credible plans replaces pessimism with agnosticism”), and then says at 59-64 what the conclusion costs the argument of the sibling lecture
{doc}`phillips_two_stories`- so a reader knows what the machinery is for before meeting it.Every closed form is checked against its own definition in code rather than asserted. 215-217 verifies
r_keepandr_cheatagainstrwithnp.allclose; 583-584 verifies the two hand-solved endpoints against the independent APS set iteration and prints whether they agree; and 862-886 recomputes all ten numbers of the book’s table with the book’s own values in a third column.The upper bound \(y^\#\) is introduced with an explicit promissory note - 157-158, “the upper bound \(y^\#\) is what makes the government’s problem non-trivial, as we shall see when we look for the worst equilibrium” - and the note is paid off precisely where promised, at 528-531.
The multiplicity section (740-855) is the sharpest construction in the lecture: three strategies written as three small functions (767-802), one figure with a promised-value row and an inflation row per method (805-831), a printout of settling time and terminal value for each (834-841), and prose that reads the differences off the numbers - and the terminal values check out (method 2 freezes at \(-37.69\) against \(v^N = -38.76\), “just better than Nash” at 847; method 3 at \(-63.12\) against \(\underline v = -63.22\), “barely above the worst one” at 850).
Exercise cpol_ex2’s solution finds something the lecture’s own algebra did not predict and explains it: 1065-1070 observes that Ramsey survives well below the \(\delta^\star \approx 0.28\) of
{eq}`cp_cutoff`and attributes it to the threat being the worst equilibrium rather than Nash reversion - the exercise corrects the reader’s likely reading of the main text.Exercise cpol_ex3 (1081-1133) verifies the tightest of the three constructions phase by phase - promise delivered, continuation inside \(V\), incentive constraint in both phases - and then reads the thin slack it finds as economics (1126-1133: “the punishment for deviating is only barely worse than the equilibrium itself”).
The historical section earns its place instead of decorating: Necker’s 1784 sentence is quoted (335-336) and then taken apart clause by clause into the modern incentive-compatibility condition (340-343), which is a better motivation for {prf:definition}
cp_speat 345 than a paragraph of exposition would have been.
Recommended actions#
Fix 253-254. The vertical gap is the temptation to deviate, and the deviation is upward below the Nash rate and downward above it - with this lecture’s parameters \(B(0) = 2.68\) against an expectation of \(0\). Either say “temptation to deviate” or scope the sentence to \(y > y^N\), which is what 256-257 already does.
Rename one of the two \(B\)’s. \(B(x)\) is the best response from 133 onward and \(B(W)\) is the APS operator from 409 onward, and the two are used within twenty lines of each other at 423-445; \(\mathcal{B}(W)\) or \(T(W)\) for the operator would match the code, which already distinguishes
BfromB_operator.The drafted
qe-writing-006finding at 381 is a false positive: “## The Abreu-Pearce-Stacchetti method” is sentence case - Pearce and Stacchetti are surnames, and capitalising them is grammatically required. Do not lowercase them (see scanner_doubts;abreuis in the checker’s proper-noun list and its two co-authors are not).Relabel \(v_{min}\) as \(\underline v\) in the figure annotation at 243 and the suptitle at 828-829, so the only symbol a reader sees drawn matches the one used in all eight places it appears in the text.
Add a figure of the APS iteration itself - the interval endpoints against iteration number, or a stack of shrinking \(W_j\) - so the claim at 72-75 that the operator maps sets into sets is visible somewhere. At present the iteration’s entire output is the string “converged in 534 iterations” at 490.
Move {prf:definition}
cp_selfenf(726-732) ahead of the two propositions that use its terms in their titles (533, 555), or retitle those propositions to state their content without the undefined words.Sweep the code and figure items: move
import pandas as pdfrom 863 to the import cell at 109-113; drop the empty f-string at 714; move the fourset_title/suptitlecalls (248, 821, 825, 828) into captions and drop the book’s figure numbers from them; shorten the 11-word caption at 227 and the caption at 805; drop the threefigsizeoverrides (235, 816, 1045); raise the line widths fromlw=1.6/lw=1/lw=1.4tolw=2on the data series (236, 237, 818, 822, 1047, 1048) and addlw=2to the three marker calls’ line siblings; addmystnb: figure: caption/namemetadata to the exercise figure at 1037; replace the rawpython-advanced.quantecon.orgURL at 82 with{doc}`advanced:dyn_stack`; settle the docstring quoting on triple quotes; and fix the 14 over-long code lines.