%%javascript
IPython.OutputArea.prototype._should_scroll = function(lines) {
return false;}
# keep output cells from shifting to autoscroll: little scrolling
# subwindows within the notebook are an annoyance...
# set up the environment by reading in every library we might need:
# os... graphics... data manipulation... time... math... statistics...
import sys
import os
from urllib.request import urlretrieve
import matplotlib as mpl
import matplotlib.pyplot as plt
from IPython.display import Image
import pandas as pd
from pandas import DataFrame, Series
from datetime import datetime
import scipy as sp
import numpy as np
import math
import random
import seaborn as sns
import statsmodels
import statsmodels.api as sm
import statsmodels.formula.api as smf
# report library versions...
/Users/delong/anaconda3/lib/python3.6/site-packages/statsmodels/compat/pandas.py:56: FutureWarning: The pandas.core.datetools module is deprecated and will be removed in a future version. Please use the pandas.tseries module instead. from pandas.core import datetools
%matplotlib inline
# put graphs into the notebook itself...
# graphics setup: seaborn-whitegrid and figure size...
plt.style.use('seaborn-whitegrid')
figure_size = plt.rcParams["figure.figsize"]
figure_size[0] = 12
figure_size[1] = 10
plt.rcParams["figure.figsize"] = figure_size
# Calculations for: Long-Run Measured Economic Growth:
# Sweden and Argentina, 1890-2017
# data previously downloaded
# time series for measured real national product per capita for
# Sweden and Argentina since 1890, plus source notes, accessible
# in the argentina_sweden_dict object for later use, if needed...
sourceURL = "http://delong.typepad.com/2017-08-11-argentina-and-sweden-gdp-per-capita-1890-2015-from-gapminder.org.csv"
argentina_sweden_df = pd.read_csv(sourceURL, index_col = 0)
argentina_sweden_dict = {}
argentina_sweden_dict["df"] = argentina_sweden_df
argentina_sweden_dict["sourceURL"] = sourceURL
argentina_sweden_dict["sourceDescription"] = "Hans Rosling's Gapminder: http://gapminder.org"
argentina_sweden_dict["sourceNotes"] = "From Gapminder World data page: http://www.gapminder.org/data/"
argentina_sweden_dict["df"].plot()
plt.ylim(0, )
plt.xlabel("Year", size = 15)
plt.ylabel("Real GDP per Capita", size = 15)
plt.title("Swedish and Argentinian Economic Growth since 1890", size = 30)
## Calculate the difference in growth multiples between Sweden and
## Argentina since 1890
# Sweden's measured growth multiple over 1890-2015:
Sweden_multiple18902015 = argentina_sweden_df.Sweden[2015]/argentina_sweden_df.Sweden[1890]
# Argentina's measured growth multiple over 1890-2015:
Argentina_multiple18902015 = argentina_sweden_df.Argentina[2015]/argentina_sweden_df.Argentina[1890]
print("Sweden's growth multiple over 1890-2015:", Sweden_multiple18902015)
print("Argentinas growth multiple over 1890-2015:", Argentina_multiple18902015)
Sweden's growth multiple over 1890-2015: 16.4138939671 Argentinas growth multiple over 1890-2015: 3.31752104055
On the World Wide Web at: http://gapminder.org is Gapminder. It is, its mission statement says:
an independent Swedish foundation... a fact tank, not a think tank.... fight[ing] devastating misconceptions about global development. Gapminder produces free teaching resources making the world understandable based on reliable statistics. Gapminder promotes a fact-based worldview everyone can understand...
and Gapminder exists because:
We humans are born with a craving for... drama. We pay attention to dramatic stories and we get bored if nothing happens. Journalists and lobbyists tell dramatic stories... about extraordinary events and unusual people. The piles of dramatic stories pile up in people’s minds into an overdramatic worldview and strong negative stress feelings: “The world is getting worse!”, “It’s we vs. them!” , “Other people are strange!”, “The population just keeps growing!” and “Nobody cares!” For the first time in human history reliable statistics exist. There’s data for almost every aspect of global development. The data shows a very different picture: a world where most things improve.... [where] decisions [are] based on universal human needs... easy to understand....
Fast population growth will soon be over. The total number of children in the world has stopped growing.... We live in a globalized world, not only in terms of trade and migration. More people than ever care about global development! The world has never been less bad. Which doesn’t mean it’s perfect. The world is far from perfect.
The dramatic worldview has to be dismantled, because it is stressful... wrong.... leads to bad focus and bad decisions. We know this because we have measured the global ignorance... [of] top decision makers... journalists, activists, teachers and the general public. This has nothing to do with intelligence. It’s a problem of factual knowledge. Facts don’t come naturally. Drama and opinions do. Factual knowledge has to be learned. We need to teach global facts in schools and in corporate training. This is an exciting problem to work on and we invite all our users to join the Gapminder movement for global factfulness. The problem can be solved, because the data exists...
Do not be globally ignorant! Explore—and use—Gapminder! And watch Ola and Hans Rosling's "How Not to Be Ignorant about the World" talk at: https://www.youtube.com/watch?v=Sm5xF-UYgdg
Task 1: Using information sources:
PASTE IMG TAG HERE: ___
WHAT DID YOU LEARN? ANSWER: ___
Task 2: Reversals of Fortune:
This problem requires you to edit the second Python code cell below. The first cell downloads data and plots Argentinean and Swedish levels of GDP per capita since 1890. Run this first cell. There is no need to change it. Then...
# time series for measured real national product per capita for
# Sweden and Argentina since 1890, plus source notes, accessible
# in the argentina_sweden_dict object for later use, if needed...
import matplotlib as mpl
import matplotlib.pyplot as plt
from IPython.display import Image
import pandas as pd
sourceURL = "http://delong.typepad.com/2017-08-11-argentina-and-sweden-gdp-per-capita-1890-2015-from-gapminder.org.csv"
argentina_sweden_df = pd.read_csv(sourceURL, index_col = 0)
argentina_sweden_dict = {}
argentina_sweden_dict["df"] = argentina_sweden_df
argentina_sweden_dict["sourceURL"] = sourceURL
argentina_sweden_dict["sourceDescription"] = "Hans Rosling's Gapminder: http://gapminder.org"
argentina_sweden_dict["sourceNotes"] = "From Gapminder World data page: http://www.gapminder.org/data/"
argentina_sweden_dict["df"].plot()
plt.ylim(0, )
plt.xlabel("Year", size = 15)
plt.ylabel("Real GDP per Capita", size = 15)
plt.title("Swedish and Argentinian Economic Growth since 1890", size = 30)
Then...
2.1: Calculate the year that Sweden surpasses Argentina in GDP per capita. Write code to set the variable Sweden_surpasses equal to that year in the code cell below:
Sweden_surpasses = 1931
2.2: Calculate the growth rates of Swedish and Argentinean GDP per capita, and their difference, over the periods 1890-1914, 1914-1946, 1946-1980, and 1980-2002. Write code to set the appropriate variables equal to the values in the code cell below:
Swedish_Growth18901914 = ___
Swedish_Growth19141946 = ___
Swedish_Growth19461980 = ___
Swedish_Growth19802002 = ___
Argentinean_Growth18901914 = ___
Argentinean_Growth19141946 = ___
Argentinean_Growth19461980 = ___
Argentinean_Growth19802002 = ___
Difference_Growth18901914 = ___
Difference_Growth19141946 = ___
Difference_Growth19461980 = ___
Difference_Growth19802002 = ___
2.3: Calculate the multiple that Swedish GDP per capita in 2015 is of its level in 1890, the multiple that Argentinean GDP per capita in 2015 is of its level in 1890, and the multiple that the quotient is. Write code to set the appropriate variables equal to the values in the code cell below:
Sweden_multiple18902015 = ___
Argentina_multiple18902015 = ___
Quotient_multiple18902015 = ___
Calculations and Exercises for: Long-Run Economic Groswth Theory—Sources: https://www.icloud.com/keynote/00biHFkmiRWGjrKVCfFCroVNA
Lecture Support: <>
Alternative functional forms:
$ \frac{Y}{L} = \left(\frac{K}{L}\right)^α(E)^{(1-α)} $
$ \ln\left(\frac{Y}{L}\right) = α\ln\left(\frac{K}{L}\right) + (1-α)\ln(E) $
$ \frac{Y}{L} = \left(\frac{K}{Y}\right)^\left(\frac{α}{1-α}\right)(E) $
$ \ln\left(\frac{Y}{L}\right) = \left(\frac{α}{1-α}\right)\ln\left(\frac{K}{L}\right) + \ln(E) $
$ \frac{d\left(\ln\left(\frac{Y}{L}\right)\right)}{dt} = α \frac{d\left(\ln\left(\frac{K}{L}\right)\right)}{dt} + (1-α)\frac{d\left(\ln\left(E\right)\right)}{dt} $
$ \frac{d\left(\ln\left(\frac{Y}{L}\right)\right)}{dt} = α \frac{d\left(\ln\left(K\right)\right)}{dt} - α \frac{d\left(\ln\left(L\right)\right)}{dt} + (1-α)\frac{d\left(\ln\left(E\right)\right)}{dt} $
$ \frac{d\left(\ln\left(\frac{Y}{L}\right)\right)}{dt} = \left(\frac{α}{1-α}\right) \frac{d\left(\ln\left(\frac{K}{Y}\right)\right)}{dt} + \frac{d\left(\ln\left(E\right)\right)}{dt} $
We will use whatever is most convenient for the task at hand at the moment...
$ \frac{dK}{dt} = sY - {\delta}K $ :: capital accumulation
$ \frac{dL}{dt} = nL $ :: labor force growth
$ \frac{dE}{dt} = gE $ :: efficiency-of-labor growth
$ \frac{d}{dt}{\ln}(K) = s\left(\frac{Y}{K}\right) - {\delta} $ :: capital accumulation
$ \frac{d}{dt}{\ln}(L) = n $ :: labor force growth
$ \frac{d}{dt}{\ln}(E) = g $ :: efficiency-of-labor growth
Sources of Long-Term Growth: https://www.icloud.com/keynote/00biHFkmiRWGjrKVCfFCroVNA
Lecture Support: https://github.com/braddelong/LSF18E101B/blob/master/Calculations_and_Exercises_for_Long-Run_Economic_Growth_Theory-Sources.ipynb