-
Notifications
You must be signed in to change notification settings - Fork 84
OLG Models
Notes on solving and simulating over-lapping generations (OLG) models using a combination of Python, Octave, and Dynare.
This section contains fairly detailed notes on constructing a Dynare model file based on the original Diamond (1965) OLG model with production. The actual Dynare model file as well as complete derivations of the equations of the model can be found here.
///// Declare variables /////
var y r w c c1 c2 s k check1 check2;
///// Declare parameter values /////
parameters alpha beta delta rho theta n g T;
After declaring parameters, we need to provide values for each of them:
// length of time period
T = 30;
// discount rate
rho = 0.03;
// discount factor
beta = (1 - rho)^T;
// population growth rate
n = (1 + 0.02)^T - 1;
// technology growth rate
g = (1 + 0.02)^T - 1;
// capital's share of output
alpha = 0.33;
// depreciation rate
delta = 1 - (1 - 0.10)^T;
// inverse elasticity of inter-temporal substitution
theta = 1.0;
Next we define some starting values which will help Dynare to find the steady state of the economy numerically. Since there is no general analytic expression for the steady state value of capital per effective worker, we can just specify some starting value. Note that the rest of the starting values are defined in order to be consistent with our initial guess for the steady state value of capital per effective worker.
///// Steady state values /////
// capital per effective worker
kss = 1.0;
// output per effective worker
yss = (1 / ((1 + g) * (1 + n)))^alpha * kss^alpha;
// real wage
wss = (1 - alpha) * yss;
// net interest rate
rss = alpha * (1 / ((1 + g) * (1 + n)))^(alpha - 1) * kss^(alpha - 1) - delta;
// savings
sss = wss / (1 + beta^(- 1 / theta) * (1 + rss - delta)^((theta - 1) / theta));
// consumption of the young cohort
c1ss = wss - sss;
// consumption of the old cohort
c2ss = (1 / (1 + g)) * (1 + rss) * sss;
// consumption per effective worker
css = c1ss + (1 / (1 + n)) * c2ss;
In this section of the model file, we define a system of non-linear equations that describe the behavior of the economy in the model. Note that the Dynare keyword model;
is used to demarcate the start of the section, whilst the Dynare keyword end;
is used to demarcate the end of the section.
///// The model /////
model;
// Cobb-Douglas production technology
y = (1 / ((1 + g) * (1 + n)))^alpha * k(-1)^alpha;
// capital is paid its net marginal product
r = alpha * (1 / ((1 + n) * (1 + g)))^(alpha - 1) * k(-1)^(alpha - 1) - delta;
// labor is paid its marginal product
w = (1 - alpha) * y;
// period 1 flow of funds constraint (young spend their wages)
c1 + s = w;
// period 2 flow of funds constraint (old spend their savings)
c2 = (1 / (1 + g)) * (1 + r) * s;
// savings function
s = w / (1 + beta^(-1 / theta) * (1 + r(+1))^((theta - 1) / theta));
// aggregate consumption is the sum of consumption of both cohorts
c = c1 + (1 / (1 + n)) * c2;
// equation of motion for capital per effective worker
k = ((1 - delta) / ((1 + n) * (1 + g))) * k(-1) + s;
// check that zero profit condition is satisfied
check1 = y - (1 / ((1 + g) * (1 + n))) * (r + delta) * k(-1) - w;
// check that consumption Euler equation holds
check2 = c1^(-theta) - beta * (1 + g)^(-theta) * (1 + r(+1)) * c2^(-theta);
end;
This section officially declares the starting conditions the Dynare is to use to find the steady state of the economy.
///// Declare initial values /////
initval;
k = kss;
c1 = c1ss;
c2 = c2ss;
r = rss;
w = wss;
s = sss;
c = css;
y = yss;
end;
Basic description of commands typically used to analyse a deterministic model in Dynare. See the Dynare user manual for more detailed description of these commands.
###steady
This command computes the steady state of a model using a non-linear Newton-type solver and displays it.
///// Compute steady state values /////
steady;
###check
Computes the eigenvalues of the model linearised around the values specified by the last initval
, endval
or steady
statement. Generally, the eigenvalues are only meaningful if the linearisation is done around a steady state of the model. It is a device for local analysis in the neighbourhood of this steady state. A necessary condition for the uniqueness of a stable equilibrium in the neighbourhood of the steady state is that there are as many eigenvalues larger than one in modulus as there are forward looking variables in the system. An additional rank condition requires that the square submatrix of the right Schur vectors corresponding to the forward looking variables (jumpers) and to the explosive eigenvalues must have full rank.
///// Computes the eigenvalues of the linearized model /////
check;
Basic extension of the Diamond OLG model with production to include two different forms of government run social insurance programs.
-
"Pay-as-you-go" social security: Suppose that the government taxes each young individual an amount
$T$ and uses the proceeds to pay benefits to old individuals (with population growth each old person receives$(1 + n)T$ . -
Fully funded social security: Suppose that the government taxes each young person an amount
$T$ and uses the proceeds to purchase capital. Individuals born at period$t$ therefore receive an amount$(1 + r_{t+1})T$ when they are old.
-
Excel spreadsheet that simulates basic OLG model with production Spreadsheet has a
goalseek
macro embedded so that it can cope with cases where the coefficient of relative risk aversion is not equal to one (i.e. general non-logarithmic utility). This essentially implements rational expectations by setting expectations on next period's interest rate equal to the realised next period interest rate conditional on the amount saved. We do not need this procedure with logarithmic utility since the expected interest rate falls out of the savings function in this case. -
Complete derivations old frozen link [Complete derivations dynamic link] (https://www.dropbox.com/s/l5b6990nda92p0w/OLG.pdf), [Timing picture] (https://www.dropbox.com/s/w9unqyxz73xbinm/timing.png), and model file by David Comerford for the Diamond OLG model with production using slightly different timing assumptions than those discussed above.
-
David de la Croix has the codes for replicating some of his papers on his blog. The last one on this page is for the following paper: Income Growth in the 21st Century: Forecasts with an Overlapping Generations Model, International Journal of Forecasting, 23, 621-635, 2007 [with F. Docquier and P. Liegeois]
- Krueger and Kubler (2004), Computing equilibrium in OLG models with stochastic production