# OLG model help, cant get steady state

Hello, my model can’t seem to find the steady state, any advice/assistance?

``````//OLG code//

var y r w C c1 c2 s k check1 check2 G SU;

parameters alpha beta delta rho theta n T ty tr ts x;

T = 40;
rho = 0.03;
beta = (1 - rho)^T;
n = (1 + 0.02)^T - 1;
alpha = 0.33;
delta = 1 - (1 - 0.10)^T;
theta = 1.0;
ty = 0.40;
tr = 0.15;
ts = 0.15;
x = 0.09;

kss = 1.0;
yss = (1 / (1 + n))^alpha * kss^alpha;
wss = (1 - alpha) * yss;
rss = alpha * (1 /(1 + n))^(alpha - 1) * kss^(alpha - 1) - delta;
sss = (((1 - ty - x)*wss*(beta^(1/theta))*((1 +(1-ty)*rss )^(1/theta)) - (1 + (1 - tr)*rss)*x*wss*(1 - ts))) / ((beta^(1/theta))*((1 +(1-ty)*rss)^(1/theta)) + 1 + (1 - ty)*rss);
c1ss = (1 - ty - x)*wss - sss;
c2ss = (1 + (1 - ty)*rss) * sss + (1 + (1 - tr)*rss) * (x * (1 - ts)*wss);
Css = c1ss + (1 / (1 + n)) * c2ss;
SUss = (1 + (1 - tr)*rss) * (x * (1 - ts)*wss);

//model//
model;

y = (1 /(1 + n))^alpha * k(-1)^alpha;
r = alpha * (1 / (1 + n))^(alpha - 1) * k(-1)^(alpha - 1) - delta;
w = (1 - alpha) * y;
c1 = w*(1 - ty - x) - s;
c2 = (1 + (1 - ty)*r) * s + (1 + (1 - tr)*r)*((1 - ts)* x * w);
s = (((1 - ty - x)*w*(beta^(1/theta))*((1 +(1 - ty)*r )^(1/theta))) - ((1 + (1 - tr)*r)*x*w*(1 - ts))) / ((beta^(1/theta))*((1 +(1-ty)*r)^(1/theta)) + 1 + (1 - ty)*r);
C = c1 + (1 / (1 + n)) * c2;
k = ((1 - delta) / (1 + n)) * k(-1) + s;
check1 = y - (1 /(1 + n)) * (r + delta) * k(-1) - w;
check2 = c1^(-theta) - beta  * (1 + r(+1)) * c2^(-theta);
G = ty*w + ty*r*s + tr*r*x*w + ts*r*x*w;
SU = (1 + (1 - tr)*r) * (x * (1 - ts)*w);

end;

initval;
k = kss;
c1 = c1ss;
c2 = c2ss;
w = wss;
s = sss;
C = Css;
y = yss;
G = Gss;
SU = SUss;
end;

check;
``````

my model has a utility function of U = max u(c1) + Bu(c2) where u c = (c ^(1-theta) -1)/(1 - theta)

and the period budget constraints are c1 = (1 - ty - x)w - s
and c2 = (1 + (1 - t_y)rt+1)s + (1 + (1 - tr)r)(xw(1 - t_s))

with a production function Y = K^(alpha) * N^(1 - alpha)

Increase the number of iterations.

``````//OLG code//

var y r w C c1 c2 s k check1 check2 G SU;

parameters alpha beta delta rho theta n T ty tr ts x;

T = 40;
rho = 0.03;
beta = (1 - rho)^T;
n = (1 + 0.02)^T - 1;
alpha = 0.33;
delta = 1 - (1 - 0.10)^T;
theta = 1.0;
ty = 0.40;
tr = 0.15;
ts = 0.15;
x = 0.09;

kss = 1.0;
yss = (1 / (1 + n))^alpha * kss^alpha;
wss = (1 - alpha) * yss;
rss = alpha * (1 /(1 + n))^(alpha - 1) * kss^(alpha - 1) - delta;
sss = (((1 - ty - x)*wss*(beta^(1/theta))*((1 +(1-ty)*rss )^(1/theta)) - (1 + (1 - tr)*rss)*x*wss*(1 - ts))) / ((beta^(1/theta))*((1 +(1-ty)*rss)^(1/theta)) + 1 + (1 - ty)*rss);
c1ss = (1 - ty - x)*wss - sss;
c2ss = (1 + (1 - ty)*rss) * sss + (1 + (1 - tr)*rss) * (x * (1 - ts)*wss);
Css = c1ss + (1 / (1 + n)) * c2ss;
SUss = (1 + (1 - tr)*rss) * (x * (1 - ts)*wss);

//model//
model;

y = (1 /(1 + n))^alpha * k(-1)^alpha;
r = alpha * (1 / (1 + n))^(alpha - 1) * k(-1)^(alpha - 1) - delta;
w = (1 - alpha) * y;
c1 = w*(1 - ty - x) - s;
c2 = (1 + (1 - ty)*r) * s + (1 + (1 - tr)*r)*((1 - ts)* x * w);
s = (((1 - ty - x)*w*(beta^(1/theta))*((1 +(1 - ty)*r )^(1/theta))) - ((1 + (1 - tr)*r)*x*w*(1 - ts))) / ((beta^(1/theta))*((1 +(1-ty)*r)^(1/theta)) + 1 + (1 - ty)*r);
C = c1 + (1 / (1 + n)) * c2;
k = ((1 - delta) / (1 + n)) * k(-1) + s;
check1 = y - (1 /(1 + n)) * (r + delta) * k(-1) - w;
check2 = c1^(-theta) - beta  * (1 + r(+1)) * c2^(-theta);
G = ty*w + ty*r*s + tr*r*x*w + ts*r*x*w;
SU = (1 + (1 - tr)*r) * (x * (1 - ts)*w);

end;

initval;
k = kss;
c1 = c1ss;
c2 = c2ss;
w = wss;
s = sss;
C = Css;
y = yss;
G = Gss;
SU = SUss;
end;
resid;