Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add figure in long run growth lec #274

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lectures/_toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ parts:
numbered: true
chapters:
- file: linear_equations
- file: symbolic_sympy
- file: eigen_I
- file: intro_supply_demand
- caption: Linear Dynamics
Expand Down
43 changes: 38 additions & 5 deletions lectures/long_run_growth.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,23 @@ jupytext:
extension: .md
format_name: myst
format_version: 0.13
jupytext_version: 1.14.4
jupytext_version: 1.14.7
kernelspec:
display_name: Python 3 (ipykernel)
language: python
name: python3
---

+++ {"user_expressions": []}

# Economic Growth Evidence

## Overview

Adam Tooze's account of the geopolitical precedents and antecedents of World War I includes a comparison of how Gross National Products of European Great Powers had evolved during the 70 years preceding 1914 (see chapter 1 of {cite}`Tooze_2014`).

![The Deluge: The Remaking of World Order](pic-for-long-run-growth.png)

We construct a version of Tooze's graph later in this lecture.

(An impatient reader can jump ahead and look at figure {numref}`gdp1`.)
Expand Down Expand Up @@ -53,6 +56,8 @@ from collections import namedtuple
from matplotlib.lines import Line2D
```

+++ {"user_expressions": []}

## Setting up

A project initiated by [Angus Maddison](https://en.wikipedia.org/wiki/Angus_Maddison) has collected many historical time series related to economic growth,
Expand All @@ -69,6 +74,8 @@ data = pd.read_excel("datasets/mpd2020.xlsx", sheet_name='Full data')
data
```

+++ {"user_expressions": []}

We can see that this dataset contains GDP per capita (gdppc) and population (pop) for many countries and years.

Let's look at how many and which countries are available in this dataset
Expand All @@ -77,6 +84,7 @@ Let's look at how many and which countries are available in this dataset
len(data.country.unique())
```

+++ {"user_expressions": []}

We can now explore some of the 169 countries that are available.

Expand All @@ -92,6 +100,7 @@ cntry_years = pd.DataFrame(cntry_years, columns=['country', 'Min Year', 'Max Yea
cntry_years
```

+++ {"user_expressions": []}

Let's now reshape the original data into some convenient variables to enable quicker access to countries time series data.

Expand All @@ -101,6 +110,7 @@ We can build a useful mapping between country codes and country names in this da
code_to_name = data[['countrycode','country']].drop_duplicates().reset_index(drop=True).set_index(['countrycode'])
```

+++ {"user_expressions": []}

Then we can quickly focus on GDP per capita (gdp)

Expand All @@ -117,10 +127,13 @@ gdppc = gdppc.unstack('countrycode')
gdppc
```

+++ {"user_expressions": []}

We create a color mapping between country codes and colors for consistency

```{code-cell} ipython3
:tags: [hide-input]

country_names = data['countrycode']

# Generate a colormap with the number of colors matching the number of countries
Expand All @@ -130,6 +143,8 @@ colors = cm.Dark2(np.linspace(0, 0.8, len(country_names)))
color_mapping = {country: color for country, color in zip(country_names, colors)}
```

+++ {"user_expressions": []}

## GPD plots

Looking at the United Kingdom we can first confirm we are using the correct country code
Expand All @@ -152,6 +167,7 @@ _ = gdppc[cntry].plot(
color=color_mapping['GBR'])
```

+++ {"user_expressions": []}

:::{note}
[International Dollars](https://en.wikipedia.org/wiki/International_dollar) are a hypothetical unit of currency that has the same purchasing power parity that the U.S. Dollar has in the United States at any given time. They are also known as Geary–Khamis dollars (GK Dollars).
Expand Down Expand Up @@ -184,6 +200,7 @@ ax.set_xlabel('Year')
plt.show()
```

+++ {"user_expressions": []}

We can now put this into a function to generate plots for a list of countries

Expand Down Expand Up @@ -221,6 +238,7 @@ def draw_interp_plots(series, ylabel, xlabel, color_mapping, code_to_name, lw, l
return ax
```

+++ {"user_expressions": []}

As you can see from this chart, economic growth started in earnest in the 18th century and continued for the next two hundred years.

Expand Down Expand Up @@ -294,6 +312,7 @@ draw_events(events, ax)
plt.show()
```

+++ {"user_expressions": []}

The preceding graph of per capita GDP strikingly reveals how the spread of the industrial revolution has over time gradually lifted the living standards of substantial
groups of people
Expand Down Expand Up @@ -364,6 +383,8 @@ draw_events(events, ax)
plt.show()
```

+++ {"user_expressions": []}

We can also look at the United States (USA) and United Kingdom (GBR) in more detail

In the following graph, please watch for
Expand Down Expand Up @@ -423,6 +444,7 @@ draw_events(events, ax)
plt.show()
```

+++ {"user_expressions": []}

## The industrialized world

Expand All @@ -437,6 +459,8 @@ data['gdp'] = data['gdppc'] * data['pop']
gdp = data['gdp'].unstack('countrycode')
```

+++ {"user_expressions": []}

### Early industrialization (1820 to 1940)

We first visualize the trend of China, the Former Soviet Union, Japan, the UK and the US.
Expand All @@ -463,11 +487,11 @@ ax = draw_interp_plots(gdp[cntry].loc[start_year:end_year],
color_mapping, code_to_name, 2, False, ax)
```

+++ {"user_expressions": []}

### The modern era (1950 to 2020)

The following graph displays how quickly China has grown, especially since the late 1970s.

The following graph displays how quickly China has grown, especially since the late 1970s.

```{code-cell} ipython3
---
Expand All @@ -484,6 +508,9 @@ ax = draw_interp_plots(gdp[cntry].loc[start_year:end_year],
'International $\'s','Year',
color_mapping, code_to_name, 2, False, ax)
```

+++ {"user_expressions": []}

It is tempting to compare this graph with figure {numref}`gdp1` that showed the US overtaking the UK near the start of the "American Century", a version of the graph featured in chapter 1 of {cite}`Tooze_2014`.

## Regional analysis
Expand All @@ -497,19 +524,25 @@ data = pd.read_excel("datasets/mpd2020.xlsx", sheet_name='Regional data', header
data.columns = data.columns.droplevel(level=2)
```

+++ {"user_expressions": []}

We can save the raw data in a more convenient format to build a single table of regional GDP per capita

```{code-cell} ipython3
regionalgdppc = data['gdppc_2011'].copy()
regionalgdppc.index = pd.to_datetime(regionalgdppc.index, format='%Y')
```

+++ {"user_expressions": []}

Let's interpolate based on time to fill in any gaps in the dataset for the purpose of plotting

```{code-cell} ipython3
regionalgdppc.interpolate(method='time', inplace=True)
```

+++ {"user_expressions": []}

and record a dataset of world GDP per capita

```{code-cell} ipython3
Expand All @@ -523,7 +556,6 @@ mystnb:
caption: World GDP per capita
name: world_gdppc
---

fig = plt.figure(dpi=300)
ax = fig.gca()
ax = worldgdppc.plot(
Expand All @@ -533,6 +565,8 @@ ax = worldgdppc.plot(
)
```

+++ {"user_expressions": []}

Looking more closely, let's compare the time series for `Western Offshoots` and `Sub-Saharan Africa` and more broadly at a number of different regions around the world.

Again we see the divergence of the West from the rest of the world after the industrial revolution and the convergence of the world after the 1950s
Expand All @@ -544,7 +578,6 @@ mystnb:
caption: Regional GDP per capita
name: region_gdppc
---

fig = plt.figure(dpi=300)
ax = fig.gca()
line_styles = ['-', '--', ':', '-.', '.', 'o', '-', '--', '-']
Expand Down
Binary file added lectures/pic-for-long-run-growth.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading