# Numerical Methods for Economists: Lab Assignment The Solow (1956) Model¶

In this lab assignment you will analyze a version of the Solow model with a constant elasticity of substituion (CES) production function and attempt to "explain" observed patterns in capital's share in the U.S. between 1950-2011.

A CES production function looks as follows...

$$Y(t) = \bigg[\alpha K(t)^{\rho} + (1-\alpha) (A(t)L(t))^{\rho}\bigg]^{\frac{1}{\rho}} \tag{1.2}$$

where $0 < \alpha < 1$ and $-\infty < \rho < 1$. The parameter $\rho = \frac{\sigma - 1}{\sigma}$ where $\sigma$ is the elasticity of substitution between factors of production. The CES production technology is popular because it nests several interesing special cases. In particular, if factors of production are perfect substitutes (i.e., $\sigma = +\infty \implies \rho = 1$), then output is just a linear combination of the inputs.

$$\lim_{\rho \rightarrow 1} Y(t) = \alpha K(t) + (1-\alpha)A(t)L(t) \tag{1.3}$$

On the other hand, if factors of production are perfect complements (i.e., $\sigma = 0 \implies \rho = -\infty$), then we recover the Leontief production function.

$$\lim_{\rho \rightarrow -\infty} Y(t) = \min\left\{\alpha K(t), (1-\alpha) A(t)L(t)\right\} \tag{1.4}$$

Finally, if the elasticity of substitution is unitary (i.e., $\sigma=1 \implies \rho=0$), then output is Cobb-Douglas.

$$\lim_{\rho \rightarrow 0} Y(t) = K(t)^{\alpha}(A(t)L(t))^{1-\alpha} \tag{1.5}$$
In [7]:
%load_ext autoreload

In [8]:
%autoreload 2

In [9]:
import numpy as np
import pandas as pd
from scipy import integrate, linalg, optimize
import matplotlib as mpl
import matplotlib.pyplot as plt

# for the first few labs we will be working with models of growth
import growth
import pwt


### (5 points) Part a)¶

Show that the CES production function as defined by equation 1.2 exhibits constant returns to scale.

Constant returns to scale requires that multiplying both factors of production by some fixed constant $c > 0$, causes output to change by the same factor.

\begin{align} F(cK, cAL) =& \bigg[\alpha (cK(t))^{\rho} + (1-\alpha) (cA(t)L(t))^{\rho}\bigg]^{\frac{1}{\rho}} \\ =& \bigg[\alpha c^{\rho}K(t)^{\rho} + (1-\alpha) c^{\rho}(A(t)L(t))^{\rho}\bigg]^{\frac{1}{\rho}} \\ =& \bigg[c^{\rho}\bigg(\alpha K(t)^{\rho} + (1-\alpha) (A(t)L(t))^{\rho}\bigg)\bigg]^{\frac{1}{\rho}} \\ =& c\bigg[\alpha K(t)^{\rho} + (1-\alpha) (A(t)L(t))^{\rho}\bigg]^{\frac{1}{\rho}} \\ =& cF(K, AL) \end{align}

### (10 points) Part b)¶

Derive the intensive forms for both the general CES production function as defined by equation 1.2 and for its Cobb-Douglas special case defined by equation 1.5. Show that both of these intensive production functions are concave.

The intensive form of the general CES production function is...

\begin{align} y(t) = \frac{Y(t)}{A(t)L(t)} =& \frac{1}{A(t)L(t)}\bigg[\alpha K(t)^{\rho} + (1-\alpha) (A(t)L(t))^{\rho}\bigg]^{\frac{1}{\rho}} \\ =& \bigg[\frac{\alpha K(t)^{\rho} + (1-\alpha) (A(t)L(t))^{\rho}}{(A(t)L(t))^{\rho}}\bigg]^{\frac{1}{\rho}} \\ =& \bigg[\alpha \frac{K(t)^{\rho}}{(A(t)L(t))^{\rho}} + (1-\alpha) \frac{(A(t)L(t))^{\rho}}{(A(t)L(t))^{\rho}}\bigg]^{\frac{1}{\rho}} \\ =& \bigg[\alpha \bigg(\frac{K(t)}{A(t)L(t)}\bigg)^{\rho} + (1-\alpha)\bigg]^{\frac{1}{\rho}} \\ =& \bigg[\alpha k(t)^{\rho} + (1-\alpha)\bigg]^{\frac{1}{\rho}} \end{align}

The intensive form of the Codd-Douglas special case is...

\begin{align} y(t) = \frac{Y(t)}{A(t)L(t)} =& \frac{1}{A(t)L(t)}K(t)^{\alpha}(A(t)L(t))^{1-\alpha} \\ =& K(t)^{\alpha}(A(t)L(t))^{-\alpha} \\ =& \bigg(\frac{K(t)}{A(t)L(t)}\bigg)^{\alpha} \\ = & k(t)^{\alpha} \end{align}

Concavity requires that $f'(k) > 0$ and $f''(k) < 0$. For the intensive form of the general CES production function these derivatives are messy!

\begin{align} f'(k) = \frac{\partial y(t)}{\partial k(t)} =& \alpha k(t)^{\rho-1}\bigg[\alpha k(t)^{\rho} + (1-\alpha)\bigg]^{\frac{1}{\rho} - 1} > 0 \\ f''(k) = \frac{\partial^2 y(t)}{\partial k(t)^2} =& \alpha k(t)^{\rho-1} \frac{\partial}{\partial k}\bigg(\bigg[\alpha k(t)^{\rho} + (1-\alpha)\bigg]^{\frac{1}{\rho} - 1}\bigg) + \frac{\partial}{\partial k}\bigg(\alpha k(t)^{\rho-1}\bigg)\bigg[\alpha k(t)^{\rho} + (1-\alpha)\bigg]^{\frac{1}{\rho} - 1} \\ =& \alpha k(t)^{\rho-1} \frac{\partial}{\partial k}\bigg(\bigg[\alpha k(t)^{\rho} + (1-\alpha)\bigg]^{\frac{1}{\rho} - 1}\bigg) + \bigg(\alpha(\rho - 1)k(t)^{\rho-2}\bigg)\bigg[\alpha k(t)^{\rho} + (1-\alpha)\bigg]^{\frac{1}{\rho} - 1} \\ =& \alpha k(t)^{\rho-1}\bigg(\bigg(\alpha \rho k(t)^{\rho-1}\bigg)\bigg(\frac{1}{\rho} - 1\bigg)\bigg[\alpha k(t)^{\rho} + (1-\alpha)\bigg]^{\frac{1}{\rho} - 2}\bigg) + \bigg(\alpha(\rho - 1)k(t)^{\rho-2}\bigg)\bigg[\alpha k(t)^{\rho} + (1-\alpha)\bigg]^{\frac{1}{\rho} - 1} \\ =& \alpha k(t)^{\rho-1}\bigg(\bigg(\alpha k(t)^{\rho-1}\bigg)\bigg(1 - \rho\bigg)\bigg[\alpha k(t)^{\rho} + (1-\alpha)\bigg]^{\frac{1}{\rho} - 2}\bigg) + \bigg(\alpha(\rho - 1)k(t)^{\rho-2}\bigg)\bigg[\alpha k(t)^{\rho} + (1-\alpha)\bigg]^{\frac{1}{\rho} - 1} \\ =& \bigg(\bigg(\alpha k(t)^{\rho-1}\bigg)^2\bigg(1 - \rho\bigg)\bigg[\alpha k(t)^{\rho} + (1-\alpha)\bigg]^{\frac{1}{\rho} - 2}\bigg) - \bigg(\alpha(1 -\rho)k(t)^{\rho-2}\bigg)\bigg[\alpha k(t)^{\rho} + (1-\alpha)\bigg]^{\frac{1}{\rho} - 1} \\ =& (1 -\rho)\bigg[\alpha k(t)^{\rho} + (1-\alpha)\bigg]^{\frac{1}{\rho} - 2}\bigg(\bigg(\alpha k(t)^{\rho-1}\bigg)^2 - \bigg(\alpha k(t)^{\rho-2}\bigg)\bigg[\alpha k(t)^{\rho} + (1-\alpha)\bigg]\bigg) \\ =& (1 -\rho)\bigg[\alpha k(t)^{\rho} + (1-\alpha)\bigg]^{\frac{1}{\rho} - 2}\bigg(\alpha^2 k(t)^{2\rho-2} - \alpha^2 k(t)^{2\rho-2} - (1-\alpha)\bigg(\alpha k(t)^{\rho-2}\bigg)\bigg) \\ =& -(1 -\rho)(1-\alpha)\bigg(\alpha k(t)^{\rho-2}\bigg)\bigg[\alpha k(t)^{\rho} + (1-\alpha)\bigg]^{\frac{1}{\rho} - 2} < 0\\ \end{align}

For the Cobb-Douglas special case, the derivatives are much nicer.

\begin{align} f'(k) =& \alpha k(t)^{\alpha-1} > 0 \\ f''(k) =& -\alpha (1 - \alpha) k(t)^{\alpha-2} < 0 \\ \end{align}

### (5 points) Part c)¶

Using your results from part b, complete the Python function below which defines output (per person/effective person) in terms of capital (per person/effective person) and model parameters.

In [ ]:
# you were given the following incomplete code...
def ces_output(t, k, params):
"""
Intensive form for a CES production
function.

Arguments:

t:      (array-like) Time.
k:      (array-like) Capital (per person/effective person).
params: (dict) Dictionary of parameter values.

Returns:

y: (array-like) Output (per person/ effective person)

"""
# extract params
alpha = params['alpha']
sigma = params['sigma']
rho   = # INSERT CODE HERE DEFINING RHO IN TERMS OF SIGMA!

# nest Cobb-Douglas technology as special case
if rho == 0:
y = # INSERT CODE HERE!
else:
y = # INSERT CODE HERE!

return y

In [1]:
# which should be completed as follows...
def ces_output(t, k, params):
"""
Intensive form for a CES production function.

Arguments:

t:      (array-like) Time.
k:      (array-like) Capital (per person/effective person).
params: (dict) Dictionary of parameter values.

Returns:

y: (array-like) Output (per person/ effective person)

"""
# extract params
alpha = params['alpha']
sigma = params['sigma']
rho   = (sigma - 1) / sigma

# nest Cobb-Douglas technology as special case
if rho == 0:
y = k**alpha
else:
y = (alpha * k**rho + (1-alpha))**(1 / rho)

return y


### (5 points) Part d)¶

Using your results from part b, complete the Python function below which defines the marginal product of capital (per person/effective person) in terms of capital (per person/effective person) and model parameters.

In [ ]:
# you were given the following incomplete code...
def marginal_product_capital(t, k, params):
"""
Marginal product of capital with CES production function.

Arguments:

t:      (array-like) Time.
k:      (array-like) Capital (per person/effective person).
params: (dict) Dictionary of parameter values.

Returns:

mpk: (array-like) Derivative of output with respect to capital, k.

"""
# extract params
alpha = params['alpha']
sigma = params['sigma']
rho   = # INSERT CODE HERE DEFINING RHO IN TERMS OF SIGMA!

# nest Cobb-Douglas technology as special case
if rho == 0:
mpk = # INSERT CODE HERE!
else:
mpk = # INSERT CODE HERE!

return mpk

In [2]:
# which should be completed as follows...
def marginal_product_capital(t, k, params):
"""
Marginal product of capital with CES production function.

Arguments:

t:      (array-like) Time.
k:      (array-like) Capital (per person/effective person).
params: (dict) Dictionary of parameter values.

Returns:

mpk: (array-like) Derivative of output with respect to capital, k.

"""
# extract params
alpha = params['alpha']
sigma = params['sigma']
rho   = (sigma - 1) / sigma

# nest Cobb-Douglas technology as special case
if rho == 0:
mpk = alpha * k**(alpha - 1)
else:
mpk = alpha * k**(rho - 1) * (alpha * k**rho + (1 - alpha))**((1 / rho) - 1)

return mpk


### (5 points) Part e)¶

Derive the equation of motion for capital per effective worker when the general CES production function defined by equation 1.2 and for the Cobb-Douglas special case defined by equation 1.5.

The key equation of the Solow model is the equation of motion for capital per effective worker, $k(t)=\frac{K(t)}{A(t)L(t)}$. Application of the chain rule to $k(t)$ yields

\begin{align} \dot{k}(t) =& \frac{\dot{K}A(t)L(t) - K(t)\left[A(t)\dot{L}(t) + \dot{A}(t)L(t)\right]}{[A(t)L(t)]^2} \notag \\ =& \frac{\dot{K}}{A(t)L(t)} - \frac{K(t)}{A(t)L(t)}\left(\frac{\dot{L}(t)}{L(t)} + \frac{\dot{A}(t)}{A(t)}\right). \end{align}

From here I need only substitute the equation of motion for capital and the expressions for the exogenous growth rates of labor and technology to obtain a first-order non-linear differential equation describing the evolution of capital per effective worker, $k(t)$.

\begin{align} \dot{k}(t) =& \frac{sY(t) - \delta K(t)}{A(t)L(t)} - \frac{K(t)}{A(t)L(t)}\left(\frac{\dot{L}(t)}{L(t)} + \frac{\dot{A}(t)}{A(t)}\right) \notag \\ =& s\frac{Y(t)}{A(t)L(t)} - (n + g + \delta)\frac{K(t)}{A(t)L(t)} \notag \\ =& sy(t) - (n + g + \delta)k(t) \notag \\ \end{align}

When the production function is CES, the equation becomes

\begin{align} \dot{k}(t) =& s\bigg[\alpha k(t)^{\rho} + (1-\alpha)\bigg]^{\frac{1}{\rho}} - (n + g + \delta)k(t). \end{align}

When the production function is Cobb-Douglas, the equation becomes

\begin{align} \dot{k}(t) =& sk(t)^{\alpha} - (n + g + \delta)k(t). \end{align}

### (5 points) Part f)¶

Using your results from parts d) and e) and the Python function defining the equation of motion for capital (per person/effective person) complete the Python function which defines the Jacobian for the Solow model.

In [3]:
def equation_of_motion_capital(t, k, params):
"""
Equation of motion for capital (per person/effective person).

Arguments:

t:      (array-like) Time.
k:      (array-like) Capital (per person/effective person).
params: (dict) Dictionary of parameter values.

Returns:

k_dot: (array-like) Time-derivative of capital (per person/effective
person).

"""
# extract params
s     = params['s']
n     = params['n']
g     = params['g']
delta = params['delta']

y = ces_output(t, k, params)

k_dot = s * y - (n + g + delta) * k

return k_dot

In [ ]:
# you where given the following incomplete code...
def solow_jacobian(t, k, params):
"""
The Jacobian of the Solow model.

Arguments:

t:      (array-like) Time.
k:      (array-like) Capital (per person/effective person).
params: (dict) Dictionary of parameter values.

Returns:

jac: (array-like) Value of the derivative of the equation of
motion for capital (per worker/effective worker) with
respect to k.

"""
# extract params
s     = params['s']
n     = params['n']
g     = params['g']
delta = params['delta']

mpk = #INSERT YOUR CODE HERE

k_dot = s * mpk - (n + g + delta)

return k_dot

In [4]:
# which should have been completed as follows...
def solow_jacobian(t, k, params):
"""
The Jacobian of the Solow model.

Arguments:

t:      (array-like) Time.
k:      (array-like) Capital (per person/effective person).
params: (dict) Dictionary of parameter values.

Returns:

jac: (array-like) Value of the derivative of the equation of
motion for capital (per worker/effective worker) with
respect to k.

"""
# extract params
s     = params['s']
n     = params['n']
g     = params['g']
delta = params['delta']

mpk = marginal_product_capital(t, k, params)

k_dot = s * mpk - (n + g + delta)

return k_dot


### (5 points) Part g)¶

In the cell below, create a Python dictionary called default_params using the following values: $\alpha$ = 0.33, $\delta$ = 0.04, $\sigma$ = 1.0, $g$ = 0.02, $n$ = 0.01, $s$ = 0.15, $L(0)$=1.0, $A(0)$=1.0.

In [ ]:
# INSERT CODE HERE!

In [60]:
# my solution...
default_params = {'alpha':0.5, 'delta':0.04, 'sigma':1.05, 'g':0.02,
'n':0.01, 's':0.15, 'A0':1.0, 'L0':1.0}


### (5 points) Part h)¶

In the cell below, create instance of the SolowModel class called model using the results from parts c), d), f) and g).

In [ ]:
# INSERT CODE HERE!

In [61]:
# my solution...
model = growth.SolowModel(output=ces_output,
mpk=marginal_product_capital,
k_dot=equation_of_motion_capital,
jacobian=solow_jacobian,
params=default_params)


### (10 points) Part i)¶

Derive an analytic expression for the steady state value of capital (per person/effective person) using your result from part e) and use your result to complete the Python function in the cell below defining the analytic steady state value for $k$ as a function of model parameters.

When the production function is CES, the steady state value for capital (per person/effective person) is

\begin{align} 0 =& s\bigg[\alpha k^{*\rho} + (1-\alpha)\bigg]^{\frac{1}{\rho}} - (n + g + \delta)k^* \\ s\bigg[\alpha k^{*\rho} + (1-\alpha)\bigg]^{\frac{1}{\rho}} =& (n + g + \delta)k^* \\ s^{\rho}\bigg[\alpha k^{*\rho} + (1-\alpha)\bigg] =& (n + g + \delta)^{\rho}k^{*\rho} \\ \alpha s^{\rho} k^{*\rho} + (1-\alpha)s^{\rho} =& (n + g + \delta)^{\rho}k^{*\rho} \\ (1-\alpha)s^{\rho} =& (n + g + \delta)^{\rho}k^{*\rho} - \alpha s^{\rho} k^{*\rho} \\ (1-\alpha)s^{\rho} =& \bigg((n + g + \delta)^{\rho} - \alpha s^{\rho}\bigg) k^{*\rho} \\ k^{*\rho} =& \frac{(1-\alpha)s^{\rho}}{(n + g + \delta)^{\rho} - \alpha s^{\rho}} \\ k^* =& \left(\frac{(1-\alpha)s^{\rho}}{(n + g + \delta)^{\rho} - \alpha s^{\rho}}\right)^{\frac{1}{\rho}} \\ \end{align}

Note that in order for $k^* > 0$ we require that the parameter $\alpha$ satisfies

\begin{align} \alpha < \bigg(\frac{n+g+\delta}{s}\bigg)^{\rho}. \end{align}

When the production function is Cobb-Douglas, the steady state value for capital (per person/effective person) is

\begin{align} 0 =& sk^{*\alpha} - (n + g + \delta)k^* \\ sk^{*\alpha} =& (n + g + \delta)k^* \\ sk^{*\alpha-1} =& (n + g + \delta) \\ k^{*\alpha-1} =& \frac{n + g + \delta}{s} \\ k^* =& \left(\frac{s}{n + g + \delta}\right)^{\frac{1}{1-\alpha}} \end{align}

In [ ]:
### you were given the following incomplete code...
def analytic_k_star(params):
"""Steady-state level of capital (per person/effective person)."""
# extract params
s     = params['s']
n     = params['n']
g     = params['g']
alpha = params['alpha']
delta = params['delta']
sigma = params['sigma']
rho   = # INSERT CODE HERE DEFINING RHO IN TERMS OF SIGMA!

# nest Cobb-Douglas technology as special case
if rho == 0:
k_star = # INSERT CODE HERE!
else:
k_star = # INSERT CODE HERE!

return k_star

In [11]:
### which should be completed as follows...
def analytic_k_star(params):
"""Steady-state level of capital (per person/effective person)."""
# extract params
s     = params['s']
n     = params['n']
g     = params['g']
alpha = params['alpha']
delta = params['delta']
sigma = params['sigma']
rho   = (sigma - 1) / sigma

# nest Cobb-Douglas as special case
if rho == 0:
k_star = (s / (n + g + delta))**(1 / (1 - alpha))
else:
k_star = (((1 - alpha) * s**rho) / ((n + g + delta)**rho - alpha * s**rho))**(1 / rho)

return k_star

In [12]:
def isfinite_k_star(params):
"""Returns true if parameters are consistent with a finite k*."""
# extract params
s     = params['s']
n     = params['n']
g     = params['g']
alpha = params['alpha']
delta = params['delta']
sigma = params['sigma']
rho   = (sigma - 1) / sigma

return alpha < ((n + g + delta) / s)**rho

In [13]:
isfinite_k_star(default_params)

Out[13]:
True

### (5 points) Part j)¶

Using the code from the lab session as a guide, create a Python dictionary called solow_steady_state_funcs containing your result from part i) and add it to the model.

In [ ]:
# INSERT YOUR CODE HERE!!

In [62]:
# create a dictionary of steady state expressions...

# add the dictionary of functions to the model

In [63]:
# compute the steady state values

In [64]:
# compare this result to the one you obtained from part i

Out[64]:
{'k_star': 4.72555503663348}

Execute the code in the cell below to calibrate the model for the U.S. using data from the Penn World Tables.

In [84]:
# calibrate the model!
growth.calibrate_ces(model, 'USA', x0=[0.75, 1.01], method='Nelder-Mead', bounds=None)

Optimization terminated successfully.
Current function value: 0.624288
Iterations: 62
Function evaluations: 145

In [85]:
# display the parameters...
model.params

Out[85]:
{'A0': 121.54997789817465,
'L0': 61.971196530271804,
'alpha': 0.91456643533201798,
'delta': 0.03761163,
'g': 0.03629411526782518,
'n': 0.015525562239498985,
's': 0.20732178,
'sigma': 0.78943070081394473}
In [86]:
# check that k_star is finite!
isfinite_k_star(model.params)

Out[86]:
True

### (5 points) Part k)¶

Using the code examples from the lab as a guide, generate a plot of the Solow diagram demonstrating how the output, actual investment, and breakeven investment curves shift as a result of a 50% increase in $\sigma$ (i.e., the elasticity of substitution between capital and effective labor). Explain why, and in which direction, each curve shifts. Discuss the impact on the steady state levels of capital, output, and consumption per effective person.

In [89]:
# here is the code for generating the plot...
plt.figure(figsize=(8,6))
model.plot_solow_diagram(gridmax=300, N=1000, param='sigma', shock=1.05, reset=True)
plt.show()


From your answer to part b) it can be shown that a positive shock to $\sigma$ increases the marginal productivity of capital per effective worker. Following the positive shock to $\sigma$ the current stock of capital per effective worker now has a higher marginal product and is therefore capable of producing more output per effective worker (i.e., $y$ jumps up!). Since a constant fraction of output is saved the positve shock to $\sigma$ also leads to higher actual savings. Break even investment is unaffected by shocks to $\sigma$.

Following the positive shock to $\sigma$ actual investment will exceed breakeven investment which causes capital per effective worker to rise towards its new, higher steady state value. Since steady state $k$ is higher following the shock, steady state $y$ must also be higher. Whether steady state consumption per effective worker is higher or lower depends on the old (i.e., pre-shock) and new (i.e., post-shock) steady state value of $k$ to its "Golden-rule" level. If the new steady state is closer (further away) to its "Golden-rule" level than the old steady state, then the new steady state $c$ will be higher (lower).

### (5 points) Part l)¶

Using code from the lab as a guide, generate impulse response functions (IRFs) in for the Solow model following a 50% increase in the elasticity of substitution between capital and effective labor, $\sigma$. Discuss the resulting IRFs.

In [39]:
# here is the code snippet...
fig_kwargs = {'figsize':(12,8)}
model.plot_impulse_response(variables='all', param='sigma', shock=1.05, T=100,
kind='efficiency_units', log=False, reset=True, **fig_kwargs)
plt.show()


The positive shock to $\sigma$ increases the marginal capital, which raises output and actual investment. Break even investment is unaffected by an increase in $\sigma$. Since, following the shock, actual investment exceeds break even investment $k$ begins to rise and continues to do so until it reaches its new, higher steady state level.

Following the positive shock to $\sigma$ the current stock of capital per effective worker now has a higher marginal product and is therefore capable of producing more output per effective worker. The shock to $\sigma$ causes $y$ to jump up inititially and then, because $k$ continues to rise, $y$ also continues rising toward its new, higher steady state value.

Following the positive shock to $\sigma$ the current stock of capital per effective worker now has a higher marginal product and is therefore capable of producing more output per effective worker. The shock to $\sigma$ causes $y$ to jump up inititially. Since consumption per effective worker is just a constant fraction of output per effective worker, the jump in $y$ causes $c$ to jump as well. The fact that $c$ transitions to a new, higher steady state level indicates that the economy has moved closer to its "Golden-rule" level.

### (5 points) Part m:¶

Using your results from part b), derive an expression for the elasticity of output per effective person with respect to capital per effective person, $\alpha_k$, as a function of capital per effective person, $k$, and model parameters.

\begin{align} \alpha_{k}(k) =& \frac{k f'(k)}{f(k)} \\ =&\frac{k\bigg[\alpha k^{\rho-1}\bigg(\alpha k^{\rho} + (1-\alpha)\bigg)^{\frac{1}{\rho}-1}\bigg]}{\bigg(\alpha k^{\rho} + (1-\alpha)\bigg)^{\frac{1}{\rho}}}\\ =&\frac{\alpha k^{\rho}}{\alpha k^{\rho} + (1-\alpha)}\\ \end{align}

### (5 points) Part n)¶

Differentiate your result from part m) with respect to capital per effective person, $k$, and discuss under what conditions the derivative will be positive, negative, or zero.

\begin{align} \frac{\partial \alpha_{k}(k)}{\partial k} =&\frac{\alpha \rho k^{\rho - 1}\bigg(\alpha k^{\rho} + (1-\alpha)\bigg) - \alpha k^{\rho}\bigg(\alpha\rho k^{\rho-1}\bigg)}{\bigg(\alpha k^{\rho} + (1-\alpha)\bigg)^2}\\ =&\frac{\alpha^2 \rho k^{2\rho - 1} + \alpha(1-\alpha)\rho k^{\rho-1} - \alpha^2\rho k^{2\rho-1}}{\bigg(\alpha k^{\rho} + (1-\alpha)\bigg)^2}\\ =&\frac{\alpha(1-\alpha)\rho k^{\rho-1}}{\bigg(\alpha k^{\rho} + (1-\alpha)\bigg)^2}\\ \end{align}

Result is more easily interpretable after subsituting $\rho=\frac{\sigma-1}{\sigma}$.

\begin{align} \frac{\partial \alpha_{k}(k)}{\partial k} =&\frac{\alpha(1-\alpha)\rho k^{\rho-1}}{\bigg(\alpha k^{\rho} + (1-\alpha)\bigg)^2}\\ =&\frac{\alpha(1-\alpha)\bigg(\frac{\sigma-1}{\sigma}\bigg) k^{\frac{1}{\sigma}}}{\bigg(\alpha k^{\frac{\sigma-1}{\sigma}} + (1-\alpha)\bigg)^2}\\ \end{align}

Thus we find that $\frac{\partial \alpha_{k}(k)}{\partial k} > 0 \iff \sigma > 1$ which means that capital and effective labor are substitutes; $\frac{\partial \alpha_{k}(k)}{\partial k} < 0 \iff \sigma < 1$ which means that capital and effective labor are complements; and $\frac{\partial \alpha_{k}(k)}{\partial k} = 0 \iff \sigma = 1$ which means that production function is Cobb-Douglas.

### (5 points) Part o)¶

Use the fact that $\frac{\partial k}{\partial s} > 0$ and the result from part n) to relate the sign of $\frac{\partial \alpha_k(k)}{\partial s}$ to the elasticity of substitution between capital and effective labor.

We find that $\frac{\partial \alpha_k(k)}{\partial s} = \left(\frac{\partial k}{\partial s}\right)\left(\frac{\partial \alpha_{k}(k)}{\partial k}\right) > 0 \iff \sigma > 1$ which means that capital and effective labor are substitutes; similarly, $\frac{\partial \alpha_k(k)}{\partial s} < 0 \iff \sigma < 1$ which means that capital and effective labor are complements; and $\frac{\partial \alpha_k(k)}{\partial s} = 0 \iff \sigma = 1$ which means that production function is Cobb-Douglas.

### (15 points) Part p)¶

The code in the cell below regresses $\alpha_k(k)$ on the investment's share of GDP for the U.S., $s$ during two different time periods: 1950-1970 and 1970-2011. Can you "explain" these pattern using your result from part o)?

In [18]:
fig = plt.figure(figsize=(8,6))

# capital's share for US (pre-1970)
y = 1 - model.data.labsh.loc[:1970]

# savings rate for US (pre-1970)
x = model.data.csh_i.loc[:1970]

# regress capital's share on savings rate
res1   = pd.ols(y=y, x=x)

ax1.scatter(x, y)
ax1.set_xlabel('s', family='serif', fontsize=15)
ax1.set_ylabel(r'$\alpha_k(k)$', fontsize=15, family='serif', rotation='horizontal')
ax1.set_title('U.S. pre-1970', family='serif', fontsize=15)

# plot regression line pre-1970
grid = np.linspace(0.15, 0.25, 100)
ax1.plot(grid, res1.beta[1] + res1.beta[0] * grid, 'r')

# capital's share for US (post-1970)
y = 1 - model.data.labsh.loc[1970:]

# savings rate for US (post-1970)
x = model.data.csh_i.loc[1970:]

# regress capital's share on savings rate post-1970
res2   = pd.ols(y=y, x=x)

ax2.scatter(x, y)
ax2.set_xlabel('s', family='serif', fontsize=15)
ax2.set_title('U.S. post-1970', family='serif', fontsize=15)

# plot regression line post-1970
grid = np.linspace(0.15, 0.25, 100)
ax2.plot(grid, res2.beta[1] + res2.beta[0] * grid, 'r')

fig.suptitle("Patterns in capital's share for the U.S?", x=0.5, y=1.05,
fontsize=20, family='serif')
fig.tight_layout()
plt.show()

In [19]:
# summary of the regression results for 1950-1970
print res1

-------------------------Summary of Regression Analysis-------------------------

Formula: Y ~ <x> + <intercept>

Number of Observations:         21
Number of Degrees of Freedom:   2

R-squared:         0.2033

Rmse:              0.0087

F-stat (1, 19):     4.8476, p-value:     0.0402

Degrees of Freedom: model 1, resid 19

-----------------------Summary of Estimated Coefficients------------------------
Variable       Coef    Std Err     t-stat    p-value    CI 2.5%   CI 97.5%
--------------------------------------------------------------------------------
x     0.3420     0.1553       2.20     0.0402     0.0375     0.6465
intercept     0.2794     0.0307       9.12     0.0000     0.2193     0.3395
---------------------------------End of Summary---------------------------------


In [20]:
# summary of the regression results for 1970-2011
print res2

-------------------------Summary of Regression Analysis-------------------------

Formula: Y ~ <x> + <intercept>

Number of Observations:         42
Number of Degrees of Freedom:   2

R-squared:         0.1669

Rmse:              0.0130

F-stat (1, 40):     8.0161, p-value:     0.0072

Degrees of Freedom: model 1, resid 40

-----------------------Summary of Estimated Coefficients------------------------
Variable       Coef    Std Err     t-stat    p-value    CI 2.5%   CI 97.5%
--------------------------------------------------------------------------------
x    -0.2736     0.0966      -2.83     0.0072    -0.4630    -0.0842
intercept     0.4104     0.0206      19.92     0.0000     0.3700     0.4508
---------------------------------End of Summary---------------------------------



Consistency with the Solow model requires that...

1. Capital and effective labor must have been "substitutes" $\implies \sigma > 1,\ \rho > 0$ for the U.S. between 1950-1970.
2. Capital and effective labor must be "complements" $\implies \sigma < 1,\ \rho < 0$ for the U.S. between 1970-present.

One possible story is that prior to 1970 advances in technology led to increased automation of production process (i.e., technology replaced people with machines!); after 1970, however, advances in technology were primarily driven by rise of computers which require skilled labor to operate efficiently (i.e., technology replaced a worker with a computer and a worker with skills to use it!).

In case, you are wondering the values for $\sigma$ calibrated to pre and post 1970's U.S. data are consistent with the above story.

In [41]:
# calibrate the model for 1950-1970
growth.calibrate_ces(model, 'USA', x0=[0.9, 1.05], method='Nelder-Mead', bounds=(1950, 1970))

# display the parameters...
model.params

Optimization terminated successfully.
Current function value: 0.069163
Iterations: 60
Function evaluations: 142

Out[41]:
{'A0': 8.4013859704623151e-06,
'L0': 62.042847904603079,
'alpha': 0.92487514982243713,
'delta': 0.035311185,
'g': 0.24752114778989309,
'n': 0.013829716769131757,
's': 0.19696239,
'sigma': 1.0319048902747541}
In [42]:
# calibrate the model for 1970-2011
growth.calibrate_ces(model, 'USA', x0=[0.3, 0.35], method='Nelder-Mead', bounds=(1970, 2011))

# display the parameters...
model.params

Optimization terminated successfully.
Current function value: 0.177896
Iterations: 68
Function evaluations: 166

Out[42]:
{'A0': 2144.4725557564207,
'L0': 66.08809869858429,
'alpha': 0.90974121093750004,
'delta': 0.038733795,
'g': 0.025180474313690131,
'n': 0.014127169172378055,
's': 0.21214846,
'sigma': 0.55418090820312549}
In [ ]: