Skip to content

Commit 8cc0d43

Browse files
authored
Merge pull request #161 from QuantEcon/business_cycles_edit
Business cycles edit
2 parents 42031d9 + 1e9bd38 commit 8cc0d43

File tree

1 file changed

+63
-40
lines changed

1 file changed

+63
-40
lines changed

lectures/business_cycle.md

Lines changed: 63 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,15 @@ jupytext:
44
extension: .md
55
format_name: myst
66
format_version: 0.13
7-
jupytext_version: 1.14.4
7+
jupytext_version: 1.14.5
88
kernelspec:
99
display_name: Python 3 (ipykernel)
1010
language: python
1111
name: python3
1212
---
1313

14+
+++ {"user_expressions": []}
15+
1416
# Business Cycles
1517

1618
## Overview
@@ -20,7 +22,7 @@ are fluctuations in economic activity over time.
2022

2123
These fluctuations can be observed in the form of expansions (booms), contractions (recessions), and recoveries.
2224

23-
In this lecture, we will look into a series of economic indicators to visualize the expansions and contractions of economies from the 1960s to the recent pandemic using [World Bank](https://documents.worldbank.org/en/publication/documents-reports/api) and [FRED](https://fred.stlouisfed.org/) data.
25+
We will look into a series of economic indicators to visualize the expansions and contractions of economies from the 1960s to the recent pandemic using [World Bank](https://documents.worldbank.org/en/publication/documents-reports/api) and [FRED](https://fred.stlouisfed.org/) data.
2426

2527
In addition to those installed by Anaconda, this lecture requires
2628
libraries to obtain World Bank and FRED data:
@@ -46,17 +48,20 @@ import pandas_datareader.data as web
4648

4749
```{code-cell} ipython3
4850
:tags: [hide-input]
51+
4952
# Set Graphical Parameters
5053
cycler = plt.cycler(linestyle=['-', '-.', '--', ':'], color=['#377eb8', '#ff7f00', '#4daf4a', '#ff334f'])
5154
plt.rc('axes', prop_cycle=cycler)
5255
```
5356

57+
+++ {"user_expressions": []}
58+
5459
## Data Acquisition
5560

56-
We will use `wbgapi`, and `pandas_datareader` to retrieve data throughout this
61+
We will use `wbgapi` and `pandas_datareader` to retrieve data throughout this
5762
lecture.
5863

59-
So let's explore how to query data first.
64+
Let's explore how to query data first.
6065

6166
We can use `wb.series.info` with the argument `q` to query available data from
6267
the [World Bank](https://www.worldbank.org/en/home).
@@ -67,7 +72,9 @@ For example, let's retrieve the ID to query GDP growth data.
6772
wb.series.info(q='GDP growth')
6873
```
6974

70-
After retrieving the series ID, we use it to obtain the data.
75+
+++ {"user_expressions": []}
76+
77+
Now we use this series ID to obtain the data.
7178

7279
```{code-cell} ipython3
7380
:tags: [hide-output]
@@ -77,24 +84,28 @@ gdp_growth = wb.data.DataFrame('NY.GDP.MKTP.KD.ZG',
7784
gdp_growth
7885
```
7986

80-
We can learn more about the data by checking the metadata of the series
87+
+++ {"user_expressions": []}
88+
89+
We can learn more about the data by checking the series metadata.
8190

8291
```{code-cell} ipython3
8392
:tags: [hide-output]
8493
8594
wb.series.metadata.get('NY.GDP.MKTP.KD.ZG')
8695
```
8796

97+
+++ {"user_expressions": []}
98+
8899
Let's dive into the data with the tools we have.
89100

90101

91102

92103

93104
## GDP Growth Rate
94105

95-
First we look at the GDP growth rate
106+
First we look at the GDP growth rate.
96107

97-
Let's source our data from the World Bank and clean the data
108+
Let's source our data from the World Bank and clean it.
98109

99110
```{code-cell} ipython3
100111
# Use the series ID retrived before
@@ -111,10 +122,13 @@ percentages.
111122
gdp_growth
112123
```
113124

125+
+++ {"user_expressions": []}
126+
114127
The cell below contains a function to generate plots for individual countries.
115128

116129
```{code-cell} ipython3
117130
:tags: [hide-input]
131+
118132
def plot_comparison(data, country, title,
119133
ylabel, title_pos, ax, g_params,
120134
b_params, t_params, ylim=15, baseline=0):
@@ -152,7 +166,9 @@ t_params = {'color':'grey', 'fontsize': 9,
152166
'va':'center', 'ha':'center'}
153167
```
154168

155-
Now we can show some time series.
169+
+++ {"user_expressions": []}
170+
171+
Now we can plot the data as a time series.
156172

157173
Let's start with the United States.
158174

@@ -167,6 +183,8 @@ _ = plot_comparison(gdp_growth, country,
167183
g_params, b_params, t_params)
168184
```
169185

186+
+++ {"user_expressions": []}
187+
170188
GDP growth is positive on average and trending slightly downward over time.
171189

172190
We also see fluctuations over GDP growth over time, some of which are quite large.
@@ -180,18 +198,19 @@ in the growth rate and significant fluctuations.
180198

181199
Notice the very large dip during the Covid-19 pandemic.
182200

183-
184201
```{code-cell} ipython3
185202
fig, ax = plt.subplots()
186203
187204
country = 'United Kingdom'
188205
title = ' United Kingdom (GDP Growth Rate %)'
189206
title_height = 0.1
190-
_ = plot_comparison(gdp_growth, country, title,
207+
_ = plot_comparison(gdp_growth, country, title,
191208
ylabel, 0.1, ax, g_params,
192209
b_params, t_params)
193210
```
194211

212+
+++ {"user_expressions": []}
213+
195214
Now let's consider Japan, which experienced rapid growth in the 1960s and
196215
1970s, followed by slowed expansion in the past two decades.
197216

@@ -220,7 +239,6 @@ _ = plot_comparison(gdp_growth, country, title,
220239
b_params, t_params)
221240
```
222241

223-
224242
Greece had a significant drop in GDP growth around 2010-2011, during the peak
225243
of the Greek debt crisis.
226244

@@ -236,15 +254,15 @@ _ = plot_comparison(gdp_growth, country, title,
236254
g_params, b_params, t_params)
237255
```
238256

257+
+++ {"user_expressions": []}
239258

240259
The figure shows that Argentina has experienced more volatile cycles than
241260
the economies mentioned above.
242261

243262
At the same time, growth of Argentina did not fall during the two developed
244-
economy recessions in the 1970s and 1990s.
263+
economy recessions in the 1970s and 1990s.
245264

246-
247-
+++
265+
+++ {"user_expressions": []}
248266

249267
## Unemployment
250268

@@ -282,8 +300,6 @@ unrate_census.set_index('DATE', inplace=True)
282300
```
283301

284302
```{code-cell} ipython3
285-
:tags: []
286-
287303
# Obtain the NBER-defined recession periods
288304
start_date = datetime.datetime(1929, 1, 1)
289305
end_date = datetime.datetime(2022, 12, 31)
@@ -292,8 +308,6 @@ nber = web.DataReader('USREC', 'fred', start_date, end_date)
292308
```
293309

294310
```{code-cell} ipython3
295-
:tags: []
296-
297311
fig, ax = plt.subplots()
298312
299313
ax.plot(unrate_history, **g_params, color='#377eb8', linestyle='-', linewidth=2)
@@ -313,6 +327,8 @@ ax.set_ylabel('Unemployment Rate (%)')
313327
_ = ax.set_title('Long-run Unemployment Rate, 1929-2022\n with Recession Indicators (United States)', pad=30)
314328
```
315329

330+
+++ {"user_expressions": []}
331+
316332
In the plot, we can see that the expansions and contractions of the labor
317333
market have been highly correlated with recessions.
318334

@@ -328,13 +344,13 @@ post-pandemic recovery.
328344
The labor market has recovered at an unprecedented rate, leading to the
329345
tightest point in the past decades after the shock in 2020-2021.
330346

331-
+++
347+
+++ {"user_expressions": []}
332348

333349
(synchronization)=
334350
## Synchronization
335351

336352
In our previous discussion, we found that developed economies have had
337-
relatively synchronized period of recessions.
353+
relatively synchronized periods of recession.
338354

339355
At the same time, this synchronization does not appear in Argentina until the 2000s.
340356

@@ -408,18 +424,18 @@ title = 'Brazil, China, Argentina, and Mexico (GDP Growth Rate %)'
408424
_ = plot_comparison_multi(gdp_growth.loc[countries, 1962:], countries, title, ylabel, 0.1, 20, ax, g_params, b_params, t_params)
409425
```
410426

411-
By comparing the trend of GDP growth rates between developed and developing
412-
economies, we find that business cycles are becoming more and more
413-
synchronized in 21st-century recessions.
427+
+++ {"user_expressions": []}
428+
429+
On comparison of GDP growth rates between developed and developing
430+
economies, we find that business cycles are becoming more synchronized in 21st-century recessions.
414431

415432
However, emerging and less developed economies often experience more volatile
416433
changes throughout the economic cycles.
417434

418-
Although we have seen synchronization in GDP growth as a general trend, we
419-
also need to acknowledge that the experience of individual countries during
420-
the recession is often very different.
435+
Although we see synchronization in GDP growth as a general trend, the experience of individual countries during
436+
the recession often differs.
421437

422-
Here we use the unemployment rate and the recovery of labor market condition
438+
We use unemployment rate and the recovery of labor market conditions
423439
as another example.
424440

425441
```{code-cell} ipython3
@@ -446,28 +462,27 @@ compared to the US and UK.
446462
However, Japan has a history of very low and stable unemployment rates due to
447463
a constellation of social, demographic, and cultural factors.
448464

449-
+++
465+
+++ {"user_expressions": []}
450466

451467
## Leading Indicators and Correlated Factors for Business Cycles
452468

453-
Understanding leading indicators and correlated factors helps policymakers to
454-
better understand and reflect on the causes and results of business cycles.
469+
Examining leading indicators and correlated factors helps policymakers to
470+
understand the causes and results of business cycles.
455471

456472
We will discuss potential leading indicators and correlated factors from three
457473
perspectives: consumption, production, and credit level.
458474

459475
### Consumption
460476

461-
+++
477+
+++ {"user_expressions": []}
462478

463-
Consumption is dependent on how confident consumers are toward their
479+
Consumption depends on consumers' confidence towards their
464480
income and the overall performance of the economy in the future.
465481

466482
One widely cited indicator for consumer confidence is the [Consumer Sentiment Index](https://fred.stlouisfed.org/series/UMCSENT) published by the University
467483
of Michigan.
468484

469-
We find that consumer sentiment maintains a high level during the expansion
470-
period, but there are significant drops before the recession hits.
485+
We find that consumer sentiment remains high during periods of expansion, but there are significant drops before recession hits.
471486

472487
There is also a clear negative correlation between consumer sentiment and [core consumer price index](https://fred.stlouisfed.org/series/CPILFESL).
473488

@@ -522,18 +537,18 @@ _ = ax.set_title('University of Michigan Consumer Sentiment Index,\n and \
522537
Year-over-year Consumer Price Index Change, 1978-2022 (United States)', pad=30)
523538
```
524539

540+
+++ {"user_expressions": []}
525541

526542
### Production
527543

528-
Consumer confidence often influences the consumption pattern of consumers.
544+
Consumers' confidence often influences their consumption pattern.
529545

530546
This often manifests on the production side.
531547

532-
We find that the real output of the industry is also highly correlated with
548+
We find that real industrial output is highly correlated with
533549
recessions in the economy.
534550

535-
However, instead of being a leading factor, the peak of the contraction in the
536-
production delays compared to consumer confidence and inflation
551+
However, it is not a leading indicator, as the peak of contraction in production delays compared to consumer confidence and inflation.
537552

538553
```{code-cell} ipython3
539554
start_date = datetime.datetime(1919, 1, 1)
@@ -553,6 +568,8 @@ ax = ax.set_title('Year-over-year Industrial Production: \
553568
Total Index, 1919-2022 (United States)', pad=20)
554569
```
555570

571+
+++ {"user_expressions": []}
572+
556573
### Credit Level
557574

558575
Credit contractions often occur during recessions, as lenders become more
@@ -581,5 +598,11 @@ ax = plot_comparison(private_credit, countries, title,
581598
t_params, ylim=None, baseline=None)
582599
```
583600

584-
Note that the credit level expands rapidly in the period of economic expansion
601+
+++ {"user_expressions": []}
602+
603+
Note that the credit rises in periods of economic expansion
585604
and stagnates or even contracts after recessions.
605+
606+
```{code-cell} ipython3
607+
608+
```

0 commit comments

Comments
 (0)