growth_in_dles#
Series: lecture-python-advanced.myst
File:
lectures/growth_in_dles.mdAudit date: 2026-08-26
Corpus snapshot:
b83d6da399Categories audited: writing, math, code, figures, references, links (JAX out of scope)
Overall score: 7.3 / 10
Priority: HIGH
Score breakdown#
Category |
Score |
One-line note |
|---|---|---|
Writing |
3/10 |
|
Math |
7.5/10 |
|
Code |
7.5/10 |
|
JAX |
out of scope |
JAX rules target |
Figures |
7/10 |
|
References |
9/10 |
|
Links |
10/10 |
no mechanical violations detected. |
Admonitions |
N/A |
no admonitions, exercises or solutions. |
Issues#
Critical#
None found.
High severity#
[qe-code-001] (reviewer) — Follow PEP8 unless closer to mathematical notation. Count: 6. Lines: 317, 419, 420, 422, 423, 504. Example: the rule explicitly permits capitals for matrices, and the code declines them exactly where the correspondence with the mathematics would be most useful: 317-325 names the matrices \(A_{22}, C_2, U_b, U_d\) as
a22, c2, ub, ud, while the scalars in the neighbouring cell keep their unicode symbols (γ_1,ϕ_1,δ_k,θ_k). The Example 2 renamings then produce names that read as other symbols:γ2 = 0.15is the scalar \(\gamma_1\) of Example 2 andγ22(420) is the \(\Gamma\) matrix built from it, soγ22looks like \(\gamma_{22}\) and sits three lines from the genuinea22;ϕ_12 = 1(422) is the scalar \(\phi_1\), not \(\phi_{12}\), andϕ_i2(423) is the matrix \(\Phi_i\). Likewise \(\lambda\) is carried inl_λ(312),l_λ2(504) andl_λ3(547) - a prefix that means nothing here, sinceλis free and the neighbouringπ_h,δ_h,θ_htake no prefix.[qe-fig-005] — Descriptive figure names for cross-referencing. Count: 5. Lines: 351, 433, 514, 546, 573. Example: code-cell figure without mystnb figure metadata.
[qe-fig-008] — Use lw=2 for line charts. Count: 10. Lines: 353, 354, 438, 439, 518, 519, 554, 555, 581, 582. Example: plot() without lw=.
[qe-math-003] — Use square brackets for matrix notation. Count: 8. Lines: 172, 231, 241, 246, 255, 263, 293, 410. Example: array used as matrix.
[qe-writing-004] — Avoid unnecessary capitalization in narrative text. Count: 6. Lines: 284, 395, 455, 500, 524, 535. Example: mid-sentence ‘Example’.
Medium severity#
[qe-writing-001] — Use one sentence per paragraph. Count: 4. Lines: 196, 275, 348, 534. Example: 2 sentences in one paragraph.
[qe-writing-002] (reviewer) — Keep writing clear, concise, and valuable. Count: 2. Lines: 284, 359. Example: 282-284 runs two sentences together with no punctuation between them: “(In this economy \(\delta_h\) and \(\theta_h\) are arbitrary as household capital does not enter the equation for consumption services We set them to values that will become useful in Example 3)”. 359-361 hedges twice in one 30-word sentence - “Inspection of the plot shows that the sample paths of consumption and investment drift in ways that suggest that each has or nearly has a random walk or unit root component” - where the next two cells settle the question exactly (366 prints the eigenvalues, 372 states the answer).
[qe-writing-003] (reviewer) — Maintain logical flow. Count: 2. Lines: 575, 587. Example: Example 3.2 is not the experiment the text describes. 571 says “Next let’s lower \(\beta\) to 0.94” - one change against Example 3 - and 587-595 then attributes the loss of growth entirely to \(\beta(\gamma_1 + \delta_k) < 1\). But 575 builds
pref4 = (β_2, l_λ, π_h, δ_h, θ_h)withl_λ, the Example 1 value \(\lambda = 0\) set at 312, rather than thel_λ2 = -1of Example 3 (504-505). So the cell lowers \(\beta\) and removes the habit persistence that 481-485 introduced as the very thing that generates growth, which makes the conclusion at 587-595 unsupported by the run - and inconsistent with Example 3.1, which correctly changes only \(\lambda\) (547-548) while holding everything else at the Example 3 values. Either 575 should readl_λ2or the prose has to say that two parameters moved.[qe-writing-005] (reviewer) — Use bold for definitions, italic for emphasis. Count: 3. Lines: 361, 468, 495. Example: the two terms the lecture introduces are set in quotation marks rather than bold: Jones and Manuelli’s “growth condition” (468, and used again at 471 and 534) and the effective “bliss point” (495), both of which are being defined at those points. The only bold in the file is at 361, on two terms that are not being defined there - “suggest that each has or nearly has a random walk or unit root component” is emphasis, which the rule assigns to italic, and the lecture uses italic correctly for exactly that job at 466 (“sustained growth”).
[qe-writing-007] (reviewer) — Use visual elements to enhance understanding. Count: 3. Lines: 351, 352, 542. Example: the lecture is a comparison of five economies, and all five figures are the same two lines drawn the same way -
plt.plot(econ.c[0], label='Cons.')andplt.plot(econ.i[0], label='Inv.')at 353-354, 438-439, 518-519, 554-555 and 581-582 - with no title, no caption, no axis labels and no shared scale, so on the built page they are five indistinguishable pictures whose differences the reader has to reconstruct from the surrounding prose. The two experiments in Examples 3.1 and 3.2 (542-599) exist purely to be contrasted with Example 3, and putting those three paths on one set of axes, or the five economies in a shared-axis panel, is the figure this lecture is actually about. Second, the pointers that would help a reader locate the source figures are buried in code comments where the published page does not show them: “# This is the right panel of Fig 5.7.1 from p.105 of HS2013” (352) and “# This is the right panel of Fig 5.10.1 from p.110 of HS2013” (517) belong in the prose or in the figure captions. Third, the five eigenvalue cells (366, 376, 460, 531, 566) print bare tuples whose numbers carry the whole argument of the lecture - unit root, below unity, two unit roots, one below unity, one above - and none of them is labelled or tabulated.
Low severity#
[qe-ref-001] — Use correct citation style. Count: 1. Lines: 27. Example:
{cite}in narrative flow: ‘{cite}’.[qe-writing-008] — Remove excessive whitespace between words. Count: 1. Lines: 29. Example: 2 spaces.
Strengths#
The three economies are built as one parameterisation with a stated list of what varies: 54-115 fixes the common structure and 108-115 says an instance is exactly the fourteen matrices and \(\beta\), then 196-267 fixes the shared preferences, technology and information, and 269-271 names the seven parameters plus \(x_0\) that will move across the examples - so each later section only has to give a delta.
Every claim about growth is checked against the eigenvalues of \(A^o\) rather than eyeballed from the plot: 363-377 finds the near-unit endogenous eigenvalue behind Hall’s random walk and attributes the gap to the small adjustment cost \(\phi_1\) (372-373), 455-461 confirms the faster convergence in Example 2, 534-537 finds the two unit eigenvalues in Example 3 and says which parameter each comes from, and 562-563 and 594-595 do the same for the two failures.
Example 2’s two changes are each given their predicted effect before the code runs (397-403): raising \(\phi_1\) from 0.00001 to 1 “will lower the endogenous eigenvalue that is close to 1”, raising \(\gamma_1\) from 0.1 to 0.15 “has the effect of raising the optimal steady-state value of capital” - and 444-452 then reads both effects off the simulation and the computed steady state.
The growth condition is tied back to the earlier example instead of being introduced as new: 471-474 notes that satisfying it is “actually equivalent to setting \(\beta(\gamma_1 + \delta_k) = 1\), the condition that was necessary for consumption to be a random walk in Hall’s model”, which is the condition already flagged at 286-287, and 476-479 then says plainly that it is necessary but not sufficient.
The habit-persistence specification is written out in the form that shows what it does (489-497): the objective with \((c_t - b_t - (1-\delta_h)\sum_j \delta_h^j c_{t-j-1})^2\), followed by the reading that the effective bliss point “now shifts in response to a moving average of past consumption”, and 499-501 points out that only \(\lambda\) has to change because \(\delta_h\) and \(\theta_h\) were already set for this purpose back in Example 1.
Steady states are computed only where they are meaningful and the lecture says so: 379-381 justifies computing one for Example 1 because the largest eigenvalue is strictly below unity, and 389-390 immediately warns that “the near-unity endogenous eigenvalue means that these steady state values are of little relevance”.
Recommended actions#
Fix Example 3.2 at 575: use
l_λ2so that lowering \(\beta\) is the only change from Example 3, or say in the text that habit persistence is switched off at the same time - as written, the conclusion at 587-595 is drawn from a different experiment than the one described.Put the five consumption-investment paths on shared axes (or one multi-panel figure) with
mystnbcaptions and names, since the entire lecture is a comparison across them, and move the HS2013 figure references at 352 and 517 out of code comments into the captions.Recast the eight matrix displays from
\left[{\begin{array}{ccc} ... \end{array}}\right]tobmatrix(172, 231, 241, 246, 255, 263, 293, 410) - this also removes the two\right]'transposes at 296 and 413, which should become^\top(see the scanner doubt below).Give the matrices capitalised names that match the algebra (
A22,C2,Ub,Udat 317-325) and rename the Example 2 parameters so they do not read as double subscripts:γ22(420) is \(\Gamma\),ϕ_12(422) is the scalar \(\phi_1\), andl_λ/l_λ2/l_λ3can simply beλ,λ2,λ3.Bold the two terms being introduced - the “growth condition” (468) and the effective “bliss point” (495) - and italicise the emphasis at 361.
Repair the run-on at 282-284 and tighten 359-361, which hedges about a question the next cell answers exactly.
Sweep the mechanical items:
mystnbfigure metadata on the 5 plotting cells (351, 433, 514, 546, 573),lw=2on the 10 line plots, sentence case for the H3 at 463, lowercase “Example” mid-sentence at 284, 395, 455, 500, 524 and 535,{cite:t}at 27, the 4 two-sentence paragraphs (196, 275, 348, 534) and the double space at 29.