Skip to content

Commit ce920aa

Browse files
committed
Merge branch 'main' into review-inequality
2 parents 0d8a64a + 1d67b3e commit ce920aa

File tree

6 files changed

+47
-72
lines changed

6 files changed

+47
-72
lines changed

lectures/cagan_adaptive.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ kernelspec:
1616
## Introduction
1717

1818

19-
This lecture is a sequel or prequel to another lecture {doc}`monetarist theory of price levels <cagan_ree>`.
19+
This lecture is a sequel or prequel to the lecture {doc}`cagan_ree`.
2020

21-
We'll use linear algebra to do some experiments with an alternative "monetarist" or "fiscal" theory of price levels".
21+
We'll use linear algebra to do some experiments with an alternative "monetarist" or "fiscal" theory of price levels.
2222

23-
Like the model in this lecture {doc}`monetarist theory of price levels <cagan_ree>`, the model asserts that when a government persistently spends more than it collects in taxes and prints money to finance the shortfall, it puts upward pressure on the price level and generates persistent inflation.
23+
Like the model in {doc}`cagan_ree`, the model asserts that when a government persistently spends more than it collects in taxes and prints money to finance the shortfall, it puts upward pressure on the price level and generates persistent inflation.
2424

25-
Instead of the "perfect foresight" or "rational expectations" version of the model in this lecture {doc}`monetarist theory of price levels <cagan_ree>`, our model in the present lecture is an "adaptive expectations" version of a model that Philip Cagan {cite}`Cagan` used to study the monetary dynamics of hyperinflations.
25+
Instead of the "perfect foresight" or "rational expectations" version of the model in {doc}`cagan_ree`, our model in the present lecture is an "adaptive expectations" version of a model that Philip Cagan {cite}`Cagan` used to study the monetary dynamics of hyperinflations.
2626

2727
It combines these components:
2828

@@ -36,7 +36,7 @@ It combines these components:
3636

3737
Our model stays quite close to Cagan's original specification.
3838

39-
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.
39+
As in the lectures {doc}`pv` and {doc}`cons_smooth`, the only linear algebra operations that we'll be using are matrix multiplication and matrix inversion.
4040

4141
To facilitate using linear matrix algebra as our principal mathematical tool, we'll use a finite horizon version of
4242
the model.
@@ -54,7 +54,7 @@ Let
5454
* $\pi_0^*$ public's initial expected rate of inflation between time $0$ and time $1$.
5555

5656

57-
The demand for real balances $\exp\left(\frac{m_t^d}{p_t}\right)$ is governed by the following version of the Cagan demand function
57+
The demand for real balances $\exp\left(m_t^d-p_t\right)$ is governed by the following version of the Cagan demand function
5858

5959
$$
6060
m_t^d - p_t = -\alpha \pi_t^* \: , \: \alpha > 0 ; \quad t = 0, 1, \ldots, T .
@@ -88,7 +88,7 @@ $$ (eq:adaptexpn)
8888
As exogenous inputs into the model, we take initial conditions $m_0, \pi_0^*$
8989
and a money growth sequence $\mu = \{\mu_t\}_{t=0}^T$.
9090
91-
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.
91+
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 exogenous inputs.
9292
9393
We'll do some mental experiments by studying how the model outputs vary as we vary
9494
the model inputs.
@@ -278,7 +278,7 @@ $$ (eq:notre)
278278
This outcome is typical in models in which adaptive expectations hypothesis like equation {eq}`eq:adaptexpn` appear as a
279279
component.
280280
281-
In this lecture {doc}`monetarist theory of the price level <cagan_ree>`, we studied a version of the model that replaces hypothesis {eq}`eq:adaptexpn` with
281+
In {doc}`cagan_ree` we studied a version of the model that replaces hypothesis {eq}`eq:adaptexpn` with
282282
a "perfect foresight" or "rational expectations" hypothesis.
283283
284284
@@ -296,7 +296,7 @@ import matplotlib.pyplot as plt
296296
Cagan_Adaptive = namedtuple("Cagan_Adaptive",
297297
["α", "m0", "Eπ0", "T", "λ"])
298298
299-
def create_cagan_model(α, m0, Eπ0, T, λ):
299+
def create_cagan_adaptive_model(α, m0, Eπ0, T, λ):
300300
return Cagan_Adaptive(α, m0, Eπ0, T, λ)
301301
```
302302
+++ {"user_expressions": []}
@@ -314,7 +314,7 @@ m0 = 1
314314
μ0 = 0.5
315315
μ_star = 0
316316
317-
md = create_cagan_model(α=α, m0=m0, Eπ0=μ0, T=T, λ=λ)
317+
md = create_cagan_adaptive_model(α=α, m0=m0, Eπ0=μ0, T=T, λ=λ)
318318
```
319319
+++ {"user_expressions": []}
320320
@@ -431,7 +431,7 @@ $$
431431
\end{cases}
432432
$$
433433
434-
Notice that we studied exactly this experiment in a rational expectations version of the model in this lecture {doc}`monetarist theory of the price level <cagan_ree>`.
434+
Notice that we studied exactly this experiment in a rational expectations version of the model in {doc}`cagan_ree`.
435435
436436
So by comparing outcomes across the two lectures, we can learn about consequences of assuming adaptive expectations, as we do here, instead of rational expectations as we assumed in that other lecture.
437437
@@ -442,7 +442,7 @@ So by comparing outcomes across the two lectures, we can learn about consequence
442442
π_seq_1, Eπ_seq_1, m_seq_1, p_seq_1 = solve_and_plot(md, μ_seq_1)
443443
```
444444
445-
We invite the reader to compare outcomes with those under rational expectations studied in another lecture {doc}`monetarist theory of price levels <cagan_ree>`.
445+
We invite the reader to compare outcomes with those under rational expectations studied in {doc}`cagan_ree`.
446446
447447
Please note how the actual inflation rate $\pi_t$ "overshoots" its ultimate steady-state value at the time of the sudden reduction in the rate of growth of the money supply at time $T_1$.
448448

lectures/geom_series.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Among these are
4747
These and other applications prove the truth of the wise crack that
4848

4949
```{epigraph}
50-
"in economics, a little knowledge of geometric series goes a long way "
50+
"In economics, a little knowledge of geometric series goes a long way."
5151
```
5252

5353
Below we'll use the following imports:
@@ -171,7 +171,7 @@ The right side records bank $i$'s liabilities,
171171
namely, the deposits $D_i$ held by its depositors; these are
172172
IOU's from the bank to its depositors in the form of either checking
173173
accounts or savings accounts (or before 1914, bank notes issued by a
174-
bank stating promises to redeem note for gold or silver on demand).
174+
bank stating promises to redeem notes for gold or silver on demand).
175175

176176
Each bank $i$ sets its reserves to satisfy the equation
177177

@@ -573,7 +573,7 @@ Recall that $R = 1+r$ and $G = 1+g$ and that $R > G$
573573
and $r > g$ and that $r$ and $g$ are typically small
574574
numbers, e.g., .05 or .03.
575575

576-
Use the Taylor series of $\frac{1}{1+r}$ about $r=0$,
576+
Use the [Taylor series](https://en.wikipedia.org/wiki/Taylor_series) of $\frac{1}{1+r}$ about $r=0$,
577577
namely,
578578

579579
$$
@@ -641,7 +641,7 @@ $$
641641
Expanding:
642642

643643
$$
644-
\begin{aligned} p_0 &=\frac{x_0(1-1+(T+1)^2 rg -r(T+1)+g(T+1))}{1-1+r-g+rg} \\&=\frac{x_0(T+1)((T+1)rg+r-g)}{r-g+rg} \\ &\approx \frac{x_0(T+1)(r-g)}{r-g}+\frac{x_0rg(T+1)}{r-g}\\ &= x_0(T+1) + \frac{x_0rg(T+1)}{r-g} \end{aligned}
644+
\begin{aligned} p_0 &=\frac{x_0(1-1+(T+1)^2 rg +r(T+1)-g(T+1))}{1-1+r-g+rg} \\&=\frac{x_0(T+1)((T+1)rg+r-g)}{r-g+rg} \\ &= \frac{x_0(T+1)(r-g)}{r-g + rg}+\frac{x_0rg(T+1)^2}{r-g+rg}\\ &\approx \frac{x_0(T+1)(r-g)}{r-g}+\frac{x_0rg(T+1)}{r-g}\\ &= x_0(T+1) + \frac{x_0rg(T+1)}{r-g} \end{aligned}
645645
$$
646646

647647
We could have also approximated by removing the second term

lectures/heavy_tails.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ In addition to what's in Anaconda, this lecture will need the following librarie
1919
```{code-cell} ipython3
2020
:tags: [hide-output]
2121
22-
!pip install --upgrade yfinance pandas_datareader interpolation
22+
!pip install --upgrade yfinance pandas_datareader
2323
```
2424

2525
We use the following imports.
@@ -31,7 +31,6 @@ import yfinance as yf
3131
import pandas as pd
3232
import statsmodels.api as sm
3333
34-
from interpolation import interp
3534
from pandas_datareader import wb
3635
from scipy.stats import norm, cauchy
3736
from pandas.plotting import register_matplotlib_converters
@@ -602,7 +601,7 @@ def empirical_ccdf(data,
602601
fw = np.empty_like(aw, dtype='float64')
603602
for i, a in enumerate(aw):
604603
fw[i] = a / np.sum(aw)
605-
pdf = lambda x: interp(data, fw, x)
604+
pdf = lambda x: np.interp(x, data, fw)
606605
data = np.sort(data)
607606
j = 0
608607
for i, d in enumerate(data):

lectures/inequality.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,11 @@ We will need to install the following packages
6666
```{code-cell} ipython3
6767
:tags: [hide-output]
6868
69+
<<<<<<< HEAD
6970
!pip install wbgapi plotly
71+
=======
72+
!pip install quantecon
73+
>>>>>>> main
7074
```
7175

7276
We will also use the following imports.
@@ -76,8 +80,11 @@ import pandas as pd
7680
import numpy as np
7781
import matplotlib.pyplot as plt
7882
import random as rd
83+
<<<<<<< HEAD
7984
import wbgapi as wb
8085
import plotly.express as px
86+
=======
87+
>>>>>>> main
8188
```
8289

8390
## The Lorenz curve

lectures/inflation_history.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Thus, in the US, the price level at $t$ is measured in dollars (month $t$ or yea
3939

4040
Until the early 20th century, in many western economies, price levels fluctuated from year to year but didn't have much of a trend.
4141

42-
Often the price level ended a century near where they started.
42+
Often the price levels ended a century near where they started.
4343

4444
Things were different in the 20th century, as we shall see in this lecture.
4545

@@ -202,7 +202,7 @@ The graphs depict logarithms of price levels during the early post World War I y
202202
* Figure 3.3, Wholesale prices, Poland, 1921-1924 (page 44)
203203
* Figure 3.4, Wholesale prices, Germany, 1919-1924 (page 45)
204204

205-
We have added logarithms of the exchange rates vis a vis the US dollar to each of the four graphs
205+
We have added logarithms of the exchange rates vis-&agrave;-vis the US dollar to each of the four graphs
206206
from chapter 3 of {cite}`sargent2013rational`.
207207

208208
Data underlying our graphs appear in tables in an appendix to chapter 3 of {cite}`sargent2013rational`.
@@ -382,7 +382,7 @@ For each country, we'll plot two graphs.
382382
The first graph plots logarithms of
383383

384384
* price levels
385-
* exchange rates vis a vis US dollars
385+
* exchange rates vis-&agrave;-vis US dollars
386386

387387
For each country, the scale on the right side of a graph will pertain to the price level while the scale on the left side of a graph will pertain to the exchange rate.
388388

@@ -392,7 +392,7 @@ For each country, the second graph plots a centered three-month moving average o
392392

393393
The sources of our data are:
394394

395-
* Table 3.3, $\exp p$
395+
* Table 3.3, retail price level $\exp p$
396396
* Table 3.4, exchange rate with US
397397

398398
```{code-cell} ipython3

lectures/prob_dist.md

Lines changed: 18 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -155,74 +155,43 @@ Check that your answers agree with `u.mean()` and `u.var()`.
155155

156156
#### Bernoulli distribution
157157

158-
Another useful (and more interesting) distribution is the Bernoulli distribution
158+
Another useful distribution is the Bernoulli distribution on $S = \{0,1\}$, which has PMF:
159159

160-
We can import the uniform distribution on $S = \{1, \ldots, n\}$ from SciPy like so:
161-
162-
```{code-cell} ipython3
163-
n = 10
164-
u = scipy.stats.randint(1, n+1)
165-
```
160+
$$
161+
p(x_i)=
162+
\begin{cases}
163+
p & \text{if $x_i = 1$}\\
164+
1-p & \text{if $x_i = 0$}
165+
\end{cases}
166+
$$
166167

168+
Here $x_i \in S$ is the outcome of the random variable.
167169

168-
Here's the mean and variance
170+
We can import the Bernoulli distribution on $S = \{0,1\}$ from SciPy like so:
169171

170172
```{code-cell} ipython3
171-
u.mean(), u.var()
173+
p = 0.4
174+
u = scipy.stats.bernoulli(p)
172175
```
173176

174-
The formula for the mean is $(n+1)/2$, and the formula for the variance is $(n^2 - 1)/12$.
175-
176177

177-
Now let's evaluate the PMF
178+
Here's the mean and variance:
178179

179180
```{code-cell} ipython3
180-
u.pmf(1)
181+
u.mean(), u.var()
181182
```
182183

183-
```{code-cell} ipython3
184-
u.pmf(2)
185-
```
184+
The formula for the mean is $p$, and the formula for the variance is $p(1-p)$.
186185

187186

188-
Here's a plot of the probability mass function:
187+
Now let's evaluate the PMF:
189188

190189
```{code-cell} ipython3
191-
fig, ax = plt.subplots()
192-
S = np.arange(1, n+1)
193-
ax.plot(S, u.pmf(S), linestyle='', marker='o', alpha=0.8, ms=4)
194-
ax.vlines(S, 0, u.pmf(S), lw=0.2)
195-
ax.set_xticks(S)
196-
plt.show()
197-
```
198-
199-
200-
Here's a plot of the CDF:
201-
202-
```{code-cell} ipython3
203-
fig, ax = plt.subplots()
204-
S = np.arange(1, n+1)
205-
ax.step(S, u.cdf(S))
206-
ax.vlines(S, 0, u.cdf(S), lw=0.2)
207-
ax.set_xticks(S)
208-
plt.show()
209-
```
210-
211-
212-
The CDF jumps up by $p(x_i)$ and $x_i$.
213-
214-
215-
```{exercise}
216-
:label: prob_ex2
217-
218-
Calculate the mean and variance for this parameterization (i.e., $n=10$)
219-
directly from the PMF, using the expressions given above.
220-
221-
Check that your answers agree with `u.mean()` and `u.var()`.
190+
u.pmf(0)
191+
u.pmf(1)
222192
```
223193

224194

225-
226195
#### Binomial distribution
227196

228197
Another useful (and more interesting) distribution is the **binomial distribution** on $S=\{0, \ldots, n\}$, which has PMF

0 commit comments

Comments
 (0)