Skip to content

Commit 2d2537c

Browse files
committed
update to incorporate feedback in #371
1 parent c3cf7d0 commit 2d2537c

File tree

1 file changed

+84
-6
lines changed

1 file changed

+84
-6
lines changed

lectures/inflation_history.md

+84-6
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ import matplotlib.pyplot as plt
6161
import matplotlib.dates as mdates
6262
```
6363

64-
Let us bring the data into Pandas from a spreadsheet.
64+
Let us bring the data into pandas from a spreadsheet.
6565

6666
```{code-cell} ipython3
6767
# import data and clean up the index
@@ -78,6 +78,12 @@ We first plot price levels over the period 1600-1914.
7878
During most years in this time interval, the countries were on a gold or silver standard.
7979

8080
```{code-cell} ipython3
81+
---
82+
mystnb:
83+
figure:
84+
caption: "Long run time series of the price level"
85+
name: lrpl
86+
---
8187
df_fig5_bef1914 = df_fig5[df_fig5.index <= 1915]
8288
8389
# create plot
@@ -144,6 +150,12 @@ Although we didn't have to use logarithms in our earlier graphs that had stopped
144150
After the outbreak of the Great War in 1914, the four countries left the gold standard and in so doing acquired the ability to print money to finance government expenditures.
145151

146152
```{code-cell} ipython3
153+
---
154+
mystnb:
155+
figure:
156+
caption: "Long run time series of the price level (log)"
157+
name: lrpl_lg
158+
---
147159
fig, ax = plt.subplots(figsize=[8, 5], dpi=200)
148160
149161
for col in cols:
@@ -193,7 +205,9 @@ We have added logarithms of the exchange rates vis a vis the US dollar to each o
193205
from chapter 3 of {cite}`sargent2013rational`.
194206

195207
Data underlying our graphs appear in tables in an appendix to chapter 3 of {cite}`sargent2013rational`.
196-
We have transcribed all of these data into a spreadsheet `chapter_3.xls` that we read into Pandas.
208+
We have transcribed all of these data into a spreadsheet `chapter_3.xls` that we read into pandas.
209+
210+
In the code cell below we clean this data build a `pandas.dataframe`.
197211

198212
```{code-cell} ipython3
199213
:tags: [hide-input]
@@ -252,6 +266,13 @@ def process_df(df):
252266
df = df.loc[mask]
253267
254268
return df
269+
```
270+
271+
Now we write plotting functions so we can make plots of the price level and exchange rates,
272+
in addition to a plot of inflation rates, for each country of interest.
273+
274+
```{code-cell} ipython3
275+
:tags: [hide-input]
255276
256277
def pe_plot(p_seq, e_seq, index, labs, ax):
257278
"Generate plots for price and exchange rates."
@@ -283,7 +304,9 @@ def pe_plot(p_seq, e_seq, index, labs, ax):
283304
ax.text(0.92, 1.03, 'Exchange Rate', transform=ax.transAxes)
284305
285306
ax1.legend(loc='upper left')
286-
307+
ax.spines[['top']].set_visible(False)
308+
ax1.spines[['top']].set_visible(False)
309+
287310
return ax1
288311
289312
def pr_plot(p_seq, index, ax):
@@ -299,7 +322,7 @@ def pr_plot(p_seq, index, ax):
299322
300323
# calculate and plot moving average
301324
diff_smooth = pd.DataFrame(log_diff_p).rolling(3, center=True).mean()
302-
ax.plot(index[1:], diff_smooth, alpha=0.5)
325+
ax.plot(index[1:], diff_smooth, label='Moving average (3 period)', alpha=0.5)
303326
ax.text(-0.08, 1.03,
304327
'Monthly Inflation Rate',
305328
transform=ax.transAxes)
@@ -308,14 +331,14 @@ def pr_plot(p_seq, index, ax):
308331
mdates.MonthLocator(interval=5))
309332
ax.xaxis.set_major_formatter(
310333
mdates.DateFormatter('%b %Y'))
334+
ax.spines[['right', 'top']].set_visible(False)
311335
312336
for label in ax.get_xticklabels():
313337
label.set_rotation(45)
314338
315339
ax.legend(loc='upper left')
316340
317341
return ax
318-
319342
```
320343

321344
Now we can generate the plot.
@@ -377,6 +400,12 @@ The sources of our data are:
377400
* Table 3.4, exchange rate with US
378401

379402
```{code-cell} ipython3
403+
---
404+
mystnb:
405+
figure:
406+
caption: "Price index and exchange rate (Austria)"
407+
name: pi_xrate_austria
408+
---
380409
p_seq = df_Aus['Retail price index, 52 commodities']
381410
e_seq = df_Aus['Exchange Rate']
382411
@@ -394,6 +423,12 @@ plt.show()
394423
```
395424

396425
```{code-cell} ipython3
426+
---
427+
mystnb:
428+
figure:
429+
caption: "Monthly inflation rate (Austria)"
430+
name: inflationrate_austria
431+
---
397432
# plot moving average
398433
fig, ax = plt.subplots(figsize=[10,7], dpi=200)
399434
_ = pr_plot(p_seq, df_Aus.index, ax)
@@ -419,6 +454,12 @@ The source of our data for Hungary is:
419454
* Table 3.10, price level $\exp p$ and exchange rate
420455

421456
```{code-cell} ipython3
457+
---
458+
mystnb:
459+
figure:
460+
caption: "Price index and exchange rate (Hungary)"
461+
name: pi_xrate_hungary
462+
---
422463
m_seq = df_Hung['Notes in circulation']
423464
p_seq = df_Hung['Hungarian index of prices']
424465
e_seq = 1 / df_Hung['Cents per crown in New York']
@@ -437,6 +478,12 @@ plt.show()
437478
```
438479

439480
```{code-cell} ipython3
481+
---
482+
mystnb:
483+
figure:
484+
caption: "Monthly inflation rate (Hungary)"
485+
name: inflationrate_hungary
486+
---
440487
# plot moving average
441488
fig, ax = plt.subplots(figsize=[10,7], dpi=200)
442489
_ = pr_plot(p_seq, df_Hung.index, ax)
@@ -460,6 +507,12 @@ We dropped the exchange rate after June 1924, when the zloty was adopted. We did
460507
````
461508

462509
```{code-cell} ipython3
510+
---
511+
mystnb:
512+
figure:
513+
caption: "Price index and exchange rate (Poland)"
514+
name: pi_xrate_poland
515+
---
463516
# splice three price series in different units
464517
p_seq1 = df_Pol['Wholesale price index'].copy()
465518
p_seq2 = df_Pol['Wholesale Price Index: '
@@ -500,6 +553,12 @@ plt.show()
500553
```
501554

502555
```{code-cell} ipython3
556+
---
557+
mystnb:
558+
figure:
559+
caption: "Monthly inflation rate (Poland)"
560+
name: inflationrate_poland
561+
---
503562
# plot moving average
504563
fig, ax = plt.subplots(figsize=[10,7], dpi=200)
505564
_ = pr_plot(p_seq, df_Pol.index, ax)
@@ -518,6 +577,12 @@ The sources of our data for Germany are the following tables from chapter 3 of {
518577
* Table 3.19, exchange rate
519578

520579
```{code-cell} ipython3
580+
---
581+
mystnb:
582+
figure:
583+
caption: "Price index and exchange rate (Germany)"
584+
name: pi_xrate_germany
585+
---
521586
p_seq = df_Germ['Price index (on basis of marks before July 1924,'
522587
' reichsmarks after)'].copy()
523588
e_seq = 1/df_Germ['Cents per mark']
@@ -536,6 +601,12 @@ plt.show()
536601
```
537602

538603
```{code-cell} ipython3
604+
---
605+
mystnb:
606+
figure:
607+
caption: "Price index (adjusted) and exchange rate (Germany)"
608+
name: piadj_xrate_germany
609+
---
539610
p_seq = df_Germ['Price index (on basis of marks before July 1924,'
540611
' reichsmarks after)'].copy()
541612
e_seq = 1/df_Germ['Cents per mark'].copy()
@@ -560,6 +631,12 @@ plt.show()
560631
```
561632

562633
```{code-cell} ipython3
634+
---
635+
mystnb:
636+
figure:
637+
caption: "Monthly inflation rate (Germany)"
638+
name: inflationrate_germany
639+
---
563640
# plot moving average
564641
fig, ax = plt.subplots(figsize=[10,7], dpi=200)
565642
_ = pr_plot(p_seq, df_Germ.index, ax)
@@ -578,7 +655,7 @@ These "sudden stops" are also revealed by the permanent drops in three-month mov
578655

579656
In addition, the US dollar exchange rates for each of the four countries shadowed their price levels.
580657

581-
* This pattern is an instance of a force featured in the **purchasing power parity** theory of exchange rates (see [this wikipedia article](https://en.wikipedia.org/wiki/Purchasing_power_parity)).
658+
* This pattern is an instance of a force featured in the [purchasing power parity](https://en.wikipedia.org/wiki/Purchasing_power_parity) theory of exchange rates.
582659

583660
Each of these big inflations seemed to have "stopped on a dime".
584661

@@ -611,3 +688,4 @@ Each government stopped printing money to pay for goods and services once again
611688
The story told in {cite}`sargent2002big` is grounded in a "monetarist theory of the price level" described in {doc}`this lecture <cagan_ree>` and {doc}`this lecture <cagan_adaptive>`.
612689

613690
Those lectures discuss theories about what owners of those rapidly depreciating currencies were thinking and how their beliefs shaped responses of inflation to government monetary and fiscal policies.
691+

0 commit comments

Comments
 (0)