Skip to content

Commit 6f7d93b

Browse files
authored
Merge pull request #240 from QuantEcon/improve-cagans
Improve Graph Layout and Math Notations in Linear Dynamics Chapter
2 parents 4539818 + 9afbf9a commit 6f7d93b

File tree

6 files changed

+106
-494
lines changed

6 files changed

+106
-494
lines changed

lectures/cagan_adaptive.md

Lines changed: 44 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Instead of the "perfect foresight" or "rational expectations" version of the mod
4343

4444
It combines these components:
4545

46-
* a demand function for real money balances that says asserts that the logarithm of the quantity of real balances demanded depends inversely on the public's expected rate of inflation
46+
* a demand function for real money balances that asserts that the logarithm of the quantity of real balances demanded depends inversely on the public's expected rate of inflation
4747

4848
* an **adaptive expectations** model that describes how the public's anticipated rate of inflation responds to past values of actual inflation
4949

@@ -53,12 +53,12 @@ It combines these components:
5353

5454
Our model stays quite close to Cagan's original specification.
5555

56-
As in the {doc}`present values <pv>` and {doc}`consumption smoothing<cons_smooth>` lectures, the only linear algebra operations that we'll be using are matrix multplication and matrix inversion.
56+
As in the {doc}`present values <pv>` and {doc}`consumption smoothing<cons_smooth>` lectures, the only linear algebra operations that we'll be using are matrix multiplication and matrix inversion.
5757

5858
To facilitate using linear matrix algebra as our principal mathematical tool, we'll use a finite horizon version of
5959
the model.
6060

61-
## Structure of the Model
61+
## Structure of the model
6262

6363
Let
6464

@@ -75,13 +75,13 @@ The demand for real balances $\exp\left(\frac{m_t^d}{p_t}\right)$ is governed by
7575

7676
$$
7777
m_t^d - p_t = -\alpha \pi_t^* \: , \: \alpha > 0 ; \quad t = 0, 1, \ldots, T .
78-
$$ (eq:caganmd)
78+
$$ (eq:caganmd_ad)
7979
8080
8181
This equation asserts that the demand for real balances
8282
is inversely related to the public's expected rate of inflation.
8383
84-
Equating the logarithm $m_t^d$ of the demand for money to the logarithm $m_t$ of the supply of money in equation {eq}`eq:caganmd` and solving for the logarithm $p_t$
84+
Equating the logarithm $m_t^d$ of the demand for money to the logarithm $m_t$ of the supply of money in equation {eq}`eq:caganmd_ad` and solving for the logarithm $p_t$
8585
of the price level gives
8686
8787
$$
@@ -105,9 +105,9 @@ $$
105105
$$ (eq:adaptexpn)
106106
107107
As exogenous inputs into the model, we take initial conditions $m_0, \pi_0^*$
108-
and a money growth sequence $\vec \mu = \{\mu_t\}_{t=0}^T$.
108+
and a money growth sequence $\mu = \{\mu_t\}_{t=0}^T$.
109109
110-
As endogenous outputs of our model we want to find sequences $\vec \pi = \{\pi_t\}_{t=0}^T, \vec p = \{p_t\}_{t=0}^T$ as functions of the endogenous inputs.
110+
As endogenous outputs of our model we want to find sequences $\pi = \{\pi_t\}_{t=0}^T, p = \{p_t\}_{t=0}^T$ as functions of the endogenous inputs.
111111
112112
We'll do some mental experiments by studying how the model outputs vary as we vary
113113
the model inputs.
@@ -148,10 +148,10 @@ $$
148148
Write this equation as
149149
150150
$$
151-
A \vec \pi^* = (1-\lambda) B \vec \pi + \vec \pi_0^*
151+
A \pi^* = (1-\lambda) B \pi + \pi_0^*
152152
$$ (eq:eq1)
153153
154-
where the $(T+2) \times (T+2) $matrix $A$, the $(T+2)\times (T+1)$ matrix $B$, and the vectors $\vec \pi^* , \vec \pi_0, \pi_0^*$
154+
where the $(T+2) \times (T+2) $matrix $A$, the $(T+2)\times (T+1)$ matrix $B$, and the vectors $\pi^* , \pi_0, \pi_0^*$
155155
are defined implicitly by aligning these two equations.
156156
<!-- #endregion -->
157157
@@ -179,58 +179,58 @@ $$
179179
Represent the previous equation system in terms of vectors and matrices as
180180

181181
$$
182-
\vec \pi = \vec \mu + C \vec \pi^*
182+
\pi = \mu + C \pi^*
183183
$$ (eq:eq2)
184184
185185
where the $(T+1) \times (T+2)$ matrix $C$ is defined implicitly to align this equation with the preceding
186186
equation system.
187187
188188
189189
190-
## Harvesting Returns from our Matrix Formulation
190+
## Harvesting returns from our matrix formulation
191191
192192
193-
We now have all of the ingredients we need to solve for $\vec \pi$ as
194-
a function of $\vec \mu, \pi_0, \pi_0^*$.
193+
We now have all of the ingredients we need to solve for $\pi$ as
194+
a function of $\mu, \pi_0, \pi_0^*$.
195195
196196
Combine equations {eq}`eq:eq1`and {eq}`eq:eq2` to get
197197
198198
$$
199199
\begin{align*}
200-
A \vec \pi^* & = (1-\lambda) B \vec \pi + \vec \pi_0^* \cr
201-
& = (1-\lambda) B \left[ \vec \mu + C \vec \pi^* \right] + \vec \pi_0^*
200+
A \pi^* & = (1-\lambda) B \pi + \pi_0^* \cr
201+
& = (1-\lambda) B \left[ \mu + C \pi^* \right] + \pi_0^*
202202
\end{align*}
203203
$$
204204
205205
which implies that
206206
207207
$$
208-
\left[ A - (1-\lambda) B C \right] \vec \pi^* = (1-\lambda) B \vec \mu+ \vec \pi_0^*
208+
\left[ A - (1-\lambda) B C \right] \pi^* = (1-\lambda) B \mu+ \pi_0^*
209209
$$
210210
211211
Multiplying both sides of the above equation by the inverse of the matrix on the left side gives
212212
213213
$$
214-
\vec \pi^* = \left[ A - (1-\lambda) B C \right]^{-1} \left[ (1-\lambda) B \vec \mu+ \vec \pi_0^* \right]
214+
\pi^* = \left[ A - (1-\lambda) B C \right]^{-1} \left[ (1-\lambda) B \mu+ \pi_0^* \right]
215215
$$ (eq:eq4)
216216
217-
Having solved equation {eq}`eq:eq4` for $\vec \pi^*$, we can use equation {eq}`eq:eq2` to solve for $\vec \pi$:
217+
Having solved equation {eq}`eq:eq4` for $\pi^*$, we can use equation {eq}`eq:eq2` to solve for $\pi$:
218218
219219
$$
220-
\vec \pi = \vec \mu + C \vec \pi^*
220+
\pi = \mu + C \pi^*
221221
$$
222222
223223
224-
We have thus solved for two of the key endogenous time series determined by our model, namely, the sequence $\vec \pi^*$
225-
of expected inflation rates and the sequence $\vec \pi$ of actual inflation rates.
224+
We have thus solved for two of the key endogenous time series determined by our model, namely, the sequence $\pi^*$
225+
of expected inflation rates and the sequence $\pi$ of actual inflation rates.
226226
227-
Knowing these, we can then quickly calculate the associated sequence $\vec p$ of the logarithm of the price level
227+
Knowing these, we can then quickly calculate the associated sequence $p$ of the logarithm of the price level
228228
from equation {eq}`eq:eqfiscth1`.
229229
230230
Let's fill in the details for this step.
231231
<!-- #endregion -->
232232
233-
Since we now know $\vec \mu$ it is easy to compute $\vec m$.
233+
Since we now know $\mu$ it is easy to compute $m$.
234234
235235
Thus, notice that we can represent the equations
236236
@@ -258,23 +258,23 @@ m_1 \cr m_2 \cr m_3 \cr \vdots \cr m_T \cr m_{T+1}
258258
+ \begin{bmatrix}
259259
m_0 \cr 0 \cr 0 \cr \vdots \cr 0 \cr 0
260260
\end{bmatrix}
261-
$$ (eq:eq101)
261+
$$ (eq:eq101_ad)
262262
263-
Multiplying both sides of equation {eq}`eq:eq101` with the inverse of the matrix on the left will give
263+
Multiplying both sides of equation {eq}`eq:eq101_ad` with the inverse of the matrix on the left will give
264264
265265
$$
266266
m_t = m_0 + \sum_{s=0}^{t-1} \mu_s, \quad t =1, \ldots, T+1
267-
$$ (eq:mcum)
267+
$$ (eq:mcum_ad)
268268
269-
Equation {eq}`eq:mcum` shows that the log of the money supply at $t$ equals the log $m_0$ of the initial money supply
269+
Equation {eq}`eq:mcum_ad` shows that the log of the money supply at $t$ equals the log $m_0$ of the initial money supply
270270
plus accumulation of rates of money growth between times $0$ and $t$.
271271
272272
We can then compute $p_t$ for each $t$ from equation {eq}`eq:eqfiscth1`.
273273
274-
We can write a compact formula for $\vec p $ as
274+
We can write a compact formula for $p $ as
275275
276276
$$
277-
\vec p = \vec m + \alpha \hat \pi^*
277+
p = m + \alpha \hat \pi^*
278278
$$
279279
280280
where
@@ -288,16 +288,16 @@ $$
288288
\end{bmatrix},
289289
$$
290290
291-
which is just $\vec \pi^*$ with the last element dropped.
291+
which is just $\pi^*$ with the last element dropped.
292292
293293
294294
295-
## Forecast Errors
295+
## Forecast errors
296296
297297
Our computations will verify that
298298
299299
$$
300-
\hat \pi^* \neq \vec \pi,
300+
\hat \pi^* \neq \pi,
301301
$$
302302
303303
so that in general
@@ -380,25 +380,21 @@ def solve_and_plot(model, μ_seq):
380380
381381
T_seq = range(model.T+2)
382382
383-
fig, ax = plt.subplots(2, 3, figsize=[10,5], dpi=200)
384-
ax[0,0].plot(T_seq[:-1], μ_seq)
385-
ax[0,1].plot(T_seq[:-1], π_seq, label=r'$\pi_t$')
386-
ax[0,1].plot(T_seq, Eπ_seq, label=r'$\pi^{*}_{t}$')
387-
ax[0,2].plot(T_seq, m_seq - p_seq)
388-
ax[1,0].plot(T_seq, m_seq)
389-
ax[1,1].plot(T_seq, p_seq)
383+
fig, ax = plt.subplots(5, 1, figsize=[5, 12], dpi=200)
384+
ax[0].plot(T_seq[:-1], μ_seq)
385+
ax[1].plot(T_seq[:-1], π_seq, label=r'$\pi_t$')
386+
ax[1].plot(T_seq, Eπ_seq, label=r'$\pi^{*}_{t}$')
387+
ax[2].plot(T_seq, m_seq - p_seq)
388+
ax[3].plot(T_seq, m_seq)
389+
ax[4].plot(T_seq, p_seq)
390390
391-
x_lab = r'$t$'
392391
y_labs = [r'$\mu$', r'$\pi$', r'$m - p$', r'$m$', r'$p$']
393392
394-
k = 0
395-
for i,j in zip([0, 0, 0, 1, 1], [0, 1, 2, 0, 1]):
396-
ax[i,j].set_xlabel(x_lab)
397-
ax[i,j].set_ylabel(y_labs[k])
398-
k = k + 1
393+
for i in range(5):
394+
ax[i].set_xlabel(r'$t$')
395+
ax[i].set_ylabel(y_labs[i])
399396
400-
ax[0,1].legend()
401-
ax[1,2].set_axis_off()
397+
ax[1].legend()
402398
plt.tight_layout()
403399
plt.show()
404400
@@ -425,7 +421,7 @@ $$
425421
\end{align*}
426422
$$
427423
428-
By assuring that the coefficient on $\pi_t$ is less than one in absolulte value, condition {eq}`eq:suffcond` assures stability of the dynamics of $\{\pi_t\}$ described by the last line of our string of deductions.
424+
By assuring that the coefficient on $\pi_t$ is less than one in absolute value, condition {eq}`eq:suffcond` assures stability of the dynamics of $\{\pi_t\}$ described by the last line of our string of deductions.
429425
430426
The reader is free to study outcomes in examples that violate condition {eq}`eq:suffcond`.
431427
<!-- #endregion -->

lectures/cagan_ree.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@ In those experiments, we'll encounter an instance of a ''velocity dividend'' tha
5050

5151
To facilitate using linear matrix algebra as our main mathematical tool, we'll use a finite horizon version of the model.
5252

53-
As in the {doc}`present values <pv>` and {doc}`consumption smoothing<cons_smooth>` lectures, the only linear algebra that we'll be using are matrix multplication and matrix inversion.
53+
As in the {doc}`present values <pv>` and {doc}`consumption smoothing<cons_smooth>` lectures, the only linear algebra that we'll be using are matrix multiplication and matrix inversion.
5454

5555

56-
## Structure of the Model
56+
## Structure of the model
5757

5858

5959
The model consists of
@@ -148,7 +148,7 @@ $$ (eq:pieq)
148148
By multiplying both sides of equation {eq}`eq:pieq` by the inverse of the matrix on the left side, we can calculate
149149
150150
$$
151-
\vec \pi \equiv \begin{bmatrix} \pi_0 \cr \pi_1 \cr \pi_2 \cr \vdots \cr \pi_{T-1} \cr \pi_T
151+
\pi \equiv \begin{bmatrix} \pi_0 \cr \pi_1 \cr \pi_2 \cr \vdots \cr \pi_{T-1} \cr \pi_T
152152
\end{bmatrix}
153153
$$
154154
@@ -192,8 +192,8 @@ $$
192192
m_t = m_0 + \sum_{s=0}^{t-1} \mu_s, \quad t =1, \ldots, T+1
193193
$$ (eq:mcum)
194194
195-
Equation {eq}`eq:mcum` shows that the log of the money supply at $t$ equals the log $m_0$ of the initial money supply
196-
plus accumulation of rates of money growth between times $0$ and $t$.
195+
Equation {eq}`eq:mcum` shows that the log of the money supply at $t$ equals the log of the initial money supply $m_0$
196+
plus accumulation of rates of money growth between times $0$ and $T$.
197197
198198
## Continuation values
199199
@@ -250,7 +250,7 @@ m0 = 1
250250
251251
+++ {"user_expressions": []}
252252
253-
Now we can solve the model to compute $\pi_t$, $m_t$ and $p_t$ for $t =1, \ldots, T+1$
253+
Now we can solve the model to compute $\pi_t$, $m_t$ and $p_t$ for $t =1, \ldots, T+1$ using the matrix equation above
254254
255255
```{code-cell} ipython3
256256
def solve(model):
@@ -371,13 +371,13 @@ reduction in $\mu$ has been foreseen.
371371
372372
#### Experiment 2: an unforeseen sudden stabilization
373373
374-
This experiment deviates a little bit from a pure version our "perfect foresight"
374+
This experiment deviates a little bit from a pure version of our "perfect foresight"
375375
assumption by assuming that a sudden permanent reduction in $\mu_t$ like that
376376
analyzed in experiment 1 is completely unanticipated.
377377
378378
Such a completely unanticipated shock is popularly known as an "MIT shock".
379379
380-
The mental experiment involves switching at at time $T_1$ from an initial "continuation path" for $\{\mu_t, \pi_t\} $ to another path that involves a permanently lower inflation frate.
380+
The mental experiment involves switching at time $T_1$ from an initial "continuation path" for $\{\mu_t, \pi_t\} $ to another path that involves a permanently lower inflation rate.
381381
382382
**Initial Path:** $\mu_t = \mu_0$ for all $t \geq 0$. So this path is for $\{\mu_t\}_{t=0}^\infty$; the associated
383383
path for $\pi_t$ has $\pi_t = \mu_0$.
@@ -593,7 +593,7 @@ By letting money jump according to equation {eq}`eq:eqnmoneyjump` the monetary a
593593
from **falling** at the moment that the unanticipated stabilization arrives.
594594
595595
In various research papers about stabilizations of high inflations, the jump in the money supply described by equation {eq}`eq:eqnmoneyjump` has been called
596-
"the velocity dividend" that a government reaps from implementin a regime change that sustains a permanently lower inflation rate.
596+
"the velocity dividend" that a government reaps from implementing a regime change that sustains a permanently lower inflation rate.
597597
598598
#### Technical Details about whether $p$ or $m$ jumps at $T_1$
599599

0 commit comments

Comments
 (0)