 # Overlapping Generations Model (OLG)

#1

Hi guys,

I’ve just started using matlab and dynare.

anyone has a code for a simple deterministic OLG model? I can only find Ramsey ones.

Thank You very much.

Charlie.

Basic OLG example
#2

Hey,

I noticed that here’s very little OLG related material. So here’s a basic 2 cohort Diamond-Samuelsson.

// Basic OLG with population growth and technological growth
var c c1 c2 k w r s y check1 check2;

parameters beta alpha delta n x;
beta = 0.4010; // 0.97^30
alpha = 1/3; delta = 0.9; n=0.1614; x=0.3478;

kss = ((1+1/beta)*(1+n)/(1-alpha))^(1/(alpha-1));
wss = (1-alpha)kss^alpha; rss = alphakss^(alpha-1)-delta;
sss = (1+n)*kss; c1ss = sss/beta; c2ss = (1+rss)*sss;
yss = kss^alpha; css = c1ss+c2ss/(1+n);

model;
// In effective labour form
1/c1 = beta*(1+r(+1))/c2(+1);
c1 + s = w;
c2(+1) = (1+r(+1))s;
y = k(-1)^alpha; // Y/XL = (K/XL)^alpha
w = (1-alpha)k(-1)^alpha;
r = alpha
k(-1)^(alpha-1) - delta;
c = c1 + c2/(1+n+x); // C = X
L*c1 + X(-1)*L(-1)*C2;
// ECNOMY WIDE FEASIBILITY CONSTRAINT
y = (1+n+x)*k - (1-delta)*k(-1) + c;
check1 = y -( (1+n+x)*k - (1-delta)*k(-1) + c);
check2 = (1+n+x)*k - s;
end;

initval;
k = kss; c1 = c1ss; c2 = c2ss; r=rss; w=wss; s=sss; c=css; y = yss;
end;

#3

Hi there,

Thanks a lot for this post. I have a problem, though. If I try to save the results in a “mat” file by using this command
dynasave (OLGResults) w c1 s c2 r k c y;

I get this error message

Error using horzcat
CAT arguments dimensions are not consistent.

I have found out that the problem is caused by variable “s”; i.e. if I use the command
dynasave (OLGResults) w c1 c2 r k c y; // excluding “s”

it works fine.

However, in the former case (when I get the error) if I open the oo_.endo_simul file, the variable “s” is there, with the same (!) number of observations as the other endogenous variables.

Does any one have an idea of what is going on? What am I doing wrong?

Any help would be appreciated.

Best,
jepecolc

#4

hello, what utility function did you use for the model?

#5

This one was \log(c)