Overlapping Generations (OLG) model

In the OLG model, the economy is populated by people who differ by age: some are young and working, while some are old and retired.

The fact that incomes of the old tend to be lower than incomes of the young, creates a natural desire for saving. Therefore, the OLG model will serve us to investigate the reasons for different saving rates across countries.

In [1]:
# Make graphs appear within the notebook
%matplotlib inline

# Import numerical computations library
import numpy as np

# Import plotting library
import matplotlib.pyplot as plt

# Import functions from AppliedMacroPlots.py
from AppliedMacroPlots import *

Intertemporal choice of a consumer

Before we encounter the OLG model, let us talk first on how to model the choice of a consumer, whose life is divided in two time periods: $t$ and $t+1$.

If it helps you in building your intuition, imagine that the first time period ($t$) represents the period when the agent is young and working, while the second time period ($t+1$) represents the period when the agent is old and retired.

I have also picked a specific functional form for the utility function: the logarithmic function. The reason for this choice is that the logarithmic function has a super easy derivative:

\begin{align} \frac{\partial log x}{\partial x} = \frac{1}{x} \end{align}

and this will simplify our calculations quite a lot.

Utility maximization problem

Our aim is to construct an optimization problem, the solution to which will closely approximate the choices of actual people.

Imagine that our consumer earns income $y_{t}$ in the first period, and income $y_{t+1}$ in the second period.

Moreover the consumer can either save a part of the first period income, or borrow against second period income. For simplicity, the real interest rate for saving and borrowing is the same and is denoted with $r$.

The consumer is also impatient, in the sense that she prefers to consume today rather than in the future (although she does not want to starve in the future!). We capture this feature of human behavior by assuming that future outcomes are discounted with the discount factor $0<\beta<1$.

Formally, we set up a maximization problem, constrained by the consumer's budget constraint:

\begin{align} \max_{c_{t}, c_{t+1}} \quad & U=\log c_{t}+\beta\log c_{t+1}\\ \text{subject to} \quad & c_{t}+\frac{c_{t+1}}{1+r}\leq y_{t}+\frac{y_{t+1}}{1+r} \end{align}

where the constraint implies that the present dicounted value (PDV) of lifetime consumption cannot exceed the PDV of lifetime income.

Let us first plot the budget set: the set of all attainable consumption bundles given our endowments: incomes in period $t$ and $t+1$, which we will denote in python codes as period 0 and 1.

In the graph below, the point $(y_{t}, y_{t+1})$ denotes the initial endowment of consumer's incomes.

Thanks to the ability to save or borrow, the consumer can choose at maximum the amount $y_{t}+y_{t+1}/(1+r)$ in the first period (and consume 0 in the second period) or save the entire first period income and consume $(1+r)\cdot y_{t}+y_{t+1}$ in the second period (and consume 0 in the first period).

All three mentioned points lie on the same budget line. The budget set contains also some points where the PDV of consumption is smaller than the PDV of income, but in this context choosing any point that does not lie on the budget line would not be optimal.

In [2]:
y_0 = 2
y_1 = 1
r = 0.05
β = 0.95

PlotBudgetSet(y_0, y_1, r, full_labels=True)
plt.show()

The graph below depicts a so-called indifference map, that is, a set of indifference curves, corresponding to allocations between which the consumer is indifferent. Indifference curves that lie to the northeast represent higher levels of utility.

In [3]:
PlotIndifferenceCurves(y_0, y_1, β, r, levels=[0, 0.5, 1, 1.5], full_labels=True)
plt.show()

The graph below shows the budget set and two indifference curves. The green indifference curve is infeasible -- there are no points in the budget set that lie on this curve. The yellow indifference curve is feasible -- there are points in the budget set that lie on this curve -- but is clearly not optimal, as we could find some points in the budget set that lie to the northeast of the yellow indifference curve.

Graphically, optimal choice involves choosing such a point from the budget set that lies on the highest possible indifference curve, such that this surve is tangent to the budget line.

You can attempt to find an (approximate) graphical solution by appending a number to the levels=[0.5, 1] list in the code below.

In [4]:
# This will make both plots appear in the same figure
fig, ax = plt.subplots(figsize=(5, 5))

PlotBudgetSet(y_0, y_1, r, fig_ax=(fig, ax))
PlotIndifferenceCurves(y_0, y_1, β, levels=[0.5, 1], fig_ax=(fig, ax))

plt.show()

The code below solves the Utility Maximization Problem of the consumer and displays the results.

If you want, you can change the parameters of the problem, for example to see when the consumer is a saver, and when a borrower (although be aware that for crazy parameters you can get crazy outcomes).

In [5]:
y_0 = 2
y_1 = 1
r = 0.05
β = 0.95

SolveUtilityMaximizationProblem(y_0, y_1, β, r)
plt.show()
Consumer's income:
  y_0: 2.0000
  y_1: 1.0000

Optimal consumption:
  c_0: 1.5140
  c_1: 1.5103

c_0 < y_0: Consumer is a saver

Note that in the above graph there appears an Euler equation curve. You will find an explanation below.

Solving UMP with the Lagrange method

Although in principle the UMP could be solved with a variety of methods, we will solve it with the Lagrange method. The advantage of this method is that it scales well to problems with a large (or even infinite) number of variables involved.

Recall our problem:

\begin{align} \max\quad & U=\log c_{t}+\beta\log c_{t+1}\\ \text{subject to}\quad & c_{t}+\frac{c_{t+1}}{1+r}\leq y_{t}+\frac{y_{t+1}}{1+r} \end{align}

Rewrite the budget constraint in the form of $0\leq\ldots$:

\begin{align} 0\leq y_{t}+\frac{y_{t+1}}{1+r}-c_{t}-\frac{c_{t+1}}{1+r} \end{align}

And set up a Lagrange function:

\begin{align} \mathcal{L}=\log c_{t}+\beta\log c_{t+1}+\lambda\left[y_{t}+\frac{y_{t+1}}{1+r}-c_{t}-\frac{c_{t+1}}{1+r}\right] \end{align}

where $\lambda$ is called the Lagrange multiplier. Next we derive the First Order Conditions (FOCs), that is, calculate the derivatives of the Lagrangian with respect to the choice variables. In this problem there are two choice variables -- $c_{t}$ and $c_{t+1}$:

\begin{align} \frac{\partial\mathcal{L}}{\partial c_{t}} & =\frac{1}{c_{t}}+\lambda\left[-1\right]=0\\ \frac{\partial\mathcal{L}}{\partial c_{t+1}} & =\beta\cdot\frac{1}{c_{t+1}}+\lambda\left[-\frac{1}{1+r}\right]=0 \end{align}

Let us simplify the above equations:

\begin{align} \lambda & =\frac{1}{c_{t}}\\ \lambda & =\beta\left(1+r\right)\frac{1}{c_{t+1}} \end{align}

And combine them:

\begin{align} \frac{1}{c_{t}} & =\beta\left(1+r\right)\frac{1}{c_{t+1}}\\ c_{t+1} & =\beta\left(1+r\right)c_{t} \end{align}

The resulting equation is called the intertemporal condition (from Latin: across time) or the Euler equation.

At this stage, the Lagrangian procedure has allowed us to restate our problem, involving finding a point on a curve tangent to a line, to the problem of finding an intersection of two curves: the budget constraint and the Euler equation, which is much simpler to solve:

\begin{align} \begin{cases} c_{t}+\dfrac{c_{t+1}}{1+r}=y_{t}+\dfrac{y_{t+1}}{1+r}\\ c_{t+1}=\beta\left(1+r\right)c_{t} \end{cases} \end{align}

Plug the Euler equation into the budget constraint:

\begin{align} c_{t}+\frac{\beta\left(1+r\right)c_{t}}{1+r} & =y_{t}+\frac{y_{t+1}}{1+r}\\ c_{t}+\beta c_{t} & =y_{t}+\frac{y_{t+1}}{1+r}\\ \left(1+\beta\right)c_{t} & =y_{t}+\frac{y_{t+1}}{1+r}\\ c_{t} & =\frac{1}{1+\beta}\left[y_{t}+\frac{y_{t+1}}{1+r}\right] \end{align}

We can use the Euler equation again to find the level of consumption in the second period:

\begin{align} c_{t+1} & =\frac{\beta}{1+\beta}\left[\left(1+r\right)y_{t}+y_{t+1}\right] \end{align}

Finally, we can define the stock of assets (which can be negative) that agent has at the end of period $t$. In this problem, the stock of assets will be given as the difference between first period income and consumption:

\begin{align} a\equiv y_{t}-c_{t}=y_{t}-\frac{1}{1+\beta}\left[y_{t}+\frac{y_{t+1}}{1+r}\right]=\frac{\beta}{1+\beta}y_{t}-\frac{1}{1+\beta}\frac{y_{t+1}}{1+r} \end{align}

If $a>0$, the agent is a saver ($c_{t}<y_{t}$), and if $a<0$, the agent is a borrower ($c_{t}>y_{t}$). If $a=0$, the agent is neither a saver nor a borrower and simply consumes the initial endowments ($c_{t}=y_{t}$ and $c_{t+1}=y_{t+1}$). You can see an example for the $a=0$ case below.

In [6]:
y_0 = 1
y_1 = 1
r = 0.05
β = 1/(1+r)

SolveUtilityMaximizationProblem(y_0, y_1, β, r)
plt.show()
Consumer's income:
  y_0: 1.0000
  y_1: 1.0000

Optimal consumption:
  c_0: 1.0000
  c_1: 1.0000

c_0 = y_0: Consumer is neither a borrower nor a saver

Comparative statics

Let us now perform a few comparative statics exercises, so that we may gain intuition on the factors affecting the choice of consumption and savings.

\begin{align} a & =\frac{\beta}{1+\beta}y_{t}-\frac{1}{1+\beta}\frac{y_{t+1}}{1+r}\\ c_{t} & =\frac{1}{1+\beta}\left[y_{t}+\frac{y_{t+1}}{1+r}\right]\\ c_{t+1} & =\frac{\beta}{1+\beta}\left[\left(1+r\right)y_{t}+y_{t+1}\right] \end{align}

Changes in $\beta$

The higher $\beta$ is, the more patient is our agent. Intuitively, since the agent with higher $\beta$ cares more about the future, she would save more in the first period (and thus consume less in the first period) in order to consume more in the second period:

\begin{align} \frac{\partial a}{\partial\beta} & =\frac{1+\beta-\beta}{\left(1+\beta\right)^{2}}y_{t}-\left[-\frac{1}{\left(1+\beta\right)^{2}}\right]\frac{y_{t+1}}{1+r}=\frac{1}{\left(1+\beta\right)^{2}}\left[y_{t}+\frac{y_{t+1}}{1+r}\right]>0\\ \frac{\partial c_{t}}{\partial\beta} & =-\frac{1}{\left(1+\beta\right)^{2}}\left[y_{t}+\frac{y_{t+1}}{1+r}\right]<0\\ \frac{\partial c_{t+1}}{\partial\beta} & =\frac{1+\beta-\beta}{\left(1+\beta\right)^{2}}\left[\left(1+r\right)y_{t}+y_{t+1}\right]>0 \end{align}

Changes in $y_{t}$

An increase in the first period income increases consumption in both time periods. Since the agent will want to transfer a part of the additional first period income to the second period, savings will also increase:

\begin{align} \frac{\partial a}{\partial y_{t}} & =\frac{\beta}{1+\beta}>0\\ \frac{\partial c_{t}}{\partial y_{t}} & =\frac{1}{1+\beta}>0\\ \frac{\partial c_{t+1}}{\partial y_{t}} & =\frac{\beta}{1+\beta}\left(1+r\right)>0 \end{align}

Changes in $y_{t+1}$

An increase in the second period income increases consumption in both time periods. Since the agent will want to transfer a part of the additional second period income to the first period, savings will decrease:

\begin{align} \frac{\partial a}{\partial y_{t+1}} & =-\frac{1}{1+\beta}\frac{1}{1+r}<0\\ \frac{\partial c_{t}}{\partial y_{t+1}} & =\frac{1}{1+\beta}\frac{1}{1+r}>0\\ \frac{\partial c_{t+1}}{\partial y_{t+1}} & =\frac{\beta}{1+\beta}>0 \end{align}

Changes in $r$

An increase in the interest rate generates two effects: substitution effect and income effect. Substitution effect is generated by the change in relative prices of consumption in the first period versus consumption in the second period. It induces the agent to consume more in the second period and consume less in the first period. Income effect is generated by the fact that the PDV of income changes due to the changes in the discounting rate. The sign of the effect depends on whether an agent is a saver or a borrower. An increase in interest rates creates a positive income effect for the saver, increasing her consumption in both periods. Conversely, an increase in interest rates creates a negative income effect for the borrower, decreasing her consumption in both periods.

These effects can be summarized by the following table, where pluses and minuses describe the direction of change in a variable for which we can be certain of the direction, regardless of the assumed utility function:

Effects of an increase in $r$ Saver Borrower
$c_{t}$ $c_{t+1}$ $a$ $c_{t}$ $c_{t+1}$ $a$
Income + + - - - +
Substitution - + + - + +
Net ? + ? - ? +

There are however also changes in variables marked with question marks, where the direction of change in a variable depends on the relative strength of substitution and income effects. In the case of a saver, if the income effect is stronger (weaker) than the substitution effect, consumption in the first period increases (decreases) and savings decrease (increase). In the case of a borrower, if the income effect is stronger (weaker) than the substitution effect, consumption in the second period decreases (increases).

In figures below, the initial endowment point is labeled as $E$, the optimal choice for old $r$ as $O$ and the optimal choice for new $r$ as $O^{\prime}$. Point $S$ represents the pure substitution effect, that is what would be the optimal choice of a consumer given new prices, if we changed the budget constraint such that the consumer's utility would be unchanged. Therefore, vector $O\to S$ represents the substitution effect, while vector $S\to O^{\prime}$ represents the income effect.

In [7]:
print("Saver's case")

y_0 = 2.5
y_1 = 1
β = 0.95
r = 0.05
r_new = 1

ShowIncomeAndSubstitutionEffects(y_0, y_1, β, r, r_new)
plt.show()
Saver's case
In [8]:
print("Borrower's case")

y_0 = 0.5
y_1 = 3.1
β = 0.95
r = 0.05
r_new = 1

ShowIncomeAndSubstitutionEffects(y_0, y_1, β, r, r_new)
plt.show()
Borrower's case

The relative strength of the two effects depends on the shape of the indifference curves. In the case of the logarithmic utility function the reactions to the changes in the interest rate are the same, regardless of whether the agent is a borrower or a saver:

\begin{align} \frac{\partial a}{\partial r} & =-\frac{1}{1+\beta}\left[-\frac{y_{t+1}}{\left(1+r\right)^{2}}\right]=\frac{1}{1+\beta}\frac{y_{t+1}}{\left(1+r\right)^{2}}>0\\ \frac{\partial c_{t}}{\partial r} & =\frac{1}{1+\beta}\left[-\frac{y_{t+1}}{\left(1+r\right)^{2}}\right]=-\frac{1}{1+\beta}\frac{y_{t+1}}{\left(1+r\right)^{2}}<0\\ \frac{\partial c_{t+1}}{\partial r} & =\frac{\beta}{1+\beta}y_{t}>0 \end{align}

In response to the increase in the interest rate, second period consumption increases (as long as $y_{t}>0$) and savings increase, while first period consumption decreases (as long as $y_{t+1}>0$). The negative relationship between the level of interest rates and consumption is a usual assumption in macroeconomics, and is present in the undergraduate macroeconomic models such as IS-LM and AS-AD.

The case of logarithmic utility and $y_{t+1}=0$ is a very special case where both first period consumption and savings stay constant while second period consumption increases in response to an increase in the interest rate. The income and substitution effects have exactly equal strength and cancel each other out. We will use this set of assumptions when we will encounter the basic OLG model.

Figures below illustrate the dependence of the relative strength of the substitution and income effects on the specific utility function.

The consumer's utility function is assumed to be the Constant Relative Risk Aversion (CRRA) function, which is commonly used in economic growth and financial literature. Parameter $\sigma>0$ regulates the risk aversion of the consumer (the higher $\sigma$ is, the more risk averse is the consumer):

\begin{align} U=\frac{c_{t}^{1-\sigma}-1}{1-\sigma}+\beta\frac{c_{t+1}^{1-\sigma}-1}{1-\sigma} \end{align}

For $\sigma=1$, the CRRA utility function reduces to the logarithmic function.

In [9]:
print('Assuming second period income = 0')

y_0 = 1
y_1 = 0
β = 0.95

σ_vec = [0.5, 1, 2]
r_vec = np.linspace(0, 0.5, 6)

for σ in σ_vec:
    fig, ax = plt.subplots()
    for r in r_vec:
        SolveUtilityMaximizationProblemCRRA(y_0, y_1, β, σ, r, (fig, ax))
    plt.title('Optimal choice for different $r$ with σ =  {:.1f}'.format(σ))
    plt.xlabel('Consumption in period $t$')
    plt.ylabel('Consumption in period $t+1$')
    plt.show()
    print('')
Assuming second period income = 0



In [10]:
print('Assuming second period income smaller then first period income')

y_0 = 2
y_1 = 1
β = 0.95

σ_vec = [1, 2, 2.5, 3]
r_vec = np.linspace(0, 0.5, 6)

for σ in σ_vec:
    fig, ax = plt.subplots()
    for r in r_vec:
        SolveUtilityMaximizationProblemCRRA(y_0, y_1, β, σ, r, (fig, ax))
    plt.title('Optimal choice for different $r$ with σ =  {:.1f}'.format(σ))
    plt.xlabel('Consumption in period $t$')
    plt.ylabel('Consumption in period $t+1$')
    plt.show()
    print('')
Assuming second period income smaller then first period income




In [11]:
print('Assuming second period income bigger then first period income')

y_0 = 1
y_1 = 2
β = 0.95

σ_vec = [1, 3, 3.5, 4]
r_vec = np.linspace(0, 0.5, 6)

for σ in σ_vec:
    fig, ax = plt.subplots()
    for r in r_vec:
        SolveUtilityMaximizationProblemCRRA(y_0, y_1, β, σ, r, (fig, ax))
    plt.title('Optimal choice for different $r$ with σ =  {:.1f}'.format(σ))
    plt.xlabel('Consumption in period $t$')
    plt.ylabel('Consumption in period $t+1$')
    plt.show()
    print('')
Assuming second period income bigger then first period income




Overlapping Generations model

We are now ready to tackle the OLG model. This particular version follows Diamond (1965) and is the simplest setup of a general equilibrium OLG model.

The model is populated by firms and households. Each household belongs to a certain generation and within each time period there are two generations alive at the same time, which we will label as young (y) and old (o). Time is divided into discrete periods, each representing around 30 years. Therefore, period $t$ young will become period $t$ old:

OLG Generations Structure

Author: Christian Groth

The number of young agents in period $t$ is denoted with $N_{t}^{y}$, and the number of old agents in period $t$ is denoted with $N_{t}^{o}$. We assume that all young survive into the old age, but all old die with certainty. Therefore, the number of old agents in period $t$ is equal to the number of young agents in period $t-1$:

\begin{align} N_{t}^{o} = N_{t-1}^{y} \end{align}

and the total population $N_{t}$ is equal to the sum of young and old:

\begin{align} N_{t} = N_{t}^{y} + N_{t}^{o} \end{align}

We will also assume that the ratio of number of children to number of their parents is equal to $1+n$ (each couple has $2\cdot (1+n)$ children). This implies that the rate of growth of the entire population is also equal to $n$:

\begin{align} \frac{N_{t+1}}{N_{t}} & =\frac{N_{t+1}^{y}+N_{t+1}^{o}}{N_{t}^{y}+N_{t}^{o}}=\frac{\left(1+n\right)N_{t}^{y}+N_{t}^{y}}{\left(1+n\right)N_{t}^{o}+N_{t}^{o}}\\ & =\frac{\left(1+n\right)^{2}N_{t}^{o}+\left(1+n\right)N_{t}^{o}}{\left(1+n\right)N_{t}^{o}+N_{t}^{o}}=\frac{\left(1+n\right)\left[\left(1+n\right)+1\right]}{\left(1+n\right)+1}\\ & =1+n \end{align}

Households' problem

The households solve a familiar two-period Utility Maximization Problem:

\begin{align} \max\quad & U=\log c_{t}^{y}+\beta\log c_{t+1}^{o}\\ \text{subject to}\quad & c_{t}^{y}+a_{t+1}=w_{t}\\ & c_{t+1}^{o}\quad\,\,\,\,\,=\left(1+r_{t+1}\right)a_{t+1} \end{align}

where $c_{t}^{y}$ denotes consumption in period $t$ when young y and $c_{t+1}^{o}$ denotes consumption in period $t+1$ when old o.

For simplicity, we assume that the household receives labor income in the first period in the form of wages, and no labor income in the second period. The only way the old can finance their consumption is through their assets. We denote the stock of assets of young y at the end of period $t$ as $a_{t+1}$, and the reason for choosing this "shifted" time subscript will become clear later on.

Note that both the wage $w$ and the real interest rate $r$ have time subscripts. This is because the rewards to factors of production will depend on the level of capital stock in the economy.

As before, let us solve the problem by using the Lagrange method. First, construct the lifetime budget constraint:

\begin{align} c_{t+1}^{o} & =\left(1+r_{t+1}\right)a_{t+1}\\ a_{t+1} & =\frac{c_{t+1}^{o}}{1+r_{t+1}} \end{align}

\begin{align} c_{t}^{y}+a_{t+1} & =w_{t}\\ c_{t}^{y}+\frac{c_{t+1}^{o}}{1+r_{t+1}} & =w_{t} \end{align}

Again, the present discounted value (PDV) of lifetime consumption expenditures cannot exceed the PDV of lifetime income, and in this case the latter is simply first period labor income.

Note that although we are using equality signs for convenience, we should keep in the back of our heads that we can always consume less than what we earn, but not the other way around. Therefore, we rewrite the budget constraint for the purpose of plugging into the Lagrangian as:

\begin{align} 0=w_{t}-c_{t}^{y}-\frac{c_{t+1}^{o}}{1+r_{t+1}} \end{align}

Now we construct the Lagrangian:

\begin{align} \mathcal{L}=\log c_{t}^{y}+\beta\log c_{t+1}^{o}+\lambda_{t}\left[w_{t}-c_{t}^{y}-\frac{c_{t+1}^{o}}{1+r_{t+1}}\right] \end{align}

And derive the First Order Conditions (FOCs):

\begin{align} \frac{\partial\mathcal{L}}{\partial c_{t}^{y}} & =\frac{1}{c_{t}^{y}}+\lambda_{t}\left[-1\right]=0\\ \frac{\partial\mathcal{L}}{\partial c_{t+1}^{o}} & =\beta\frac{1}{c_{t+1}^{o}}+\lambda_{t}\left[-\frac{1}{1+r_{t+1}}\right]=0 \end{align}

Let us simplify the above equations:

\begin{align} \lambda_{t}&=\frac{1}{c_{t}^{y}}\\ \lambda_{t}&=\beta\left(1+r_{t+1}\right)\frac{1}{c_{t+1}^{o}} \end{align}

And combine them:

\begin{align} \frac{1}{c_{t}^{y}}&=\beta\left(1+r_{t+1}\right)\frac{1}{c_{t+1}^{o}}\\ c_{t+1}^{o}&=\beta\left(1+r_{t+1}\right)c_{t}^{y} \end{align}

Plug in the obtained Euler equation into the lifetime budget constraint:

\begin{align} c_{t}^{y}+\frac{c_{t+1}^{o}}{1+r_{t+1}} & =w_{t}\\ c_{t}^{y}+\frac{\beta\left(1+r_{t+1}\right)c_{t}^{y}}{1+r_{t+1}} & =w_{t}\\ c_{t}^{y}+\beta c_{t}^{y} & =w_{t} \end{align}

The resulting optimal levels of consumption are:

\begin{align} c_{t}^{y} & =\frac{1}{1+\beta}w_{t}\\ c_{t+1}^{o} & =\frac{\beta}{1+\beta}\left(1+r_{t+1}\right)w_{t} \end{align}

And the end of period $t$ stock of assets of the young is equal to:

\begin{align} a_{t+1}=w_{t}-c_{t}=\frac{\beta}{1+\beta}w_{t} \end{align}

Thanks to our simplifying assumptions (logarithmic utility and no pension income), the expressions for consumption of young and their stock of assets depend only on $t$ period variables.

Firms' problem

The firms want to hire optimal quantities of labor and capital to maximize their profits:

\begin{align} \max\quad\Pi_{t}=K_{t}^{\alpha}\left(A_{t}L_{t}\right)^{1-\alpha}-w_{t}L_{t}-r_{t}^{k}K_{t} \end{align}

First order conditions (FOCs):

\begin{align} \frac{\partial\Pi_{t}}{\partial L_{t}} & =\left(1-\alpha\right)K_{t}^{\alpha}A_{t}^{1-\alpha}L_{t}^{-\alpha}-w_{t}=0\\ \frac{\partial\Pi_{t}}{\partial K_{t}} & =\alpha K_{t}^{\alpha-1}\left(A_{t}L_{t}\right)^{1-\alpha}-r_{t}^{k}=0 \end{align}

Simplify the above expressions:

\begin{align} w_{t} & =\left(1-\alpha\right)A_{t}\left(\frac{K_{t}}{A_{t}L_{t}}\right)^{\alpha}=\left(1-\alpha\right)\frac{Y_{t}}{L_{t}}\\ r_{t}^{k} & =\alpha\left(\frac{K_{t}}{A_{t}L_{t}}\right)^{\alpha-1}=\alpha\frac{Y_{t}}{K_{t}} \end{align}

The above equations determine both the wage $w$ and the capital rental rate $r^{k}$ as functions of capital (per effective labor). The real interest rate is equal to the capital rental rate, less the capital depreciation rate:

\begin{align} r_{t} & =r_{t}^{k}-\delta \end{align}

In the simplest OLG model we assume that capital depreciates fully between time periods ($\delta=1$). This is justified by the fact that each period of time represents decades in real world. Just think about how few machines and equipments that were used in 1990 are still in use today.

General Equilibrium

The General Equilibrium assumption allows us to integrate the decisions of hosueholds and firms in a consistent manner. Behind the scenes, the GE concept involves assuming that all markets are simultaneously in equilibrium. In this model there are three markets: one for goods, one for labor and one for capital.

Labor market

We have assumed that all young work, and that the old do not work. Accordingly, the number of employees $L_{t}$ in equilibrium is equal to the number of the young $N_{t}^{y}$:

\begin{align} L_{t} = N_{t}^{y} \end{align}

Capital market

In equilibrium, the net assets of the households are equal to the productive capital employed by firms. In time period $t$ the only agents with positive assets are the old o and thus:

\begin{align} K_{t} = N_{t}^{o}a_{t} = N_{t-1}^{y}a_{t} \end{align}

where $a_{t}$ is the end of period $t-1$ stock of assets of then-young agents, who in period $t$ are old.

Accordingly, the capital stock in period $t+1$ is equal to the end of period $t$ stock of assets of agents who are young in period $t$:

\begin{align} K_{t+1} = N_{t}^{y}a_{t+1} \end{align}

Let us compare the above expression with the already familiar capital accumulation equation:

\begin{align} K_{t+1} = I_{t} + \left(1-\delta\right)K_{t} = I_{t} \end{align}

where in the second equality the assumption of $\delta=1$ was used. This also implies that:

\begin{align} I_{t} = N_{t}^{y}a_{t+1} \end{align}

Goods market

The equilibrium in the goods market requires that supply of goods equals demand for goods, which in this model is equivalent to the national accounting identity:

\begin{align} Y_{t} = C_{t} + I_{t} + G_{t} + NX_{t} = C_{t} + I_{t} \end{align}

where, as in the previous lecture, we have assumed that there is no government ($G=0$) and that the economy is closed ($NX=0$).

The aggregate consumption is equal to the sum of consumption of young and old, and so:

\begin{align} Y_{t} = N_{t}^{y}c_{t}^{y} + N_{t}^{o}c_{t}^{o} + I_{t} \end{align}

We can show that equilibrium in the goods market is equivalent to equilibrium in both labor and capital markets (this was already guaranteed by Walras' law):

\begin{align} Y_{t} & =N_{t}^{y}c_{t}^{y}+N_{t}^{o}c_{t}^{o}+I_{t}\\ Y_{t} & =N_{t}^{y}c_{t}^{y}+N_{t}^{o}c_{t}^{o}+N_{t}^{y}a_{t+1}\\ Y_{t} & =N_{t}^{y}\left(c_{t}^{y}+a_{t+1}\right)+N_{t}^{o}\left(1+r_{t}\right)a_{t}\\ Y_{t} & =L_{t}w_{t}+\left(1+r_{t}\right)K_{t}\\ Y_{t} & =L_{t}\left(1-\alpha\right)\frac{Y_{t}}{L_{t}}+\left(1+r_{t}^{k}-\delta\right)K_{t}\\ Y_{t} & =\left(1-\alpha\right)Y_{t}+\alpha\frac{Y_{t}}{K_{t}}K_{t}\\ Y_{t} & =\left(1-\alpha\right)Y_{t}+\alpha Y_{t}\\ Y_{t} & =Y_{t} \end{align}

where the following expressions for the factor prices were used:

\begin{align} w_{t} & =\left(1-\alpha\right)\frac{Y_{t}}{L_{t}}\\ r_{t}^{k} & =\alpha\frac{Y_{t}}{K_{t}} \end{align}

Saving rate of the OLG economy

We can also derive the saving rate of this economy, and show that it is constant, just like in the Solow-Swan case. This model however will give us the link between the saving rate and households' preferences.

We already know that investment (equal to aggregate savings) is equal to:

\begin{align} I_{t} = N_{t}^{y}a_{t+1} \end{align}

And that the young households choose the end of period $t$ level of assets to be equal to:

\begin{align} a_{t+1}=\frac{\beta}{1+\beta}w_{t} \end{align}

Investment can be then expressed as:

\begin{align} I_{t} = L_{t}\cdot\frac{\beta}{1+\beta}w_{t}=L_{t}\cdot\frac{\beta}{1+\beta}\left(1-\alpha\right)\frac{Y_{t}}{L_{t}} = \left(1-\alpha\right)\frac{\beta}{1+\beta}\cdot Y_{t} \end{align}

So the ratio of investment to GDP (equivalent to the saving rate) is equal to:

\begin{align} s\equiv\frac{I_{t}}{Y_{t}}=\frac{\left(1-\alpha\right)\frac{\beta}{1+\beta}\cdot Y_{t}}{Y_{t}}=\left(1-\alpha\right)\frac{\beta}{1+\beta} \end{align}

As expected, the saving rate $s$ depends positively on households' discount factor $\beta$:

\begin{align} \frac{\partial s}{\partial\beta}=\left(1-\alpha\right)\frac{\left(1+\beta\right)-\beta}{\left(1+\beta\right)^{2}}=\frac{1-\alpha}{\left(1+\beta\right)^{2}}>0 \end{align}

The more patient the households are (the higher $\beta$ is), the higher the aggregate saving rate in an economy.

Capital accumulation over time

Just as in the Solow-Swan model, we will assume that technology $A$ grows at a rate $g$:

\begin{align} \frac{A_{t+1}}{A_{t}} = 1+g \quad \longrightarrow \quad g_{A} = \frac{\Delta A_{t+1}}{A_{t}} = g \end{align}

We can now describe the dynamic behavior of capital over time:

\begin{align} K_{t+1} = I_{t} + \left(1-\delta\right)K_{t} = I_{t} = sY_{t} \end{align}

where again the assumption of $\delta=1$ was used.

\begin{align} K_{t+1} & =sY_{t}\\ K_{t+1} & =sK_{t}^{\alpha}\left(A_{t}L_{t}\right)^{1-\alpha}\quad|\quad:A_{t}L_{t}\\ \frac{K_{t+1}}{A_{t}L_{t}} & =s\frac{K_{t}^{\alpha}}{\left(A_{t}L_{t}\right)^{\alpha}}\frac{\left(A_{t}L_{t}\right)^{1-\alpha}}{\left(A_{t}L_{t}\right)^{1-\alpha}}\\ \frac{L_{t+1}}{L_{t}}\frac{A_{t+1}}{A_{t}}\frac{K_{t+1}}{A_{t+1}L_{t+1}} & =s\hat{k}_{t}^{\alpha}\\ \left(1+n\right)\left(1+g\right)\hat{k}_{t+1} & =s\hat{k}_{t}^{\alpha} \end{align}

\begin{align} \hat{k}_{t+1}=\frac{s}{\left(1+n\right)\left(1+g\right)}\hat{k}_{t}^{\alpha} \end{align}

This forward equation in capital per effective labor $\hat{k}$ is identical to the Solow-Swan case, once we assume that $\delta=1$. We can also find the steady state level of capital per effective labor:

\begin{align} \hat{k}^{*} & =\frac{s}{\left(1+n\right)\left(1+g\right)}\left(\hat{k}^{*}\right)^{\alpha}\\ \left(\hat{k}^{*}\right)^{1-\alpha} & =\frac{s}{\left(1+n\right)\left(1+g\right)}\\ \hat{k}^{*} & =\left(\frac{s}{1+n+g+ng}\right)^{1/\left(1-\alpha\right)} \end{align}

This time I will not approximate $ng\approx 0$, since over the timespan of decades the product of population and technological growth is not trivial.

Let us plot the forward equation for capital per effective labor in the OLG model.

In [12]:
# Population and technology growth rates, note that the time period corresponds to 30 years
n = (1+0.01)**30 - 1
g = (1+0.02)**30 - 1

print('n*g =', n*g)

# Similarly, raise the annual discount factor to the power of 30
β = 0.95**30

# Share of capital in income
α = 0.33

# Resulting saving rate
s = (1-α) * β/(1+β)

# Capital per effective labor in the next period
def k_hat_next(k_hat):
    return s/(1+n+g+n*g) * k_hat**α

# Steady state level of capital per effective labor
k_hat_star = (s/(1+n+g+n*g))**(1/(1-α))

# Range of values for k_hat
kk = np.linspace(0, 1.5*k_hat_star, 1e3)
n*g = 0.2822312469731404
C:\Users\Marcin\Anaconda3\lib\site-packages\ipykernel_launcher.py:24: DeprecationWarning: object of type <class 'float'> cannot be safely interpreted as an integer.
In [13]:
# Plot dynamics of capital per effective labor in the OLG model

fig, ax = plt.subplots(figsize=(5, 5))

ax.plot(kk, k_hat_next(kk), lw=2)
ax.plot(kk, kk, lw=2)

ax.hlines(k_hat_star, 0, k_hat_star, lw=1, linestyle='dashed')
ax.vlines(k_hat_star, 0, k_hat_star, lw=1, linestyle='dashed')

NiceFigs(fig, ax)

xmin, xmax = ax.get_xlim()
ymin, ymax = ax.get_ylim()

plt.xticks((0, k_hat_star, xmax), ('0', '$\hat{k}^{*}$', '$\hat{k}_{t}$'), fontsize=12)
plt.yticks((0, k_hat_star, ymax), ('', '$\hat{k}^{*}$', '$\hat{k}_{t+1}$'), fontsize=12)

plt.title('Dynamics of capital per effective labor')

plt.show()
In [14]:
# Plot dynamics of capital per effective labor in the OLG model

fig, ax = plt.subplots(figsize=(5, 5))

ax.plot(kk, (k_hat_next(kk)-kk)/kk, lw=2)

ax.set_ylim(-1, 5)

NiceFigs(fig, ax, northeast=False)

xmin, xmax = ax.get_xlim()
ymin, ymax = ax.get_ylim()

ax.text(k_hat_star, -0.2, '$\hat{k}^{*}$', verticalalignment='top', fontsize=12)
ax.text(xmax, -0.2, '$\hat{k}_{t}$', va='top', ha='center', fontsize=12)

plt.xticks((0, xmax), ('', ''), fontsize=12)
plt.yticks((0, ymax), ('0', '$g_{k}$'), fontsize=12)

plt.title('Growth rates of capital per effective labor')

plt.show()
C:\Users\Marcin\Anaconda3\lib\site-packages\ipykernel_launcher.py:5: RuntimeWarning: invalid value encountered in true_divide
  """

Dynamic inefficiency and pension systems

As in the Solow-Swan model, also in the OLG model there is a possibility that households save inefficiently too much. Recall that for the Cobb-Douglas production function the golden rule saving rate is equal to $\alpha$:

\begin{align} s_{GR} = \alpha \end{align}

and if the economy's saving rate is higher than $s_{GR}$, the economy is dynamically inefficeint.

In our OLG model, the saving rate is given by:

\begin{align} s = \left(1-\alpha\right)\frac{\beta}{1+\beta} \end{align}

Therefore, for the OLG economy to be dynamically inefficient, the following has to hold:

\begin{align} \left(1-\alpha\right)\frac{\beta}{1+\beta} > \alpha \end{align}

After a bit of tedious algebra, we can rewrite the above condition as:

\begin{align} \beta >\frac{\alpha}{1-2\alpha} \end{align}

If we assume that $\alpha=0.3$, then the condition is equivalent to $\beta>0.75$, which is quite possible for "patient" societies.

One of the possible ways to escape the dynamic inefficiency is to introduce a pay-as-you-go retirement system. On one hand, the retirement system gives the old some additional income, which decreases asset accumulation. On the other, the retirement system requires funding through taxes, which lower the disposable income of the young and decreases asset accumulation.

There is an equivalent condition for dynamic inefficiency, which sometimes is easier to use. Whenever we observe that:

\begin{align} r < n + g \end{align}

then we know that the economy is dynamically inefficient. In such situation, the rent from a PAYGO pension system exceeds the real interest rate, and from the point of view of the households it is optimal to introduce such a system.

On the other hand, if we observe that:

\begin{align} r > n + g \end{align}

then the economy is dynamically efficient, and the PAYGO system actually lowers the welfare of the households. It would be better to switch from a PAYGO to a fully funded (FF) scheme, where the pension contributions are not paid to the old, but invested in assets. However, once a PAYGO system exists, changing it to a FF scheme is costly, and we might be "stuck" in a less efficient equilibrium. If you want to read more on these topics, check out my papers.

Lifecycle models

The two period OLG model has the advantage of being relatively simple, but it is also highly stylized and some questions are hard to answer within that framework.

We will now turn to solving models where people live for many periods. A common assumption in the economic literature is that people enter activity at age of 20 (0 in our python codes) and live at most 99 years (die for sure on their 100th birthday, J=80 in our codes). They will also face age-dependent mortality risk. We will also assume that they become retired at age 65 (JR=45 in our codes).

For simplicity, all working-age individuals supply 1 unit of labor, and retirees do not receive any pensions. Also, we will assume that the economy has converged to a steady state with no technology and population growth, so that both wage and the interest rate are time-independent and constant.

The problem of the youngest household can then be stated as follows:

\begin{align} \max\quad & U=\sum_{j=0}^{J-1}\beta^{j}\frac{N_{j}}{N_{0}}\cdot\log c_{j}\\ \text{subject to}\quad & c_{j}+a_{j+1}=w+\left(1+r\right)a_{j} &\text{for all }j<JR\\ & c_{j}+a_{j+1}=\left(1+r\right)a_{j} &\text{for all }j\geq JR\\ & a_{0} = a_{J} = 0 \end{align}

where $N_{j}/N_{0}$ represents the probability of surviving for at least $j$ years since "birth".

The problem can be solved using the Lagrangian. I present here the final solution:

\begin{align} lti & =\sum_{j=0}^{JR-1}\frac{w}{\left(1+r\right)^{j}}\\ disc & =\sum_{j=0}^{J-1}\left(\beta^{j}\frac{N_{j}}{N_{0}}\right)\\ c_{0} & =\frac{lti}{disc}\\ c_{j+1} & =\beta\frac{N_{j+1}}{N_{j}}\left(1+r\right)c_{j} \end{align}

where $lti$ is the PDV of lifetime income and $disc$ is the sum of effective discount factors from the perspective of age $j=0$. As you can see, the last equation is an Euler equation, modified to account for mortality risk.

Let us plot the resulting lifecycle profiles for consumption, labor income and the stock of assets below.

In [15]:
J  = 80
JR = 45

β = 0.96

w = 1
r = 0.05

mort = np.zeros(J)
surv = np.zeros(J)

for j in range(J):
    mort[j] = min(np.exp(-6.7374 + 0.0345*j + 0.0011*j**2 - 8e-06*j**3), 1-1e-2)

surv[0] = 1
for j in range(J-1):
    surv[j+1] = (1-mort[j])*surv[j]
    
plt.plot(np.arange(20, 100), surv, lw=2)
plt.title('Probability of survival from age 20')
plt.xlabel('Age')
plt.show()

lti = 0
for j in range(JR-1):
    lti += w/(1+r)**j

disc = 0
for j in range(J-1):
    disc += surv[j]*β**j
In [16]:
c = np.zeros(J)
h = np.zeros(J)
a = np.zeros(J)

h[:JR-1] = 1

c[0] = lti/disc
a[0] = 0

for j in range(J-1):
    c[j+1] = β*(1-mort[j])*(1+r)*c[j]
    a[j+1] = w*h[j] + (1+r)*a[j] - c[j]

plt.plot(np.arange(20, 100), c, lw=2)
plt.title('Consumption over the lifecycle')
plt.xlabel('Age')
plt.show()

plt.plot(np.arange(20, 100), w*h, lw=2)
plt.ylim(0, 1.2)
plt.title('Labor income over the lifecycle')
plt.xlabel('Age')
plt.show()

plt.plot(np.arange(20, 100), a, lw=2)
plt.title('Assets over the lifecycle')
plt.xlabel('Age')
plt.show()

In the above model, consumption of the elderly falls rapidly, as it is quite unlikely to live for so long. This illustrates another role of pension systems as insurance against long life.

At this stage however the model is only in Partial Equilibrium, as the households solve only their own problem given factor prices. But we know that the prices depend on capital, which in turn depends on the stock of assets of households! Therefore, we will set up a General Equilibrium environment and solve jointly for prices and households' choices.

In [17]:
# Additional parameters
α = 0.33
δ = 0.1

# Capital per worker demanded by firms for a given real interest rate
def CapitalDemand(r):
    return (α/(r+δ))**(1/(1-α))

# Wage in General Equilibrium
def Wage(r):
    return (1-α) * CapitalDemand(r)**α

# Household's proble solution
def HouseholdProblem(r):
    w = Wage(r)
    
    c = np.zeros(J)
    h = np.zeros(J)
    a = np.zeros(J)

    h[:JR-1] = 1
    
    lti = 0
    for j in range(JR-1):
        lti += w/(1+r)**j

    disc = 0
    for j in range(J-1):
        disc += surv[j]*β**j
        
    c[0] = lti/disc
    a[0] = 0

    for j in range(J-1):
        c[j+1] = β*(1-mort[j])*(1+r)*c[j]
        a[j+1] = w*h[j] + (1+r)*a[j] - c[j]
        
    return c, h, a

# Vectorization allows to pass an array of values for arguments
HouseholdProblem = np.vectorize(HouseholdProblem)

# Households' decisions determine the aggregate capital supply
def CapitalSupply(r):
    c = np.zeros(J)
    h = np.zeros(J)
    a = np.zeros(J)
    
    c, h, a = HouseholdProblem(r)

    K = sum(a*surv)
    H = sum(h*surv)
    return K/H

CapitalSupply = np.vectorize(CapitalSupply)

# Excess demand (squared) function, we will minimize this function
def CapitalExcessDemand(r):
    return (CapitalDemand(r) - CapitalSupply(r))**2
In [18]:
# Range of plausible annual real interest rates
rr = np.linspace(0, 0.1)

# Plot capital supply and demand curves
plt.plot(CapitalSupply(rr), rr, lw=2)
plt.plot(CapitalDemand(rr), rr, lw=2)
plt.show()

# Plot excess demand (squared) function to see where it has a root
plt.plot(rr, CapitalExcessDemand(rr), lw=2)
plt.show()
In [19]:
# Import bounded minimization function
from scipy.optimize import fminbound

# Find the minimum of excess demand (squared) function
result = fminbound(CapitalExcessDemand, 0, 0.1, full_output=1)
print(result)
(0.04240795915224549, 1.914004308774482e-10, 0, 8)
In [20]:
r_GE = result[0]
w_GE = Wage(r_GE)

c, h, a = HouseholdProblem(r_GE)

plt.plot(np.arange(20, 100), c, lw=2)
plt.title('Consumption over the lifecycle')
plt.xlabel('Age')
plt.show()

plt.plot(np.arange(20, 100), w*h, lw=2)
plt.ylim(0, 1.2)
plt.title('Labor income over the lifecycle')
plt.xlabel('Age')
plt.show()

plt.plot(np.arange(20, 100), a, lw=2)
plt.title('Assets over the lifecycle')
plt.xlabel('Age')
plt.show()
In [21]:
k = CapitalSupply(r_GE)
y = k**α
i = δ*k

print('Real interest rate = {:.2f} %'.format(100*r_GE))
print('Investment rate    = {:.2f} %'.format(100*i/y))
Real interest rate = 4.24 %
Investment rate    = 23.17 %

Life expectancy vs saving rates

Both theoretical and empirical evidence suggest that when life expectancy increases (survival probability increases), households will save a bigger portion of their income.

Below you can see graphs of the relationship between the survival probability and national saving rate for several countries:

OLG Saving vs Survival

Source: Kinugasa and Mason (2007) Why Countries Become Wealthy: The Effects of Adult Longevity on Saving

We can also see a similar pattern in a cross-section of countries, where in countries with higher life expectancy people seem to be more "patient". Below you can see the results of field experiments, where actual people were asked to choose between getting an amount of money now vs a bigger amount in a month time. The graph shows the proportion of people who chose to wait, binned by country groups:

OLG Proportion of people waiting

Source: Wang et al. (2016) How time preferences differ: Evidence from 53 countries

Homework: impact of ageing

Investigate how an increase in survival probabilities will impact the real interest rate and saving/investment rate in General Equilibrium.

In the previous codes I have used the mortality pattern from the 1950s in the US. The new mortality pattern is from the 2015 in the US.

In [22]:
mort_2015 = np.zeros(J)
surv_2015 = np.zeros(J)

for j in range(J):
    mort_2015[j] = min(np.exp(-7.3432 + 0.023*j + 0.0013*j**2 - 7e-06*j**3), 1-1e-2)

surv_2015[0] = 1
for j in range(J-1):
    surv_2015[j+1] = (1-mort_2015[j])*surv_2015[j]
    
plt.plot(np.arange(20, 100), surv_2015, lw=2)
plt.title('Probability of survival from age 20')
plt.xlabel('Age')
plt.show()

Task 1: Find the new level of real interest rate in General Equilibrium. Remember to update the relevant functions, as now the mortality pattern is different. Comment on whether the new level of interest rates is higher or lower than for the previous mortality profile.

Task 2: Plot the resulting lifecycle patterns of the consumer.

Task 3: Find the new investment/saving rate. Is it higher or lower than for the previous mortality profile?

In [23]:
# Your codes