%%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...
# make sure graphs are displayed in main notebook
%matplotlib inline
import numpy as np # make sure libraries are
import pandas as pd # in the namespace
import matplotlib as mpl
import matplotlib.pyplot as plt
from IPython.display import Image
plt.style.use('seaborn-whitegrid') # graphics setup
figure_size = plt.rcParams["figure.figsize"]
figure_size[0] = 10
figure_size[1] = 7
plt.rcParams["figure.figsize"] = figure_size
# basic Solow growth model run
import numpy as np
import pandas as pd
import matplotlib as mpl
import matplotlib.pyplot as plt
from IPython.display import Image
%matplotlib inline
alpha = 0.3
s = 0.1
delta = 0.03
g0 = 0.000
n0 = 0.000441
N = 450*5
gamma = 3
h0=0.0001
array = np.zeros((1001,13))
m_df = pd.DataFrame(array,
columns=["Year","Labor", "Capital",
"WEP", "YoverL", "Efficiency", "Pop_Gr",
"Eff_Gr", "Cap_Gr", "Cap_Out", "Human_Ideas", "Population", "Living"])
m_df.Year[0] = -8000
m_df.Labor[0] = 2.5
m_df.Human_Ideas[0] = 450
m_df.Efficiency[0] = ((N/m_df.Labor[0])**(1/(1-gamma)) *
(m_df.Human_Ideas[0])**(gamma/(1-gamma)))
m_df.Pop_Gr[0] = n0
m_df.Eff_Gr[0] = g0
m_df.Cap_Gr[0] = (s * m_df.WEP[0]/m_df.Capital[0]
- delta)
m_df.Cap_Out[0] = s/(n0+g0+delta)
m_df.WEP[0] = 3750
m_df.Capital[0] = m_df.Cap_Out[0] * m_df.WEP[0]
m_df.YoverL[0] = 750
m_df.Living[0] = m_df.WEP[0]/m_df.Labor[0]
for t in range(1, 1001):
m_df.Year[t] = m_df.Year[t-1] + 10
m_df.Labor[t] = m_df.Labor[t-1]*np.exp(n0*10)
m_df.Capital[t] = (m_df.Capital[t-1] *
np.exp(m_df.Cap_Gr[t-1]*10))
m_df.Efficiency[t] = m_df.Efficiency[t-1] * np.exp(g0*10)
m_df.WEP[t] = m_df.Capital[t]**alpha * (m_df.Efficiency[t] *
m_df.Labor[t])**(1 - alpha)
m_df.Living[t] = m_df.WEP[t]/m_df.Labor[t]
m_df.Pop_Gr[t] = n0
m_df.Eff_Gr[t] = g0
m_df.Cap_Gr[t] = s * m_df.WEP[t]/m_df.Capital[t] - delta
# print(m_df.Year[t], m_df.Labor[t], m_df.Capital[t], m_df.Efficiency[t])
m_df.Population = 2 * m_df.Labor
m_df = m_df.set_index("Year")
print(m_df.Labor[0])
m_df.Population.plot()
plt.ylabel("Population", fontsize=20) # set labels
plt.xlabel("Date", fontsize=20)
plt.suptitle("Calibrating to Population of 170 at Year Zero",
fontsize=28)
/anaconda3/lib/python3.6/site-packages/ipykernel_launcher.py:34: RuntimeWarning: invalid value encountered in double_scalars
85.13946970496411
Text(0.5,0.98,'Calibrating to Population of 170 at Year Zero')
print(m_df.Population[0], "= model population at Roman Empire founding")
print(m_df.Population[500], "= model population in 500 AD")
print(m_df.Population[1000], "= model population in 1000 AD")
print(m_df.Population[1500], "= model population in 1500 AD")
print(m_df.Population[1750], "= model population in 1750 AD")
print(m_df.Population[1900], "= model population in 1900 AD")
print(m_df.Population[2000], "= model population in 2000 AD")
170.27893940992823 = model population at Roman Empire founding 212.28674094686352 = model population in 500 AD 264.65786396137946 = model population in 1000 AD 329.9489390820331 = model population in 1500 AD 368.40685527050675 = model population in 1750 AD 393.6010813214685 = model population in 1900 AD 411.3473175210302 = model population in 2000 AD
# m_df.Living.plot()
print(m_df.Cap_Out[0], m_df.WEP[0], m_df.Capital[0])
0.0 nan nan
We have our production function, output as a function of the capital stock, the product of the labor force and the efficiency with which that labor can produce, and the single parameter $ \alpha $ describing how fast diminishing returns to capital set in as the capital-labor ratio increases:
$ Y = K^{\alpha}(EL)^{1-\alpha} $
$ ln(Y) = {\alpha}(ln(K)) + (1-\alpha)(EL) $
But what determines the efficiency of labor? Ideas, certainly—the level of technological knowledge in its society; its understanding and ability to implement productive organizations; plus the skills, education, and experience of the workforce. But Malthus's insight was that he needed to focus on the role of resources and, in particular, resource scarcity in limiting the efficiency with which labor can work. Ideas, you see, are non-rival: that one person or group has and is using an idea does not mean another person or group cannot productively use the same idea. The same is not true of natural resources. Natural resources are rival: crowd twice as many farmers on the same soil, and their productive efficiency is likely to drop.
Thus we write the efficiency of labor as a function of society's level of ideas—technology; organizational capability; plus experience, skills, and education—which we will call H, non-rival, and of society's level of resources R divided by the labor force L:
$ E = \left(\frac{R}{L}\right)^{\left(\frac{1}{1+\gamma}\right)}H^{\left(\frac{\gamma}{1+\gamma}\right)} $
$ ln(E) = {\left(\frac{1}{1+\gamma}\right)}ln\left(\frac{R}{L}\right) + {\left(\frac{\gamma}{1+\gamma}\right)}H $
With the parameter $ \gamma $ describing the ratio of the salience of ideas compared to natural resources in generating production efficiency. Why the ratio—and thus all of the $ {\gamma}/(1-\gamma) $ terms? Because it will lead to simpler formulas later on, so why not define our production function in terms of it at the start?
We thus gain an alternative formulation of the production function when we want to peel back resource scarcity as an influence lowering the efficiency of labor E:
$ Y = K^{\alpha}R^{\left(\frac{1-\alpha}{1+\gamma}\right)}(HL)^{\left(\frac{\gamma(1-\alpha)}{1+\gamma}\right)} $
$ ln(Y) = {\alpha}(ln(K)) + {\left(\frac{1-\alpha}{1+\gamma}\right)}ln(R) + {\left(\frac{\gamma(1-\alpha)}{1+\gamma}\right)}ln(HL) $
We also note that that in this setup there is an interaction between the rate of growth of the labor force n and the rate of growth of the efficiency of labor g. Taking the natural log and then the derivative, we get expressions for the growth rate g of the efficiency of labor E:
$ \frac{dln(E)}{dt} = \left(\frac{1}{1+\gamma}\right) \left(\frac{dln(R)}{dt} - \frac{dln(L)}{dt} \right) + \left(\frac{\gamma}{1+\gamma}\right) \left(\frac{dln(H)}{dt}\right) $
If natural resources are constant, this becomes:
$ \frac{dln(E)}{dt} = \left(\frac{\gamma}{1+\gamma}\right) \left(\frac{dln(H)}{dt}\right) - \left(\frac{1}{1+\gamma}\right) \left(\frac{dln(L)}{dt} \right) $
$ g = \left(\frac{\gamma}{1+\gamma}\right)h - \left(\frac{1}{1+\gamma}\right)n $
with "h" being the proportional rate of growth of the ideas—engineering technology; business and market organization; plus workers' skills, experience, and education—and g and n being, as before, the proportional rates of growth of labor efficiency and the labor force, respectively.
Faster population growth thus exerts a drag on the growth of the efficiency of labor...
We can have stagnant living standards if improvements in ideas or just offset by the effects of diminish natural resources per capita. But how likely is it that that just happens?
$ Y = K^{\alpha}Y = K^{\alpha}(EL)^{1-\alpha} $
$ \frac{Y}{L} = \left(\frac{K}{Y}\right)^\left(\frac{\alpha}{1-\alpha}\right) E $
$ E = \left(\frac{N}{L}\right)^{\left(\frac{1}{1+\gamma}\right)}H^{\left(\frac{\gamma}{1+\gamma}\right)} $
$ \frac{Y}{L} = \left(\frac{K}{Y}\right) ^\left(\frac{\alpha}{1-\alpha}\right) \left(\frac{N}{L}\right)^{\left(\frac{1}{1+\gamma}\right)}H^{\left(\frac{\gamma}{1+\gamma}\right)} $
And if the natural resource stock in the economy is constant,
we might as well choose units that set it equal to 1:
$ \left(\frac{Y}{L}\right) = \left(\frac{K}{Y}\right)^{\left(\frac{\alpha}{1-\alpha}\right)} H^{\left(\frac{\gamma}{1 + \gamma}\right)} L^{\left(-\frac{1}{1 + \gamma}\right)} $
$ \frac{K}{Y} $ was our equilibrating variable and:
$ \left(\frac{K}{Y}\right)^* = \frac{s}{n+g+\delta} $
was our equilibrium condition. Now we want y to be a second equilibrating variable and:
$ y = \bar{y_n} $ to be a second equilibrium condition.
$ ln{\left(\frac{Y}{L}\right)} ={\left(\frac{\alpha}{1-\alpha}\right)} ln{\left(\frac{K}{Y}\right)} + ln(E) $
$ ln{\left(\frac{Y}{L}\right)} = {\left(\frac{\alpha}{1-\alpha}\right)} ln{\left(\frac{s}{n+g+\delta}\right)} + ln(E) $
$ ln{\left(\frac{Y}{L}\right)} = {\left(\frac{\alpha}{1-\alpha}\right)} ln{\left(\frac{s}{n+g+\delta}\right)} + {\left(\frac{\gamma}{1+\gamma}\right)}ln(H) - {\left(\frac{1}{1+\gamma}\right)}ln(L) $
$ ln{\left(\bar{y_n}\right)} = {\left(\frac{\alpha}{1-\alpha}\right)} ln{\left(\frac{s}{n+g+\delta}\right)} + {\left(\frac{\gamma}{1+\gamma}\right)}ln(H) - {\left(\frac{1}{1+\gamma}\right)}ln(L) $
$0 = {\left(\frac{\gamma}{1+\gamma}\right)}\frac{d(ln(H))}{dt} - {\left(\frac{1}{1+\gamma}\right)}\frac{d(ln(L))}{dt} $
$0 = \gamma\frac{d(ln(H))}{dt} - \frac{d(ln(L))}{dt} $
$ \frac{dln(L)}{dt} = {\gamma}\frac{dln(H)}{dt} $
$ n = {\gamma}h $
We would not expect to see growth in ideas to show up as increases in output per worker levels if population growth is fast enough to keep increases in the economy's idea stock from showing up in increases in the efficiency of labor.
That rate of population growth is simply equal to $ \gamma $ times the proportional rate of increase in the idea stock.
Suppose we look for a steady-state equilibrium in which the population and labor-force growth rate n depends on the level of output per worker y, and in which output per worker is at that level that supports, on average, that labor-force growth rate n? Then:
$ \frac{Y}{L} = \bar{y_n} $ and $ \frac{K}{Y} = \frac{s}{n+g+\delta} $ and $ \frac{d(ln(L))}{dt} = n $
then:
$ ln{\left(\frac{Y}{L}\right)} ={\left(\frac{\alpha}{1-\alpha}\right)} ln{\left(\frac{K}{Y}\right)} + ln(E) $
$ ln{\left(\frac{Y}{L}\right)} = {\left(\frac{\alpha}{1-\alpha}\right)} ln{\left(\frac{s}{n+g+\delta}\right)} + ln(E) $
$ ln{\left(\frac{Y}{L}\right)} = {\left(\frac{\alpha}{1-\alpha}\right)} ln{\left(\frac{s}{n+g+\delta}\right)} + {\left(\frac{\gamma}{1+\gamma}\right)}ln(H) - {\left(\frac{1}{1+\gamma}\right)}ln(L) $
$ ln{\left(\bar{y_n}\right)} = {\left(\frac{\alpha}{1-\alpha}\right)} ln{\left(\frac{s}{n+g+\delta}\right)} + {\left(\frac{\gamma}{1+\gamma}\right)}ln(H) - {\left(\frac{1}{1+\gamma}\right)}ln(L) $
$0 = {\left(\frac{\gamma}{1+\gamma}\right)}\frac{d(ln(H))}{dt} - {\left(\frac{1}{1+\gamma}\right)}\frac{d(ln(L))}{dt} $
$0 = \gamma\frac{d(ln(H))}{dt} - \frac{d(ln(L))}{dt} $
$ \frac{dln(L)}{dt} = {\gamma}\frac{dln(H)}{dt} $
$ n = {\gamma}h $
We would not expect to see growth in ideas to show up as increases in output per worker levels if population growth is fast enough to keep increases in the economy's idea stock from showing up in increases in the efficiency of labor.
That rate of population growth is simply equal to $ \gamma $ times the proportional rate of increase in the idea stock.
$\frac{\beta}{1-\beta} = \gamma $
$ \beta = \gamma - \gamma\beta $
$ \beta + \gamma\beta = \gamma $
$ \beta(1 + \gamma) = \gamma $
$ \beta = \frac{\gamma}{1 + \gamma} $
import numpy as np
import pandas as pd
import matplotlib as mpl
import matplotlib.pyplot as plt
from IPython.display import Image
%matplotlib inline
alpha = 0.3
beta = 0.8
s = 0.1
delta = 0.03
LShare = beta - alpha
subsistence = 750
g0 = 0.000177 # efficiency of labor growth at 0.0177% per year
n0 = 0.000441 # population and labor force growth at 0.0441%/year
array = np.zeros((1001,9))
m_df = pd.DataFrame(array,
columns=["Year","Population", "Capital", "WEP", "Living", "Efficiency", "Pop_Gr", "Eff_Gr", "Cap_Gr"])
m_df.Year[0] = -8000
m_df.Population[0] = 5
m_df.Living[0] = 750
m_df.WEP[0] = 3750
m_df.Capital[0] = (s/delta) * m_df.WEP[0]
m_df.Efficiency[0] = (m_df.WEP[0]**(1/(beta-alpha)) *
m_df.Population[0]**(-1) * m_df.Capital[0]**((-alpha)/(beta-alpha)))
m_df.Pop_Gr[0] = n0
m_df.Eff_Gr[0] = g0
m_df.Cap_Gr[0] = s * m_df.WEP[0]/m_df.Capital[0] - delta
g1 = np.log(m_df.WEP[0]/np.exp(1))
for t in range(1, 1001):
m_df.Year[t] = m_df.Year[t-1] + 10
m_df.Population[t] = m_df.Population[t-1]*np.exp(m_df.Pop_Gr[t-1]*10)
m_df.Capital[t] = m_df.Capital[t-1] * np.exp(m_df.Cap_Gr[t-1]*10)
m_df.Efficiency[t] = m_df.Efficiency[t-1] * np.exp(m_df.Eff_Gr[t-1]*10)
m_df.WEP[t] = m_df.Capital[t]**alpha * (m_df.Efficiency[t] *
m_df.Population[t])**(beta - alpha)
m_df.Living[t] = m_df.WEP[t]/m_df.Population[t]
m_df.Pop_Gr[t] = pi * np.log(m_df.Living[t]/subsistence) + n0
m_df.Eff_Gr[t] = lambda_ * (np.log(m_df.WEP[t]) - g1) + g0
m_df.Cap_Gr[t] = s * m_df.WEP[t]/m_df.Capital[t] - delta
m_df = m_df.set_index("Year")
print(m_df.Population[0])
m_df.Population.plot()
plt.ylabel("Population", fontsize=20) # set labels
plt.xlabel("Date", fontsize=20)
plt.suptitle("Calibrating to Population of 170 at Year Zero", fontsize=28)
--------------------------------------------------------------------------- NameError Traceback (most recent call last) <ipython-input-7-04e459dd27ce> in <module>() 44 m_df.Population[t])**(beta - alpha) 45 m_df.Living[t] = m_df.WEP[t]/m_df.Population[t] ---> 46 m_df.Pop_Gr[t] = pi * np.log(m_df.Living[t]/subsistence) + n0 47 m_df.Eff_Gr[t] = lambda_ * (np.log(m_df.WEP[t]) - g1) + g0 48 m_df.Cap_Gr[t] = s * m_df.WEP[t]/m_df.Capital[t] - delta NameError: name 'pi' is not defined
m_df.Living.plot()
plt.ylabel("Living Standards", fontsize=20) # set labels
plt.xlabel("Date", fontsize=20)
plt.suptitle("Calibrating to Population of 170 at Year Zero", fontsize=28)
import numpy as np
import pandas as pd
import matplotlib as mpl
import matplotlib.pyplot as plt
from IPython.display import Image
%matplotlib inline
alpha = 0.3
beta = 0.8
s = 0.1
delta = 0.03
LShare = beta - alpha
pi = .01 # an e-fold increase in real income per capita to 2038 dollars/year
# raises population growth from 0 to 1% per year
subsistence = 750
lambda_ = 0.000085 # initial efficiency of labor growth at 0.0085% per year; each e-fold
# increase in world gdp raises efficiency of labor growth by an
# additional 0.0085% per year
n0 = 0.000
g0 = 0.000
array = np.zeros((1001,9))
m_df = pd.DataFrame(array,
columns=["Year","Population", "Capital", "WEP", "Living", "Efficiency", "Pop_Gr", "Eff_Gr", "Cap_Gr"])
m_df.Year[0] = -8000
m_df.Population[0] = 5
m_df.Living[0] = 750
m_df.WEP[0] = 3750
m_df.Capital[0] = (s/delta) * m_df.WEP[0]
m_df.Efficiency[0] = (m_df.WEP[0]**(1/(beta-alpha)) *
m_df.Population[0]**(-1) * m_df.Capital[0]**((-alpha)/(beta-alpha)))
m_df.Pop_Gr[0] = n0
m_df.Eff_Gr[0] = g0
m_df.Cap_Gr[0] = s * m_df.WEP[0]/m_df.Capital[0] - delta
g1 = np.log(m_df.WEP[0]/np.exp(1))
for t in range(1, 1001):
m_df.Year[t] = m_df.Year[t-1] + 10
m_df.Population[t] = m_df.Population[t-1]*(1 + m_df.Pop_Gr[t-1])**10
m_df.Capital[t] = m_df.Capital[t-1] * (1 + m_df.Cap_Gr[t-1])**10
m_df.Efficiency[t] = m_df.Efficiency[t-1] * (1 + m_df.Eff_Gr[t-1])**10
m_df.WEP[t] = m_df.Capital[t]**alpha * (m_df.Efficiency[t] *
m_df.Population[t])**(beta - alpha)
m_df.Living[t] = m_df.WEP[t]/m_df.Population[t]
m_df.Pop_Gr[t] = pi * np.log(m_df.Living[t]/subsistence) + n0
m_df.Eff_Gr[t] = lambda_ * (np.log(m_df.WEP[t]) - g1) + g0
m_df.Cap_Gr[t] = s * m_df.WEP[t]/m_df.Capital[t] - delta
m_df = m_df.set_index("Year")
print(m_df.Population[0])
print(m_df.Pop_Gr[0])
print(m_df.Eff_Gr[0])
print(m_df.Efficiency[0])
print(" ")
print(m_df.Population[2000])
print(m_df.Pop_Gr[2000])
print(m_df.Eff_Gr[2000])
print(m_df.Efficiency[2000])
m_df.plot() # and graph
plt.ylabel("Value", fontsize=20) # set labels
plt.xlabel("Time", fontsize=20)
plt.suptitle("Malthus", fontsize=28)
m_df.Population.plot()
plt.ylabel("Population", fontsize=20) # set labels
plt.xlabel("Date", fontsize=20)
plt.suptitle("Malthus: Population", fontsize=28)
m_df.Living.plot()
plt.ylabel("Living Standards", fontsize=20) # set labels
plt.xlabel("Date", fontsize=20)
plt.suptitle("Malthus: Living Standards", fontsize=28)