phillips_escaping_nash#
Series: lecture-python.myst
File:
lectures/phillips_escaping_nash.mdAudit date: 2026-08-26
Corpus snapshot:
e25fdf2345Categories audited: writing, math, code, figures, references, links, admonitions (JAX out of scope)
Overall score: 7.9 / 10
Priority: LOW
Score breakdown#
Category |
Score |
One-line note |
|---|---|---|
Writing |
5/10 |
|
Math |
9.5/10 |
|
Code |
8.5/10 |
|
JAX |
out of scope |
JAX rules target |
Figures |
4.5/10 |
|
References |
7.5/10 |
|
Links |
10/10 |
no mechanical violations detected. |
Admonitions |
10/10 |
no mechanical violations detected. |
Issues#
Critical#
None found.
High severity#
[qe-fig-001] — Do not set figure size unless necessary. Count: 5. Lines: 172, 219, 324, 420, 508. Example: figsize=.
[qe-fig-003] — No matplotlib embedded titles. Count: 7. Lines: 181, 224, 331, 339, 427, 513, 518. Example: .set_title.
[qe-fig-004] — Caption formatting conventions. Count: 5. Lines: 164, 203, 317, 402, 498. Example: caption of 7 words.
[qe-fig-008] — Use lw=2 for line charts. Count: 6. Lines: 220, 326, 327, 334, 509, 515. Example: plot() without lw=.
[qe-ref-001] — Use correct citation style. Count: 5. Lines: 40, 95, 476, 480, 526. Example:
{cite}in narrative flow: ‘of{cite}’.
Medium severity#
[qe-code-001] (reviewer) — Follow PEP8 unless closer to mathematical notation. Count: 4. Lines: 512, 517, 173, 118. Example: 512-513 and 517-518 put two statements on one line with a semicolon -
axes[0].set_xlabel('time'); axes[0].set_ylabel('inflation level')and three more - which PEP8 forbids (E702); the structurally identical two-panel cell at 326-340 writes exactly these calls one per line, so the file contradicts itself in the space of 180 lines. Eight code lines run past 79 characters (E501): 118 (93), 159 (81), 173 (94), 328 (81), 347 (86), 349 (99), 382 (81), 516 (87). The LaTeX labels are quoted two ways in adjacent cells - raw strings at 173, 425, 426 and 516 (label=r'$\gamma_{-1} = u(1+\gamma_1^2)$') but escaped backslashes at 326, 327 and 328 (label='intercept $\\gamma_{-1}$'). And the four one-line docstrings at 118, 128, 133 and 304 use single double-quotes rather than the triple quotes PEP 257 asks for.[qe-math-009] (reviewer) — Choose simplicity in mathematical notation. Count: 3. Lines: 76, 146, 489. Example: 76 introduces \(\hat x_n\) in the statement of the true model only to set it equal to \(x_n\) in the same display (
\hat x_n = x_n); the symbol never appears again, so the truth could be written \(U_n = u - \theta(\pi_n - x_n) + \sigma_1 W_{1n}\) with one sentence about rational expectations and one fewer decorated letter. The second-moment matrix is written three ways for one object: \(\bar M\) with no argument at 146, \(\bar M(\gamma)\) at 196 and 258, andMin the code (127, 130, 213, 417). And the expectation operator takes square brackets at 146 (\mathbb{E}\left[\Phi(U - \Phi^\top \gamma)\right], matching the style guide) but parentheses at 489 (\mathbb{E}(\sigma_\pi \mid \gamma)).[qe-writing-002] (reviewer) — Keep writing clear, concise, and valuable. Count: 4. Lines: 239, 434, 446, 528. Example: 239 is a 45-word sentence that introduces three objects at once - “one defines a log-moment-generating (H-) functional of the least-squares innovations, its Legendre transform \(L\), and an action functional \(S(T, \gamma) = \int_0^T L\,ds\) that measures how “costly” - how improbable - the path is” - of which only the action is used again (\(L\) never reappears, and the H-functional only obliquely at 243). 446 is 42 words with three chained clauses, 528 is 45 words with the payload behind a colon and two negations (“must now offset not only the control errors but also…”), and 436 is 45 words. Separately the same conclusion is stated three times in nearly the same words: 434 “The escape dynamics only need to start the departure; the mean dynamics finish the job”, 436 “the mean dynamics eventually carry beliefs back to Nash”, 450 “rekindling the mean dynamics that carry it back to Nash”, and then 621 again “the escape dynamics only need to nudge beliefs out of it, after which the mean dynamics finish the job”. 396 and 432 likewise say the same thing twice (“Near the self-confirming equilibrium the mean dynamics point toward it” / “Near the self-confirming equilibrium the arrows push back toward Nash”).
[qe-writing-003] (reviewer) — Maintain logical flow. Count: 4. Lines: 362, 446, 454, 505. Example: four places where the argument skips a step. (a) 362 states the selection criterion as “the dominant escape is the one that reaches the boundary fastest”, but 364 then computes something else - “the instantaneous velocity of each candidate at the self-confirming equilibrium” - and 386 reads the ranking straight off those four norms. Instantaneous speed at one point is not time-to-boundary, and the lecture never says why they agree here (they need not: the second and third candidates have a different direction and so a different path length). The exercise machinery to settle it already exists -
left_circleat 303-307 returns the exit time - so integrating all four and printing four exit times would make 362 literally true. (b) 446 and 448 say the escape steepens the perceived Phillips curve until it is vertical, while 352 and 494 say the slope \(\gamma_1\) rises from \(-1\) toward zero. Both are correct - steep/vertical in the traditional diagram with inflation on the vertical axis, flat in the regression \(U_n = \gamma_1 \pi_n + \gamma_{-1}\) that this lecture actually writes at 88 - but the lecture never draws or names the traditional diagram, so a reader tracking \(\gamma_1 \to 0\) through five sections meets “steepen” and “vertical” at 446-448 with nothing to reconcile them against. © 454-460 makes three quantitative claims about the minimized action - the mean escape time grows like \(\exp(\bar S/\varepsilon)\), the dynamic model has “a much smaller \(\bar S\)”, escapes are therefore “more frequent” - and \(\bar S\) is never computed, nor is \(Q\) (243, 248), nor \(\varepsilon\), which appears in no code cell in the lecture. (d) the Ellison-Yates section adds a third shock \(W_3\) with standard deviation \(\sigma_3\), but \(\sigma_3\) is not a field ofEscapeModel(120); 505 hard-codesσ3 = 0.9outside the class and 506 applies{eq}`en_vol`toslope, the belief path integrated from the two-shock escape ODE at 310. 496 is honest that this is what it does, but the escape path in the extended model is not the one plotted, and 528-530 then reasons about how \(\sigma_3\) changes escape timing - an effect the figure at 508-521 cannot show.[qe-writing-004] — Avoid unnecessary capitalization in narrative text. Count: 1. Lines: 265. Example: mid-sentence ‘Theorem’.
[qe-writing-005] (reviewer) — Use bold for definitions, italic for emphasis. Count: 3. Lines: 51, 55, 44. Example: the lecture’s central object is italicised where it is coined and bolded 190 lines later: 51 introduces it as “the escape has a dominant path” and 241 then writes “The dominant escape path minimizes the action” - italic for the definition, bold for the restatement, which is the rule inverted in both directions at once. 55 uses bold for pure emphasis, “We work with the analytically tractable static model”, where the lecture’s own emphasis elsewhere is correctly italic (rare 235, most likely 237, perturbed 251, dominant 51, globally stable 199). 44 bolds “theory of large deviations”, the name of an existing field that the lecture uses but does not define, alongside genuine definitions in the same idiom (mean dynamics 48, escape dynamics 49, action functional 239, experimentation trap 444, induction hypothesis 352) - so bold carries two jobs.
[qe-writing-007] (reviewer) — Use visual elements to enhance understanding. Count: 2. Lines: 383, 448. Example: the section named after a race prints its result as four aligned numbers rather than drawing it. 366-383 computes a belief velocity for each of the four shock pairs and prints
|velocity|; 386-390 then explains that two of the four tie on speed and the winner is picked by direction - which is exactly what a plot cannot help but show and a table of norms hides. The vector-field cell at 402-429 is already drawing arrows in the same belief space, so four labelled arrows at \(\bar\gamma\), two of them equal in length and opposite in sign, would settle 362-390 in one glance. Second, the natural-rate claim at 442-448 is about the shape of the perceived Phillips curve - dispersion in inflation steepens it until it is vertical - and no figure in the lecture is drawn in the \((\text{unemployment}, \text{inflation})\) plane; two fitted lines, one at \(\gamma_1 = -\theta\) and one at \(\gamma_1 \approx 0\), over a scatter of the data the government generates, would make both the trap and the escape visible and would remove the steepen-versus-rise ambiguity noted under qe-writing-003.
Low severity#
None found.
Strengths#
The note at 93-100 declares the coefficient-ordering convention and names the sibling lecture that reverses it - “The slope comes first here, and the regressors are \(\Phi = (\pi, 1)\) …
{doc}`phillips_priors`studies the same model with the intercept first; see the warning there for the translation” - so the one cross-lecture notation hazard in this family is signposted from both ends instead of being left to trap the reader.All five figure cells carry
mystnb: figure: captionandnamemetadata (164-170, 203-209, 317-323, 402-408, 498-504), so every figure in the lecture is captioned and referenceable.The self-confirming equilibrium is verified rather than asserted: 156-161 prints the beliefs, the implied inflation and
model.g_bar(γ_sce)side by side, with the closed forms named in the output text (“slope -θ, intercept u(1+θ²)”, “= Nash = θu”), so the reader sees \(\bar g(\bar\gamma) = 0\) hold numerically two lines after 149 states it.The mean dynamics get their own falsification before the escape dynamics are introduced: the ODE is integrated from a perturbed start (215-217), the resulting inflation path is plotted returning to Nash (219-226), and 229-231 then states the negative result this establishes - “The mean dynamics cannot, on their own, explain the recurrent visits to low inflation” - which is what motivates the rest of the lecture.
Exercise en_ex2 (584-621) converts the lecture’s one qualitative claim about reinforcement (398, “the mean dynamics themselves start pointing toward Ramsey”) into a measurement, evaluating the cosine between the mean-dynamics drift and the direction to the Ramsey belief at five points along the escape path, and 617-621 reads the numbers back against CWS’s own emphasis, concluding that the opposition they stress “is confined to a tiny neighbourhood”.
The Ellison-Yates extension (472-524) is grafted onto the belief path already computed rather than onto a second model, and 496 says exactly that (“Applying
{eq}`en_vol`to the belief path we already computed”), so the level and the volatility panels at 508-521 are two readings of one trajectory.Seven of the nine displayed equations are labelled and genuinely cited later, several of them more than once:
en_truthat 81,en_beliefat 102 and 141,en_meanat 199,en_controlat 263,en_forceat 358, 390 and 548,en_escapeat 294 and 550,en_volat 496 - so the algebra is referenced rather than displayed and abandoned (en_bestrespat 105 anden_perturbedat 254 are the two exceptions).
Recommended actions#
Integrate all four candidate ODEs to the radius-5 boundary and print four exit times, so that 362 (“the dominant escape is the one that reaches the boundary fastest”) is the quantity actually computed - at present 366-383 computes instantaneous velocity at \(\bar\gamma\) and 386 ranks on that. The event function
left_circleat 303-307 already does the work; then draw the four forcing directions as arrows on the existing vector-field axes (402-429) so the two-way tie broken by direction at 386-388 is visible.Either compute \(\bar S\) for the static model or soften 454-460: the section makes three quantitative claims about the minimized action and the gain \(\varepsilon\), and neither symbol appears in any code cell. The same applies to \(Q\) (243, 248), which is described as “a fourth-moment matrix obtained from Lyapunov equations” and never built.
Add a sentence or a figure in the \((\text{unemployment}, \text{inflation})\) plane reconciling “the slope rises … toward zero” (352, 494) with “steepen its estimated Phillips curve” and “the perceived Phillips curve is vertical” (446, 448) - the two describe the same escape in opposite words because they use different axes, and the lecture only ever draws belief space.
Ignore three of the nine drafted
qe-fig-008findings: 175 (ax.plot(γ_sce[0], γ_sce[1], 'ko', ms=8)), 422 (ax.plot(*γ_sce, 'ko', ms=8, ...)) and 423 (ax.plot(0, model.u, 'C2s', ms=8, ...)) draw single markers, not lines;lw=2on them has no visible effect. The other six (220, 326, 327, 334, 509, 515) are genuine line plots and do wantlw=2.Fix the four semicolon-joined statement lines at 512, 513, 517 and 518 to match the one-call-per-line style of the parallel cell at 326-340, and settle the label quoting - raw strings at 173, 425 and 516 against escaped backslashes at 326-328.
Settle bold and italic: bold the definition at 51 (dominant path) or italicise the restatement at 241, italicise the emphasis at 55 (static), and drop the bold from “theory of large deviations” at 44, which names a field rather than defining a term.
Sweep the figure and reference items: shorten the five captions to the 6-word maximum (168 is 8 words, 207 is 10, 321 is 10, 406 is 8, 502 is 9), move the seven
set_titlecalls (181, 224, 331, 339, 427, 513, 518) into those captions, drop the fivefigsizeoverrides (172, 219, 324, 420, 508), switch the four{cite}calls whose author names carry the sentence to{cite:t}(40, 95, 476, 526), lower-case “Theorem” at 265, either fold \(\hat x_n\) out of{eq}`en_truth`(76) or settle on one of \(\bar M\) / \(\bar M(\gamma)\), and either cite or unlabel the two orphan labelsen_bestresp(105) anden_perturbed(254).