# Questions to find steady states

Dear Professor Johannes Pfeifer,

Thank you very much for being here to help us to solve the problems with dynare coding! I am trying a quite complex DSGE model in dynare and to solve the steady states manually seems very difficult. I am wondering whether it is possible for dynare to automatically compute steady states of variables?

I tried to run this model with the following codes. The results said “Impossible to find the steady state (the sum of square residuals of the static equations is 221088534913.4797). Either the model doesn’t have a steady state, there are an infinity of steady states, or the guess values are too far from the solution.”

I am wondering whether it is possible to ask dynare to automatically figure out the steady states of the model, if only writing the equation system of the model.

I have tried " _steadystate_helper", but it still requires the information for the steady state of that variable. Besides, it can only solve the steady state of some variables, and we cannot leave all the variables for " _steadystate_helper" to find steady states?

I also tried “initval”, but ideally the value input in this block should be the value of steady states for each variable, right? If I just randomly give the value in “initval”, it does not work.

My current model is quite complex, and I am wondering whether dynare can help us fully solve steady states automatically? Any guidance and help would be much appreciated.

``````var  gk, gzc, gzk, gtfp, muc, muk, Psi, pi, k, psic, psik, nc, nk, y, c, pk, yk, g, sk, hk, zk, ak, sc, hc, zc, ac, mk, yc, mc, pmk, pmc, w, lk, lc, l, d, kc, kk,  U, lamc, lamk,  jc, jk, vc, vk, Pim_c, Pim_k, del_U, r;

varexo muw;

parameters bet,al,bb,g_y,del,eta,u,phi,chic,chik,theta,rho,lam,bk,bc,gpk,gy;
bet = 0.95;
al  = 1/3;        % k share
bb  = 0.5;        % intermediate share in final output
g_y = 0.2;
del = 0.08; 	     % 0.08*U, depreciation rate is increasing in capital utilization rate (assuming a linear function)

eta    = 1;
u      = 0.8;        %  capital utilization rate is 0.8
phi    = 0.97;       %  annual survival probability of new tech
chic   = 0.33;
chik   = 0.33;
theta  = 1/0.6;
rho    = 0.9;        % parameter embodied technology
lam    = 0.1;
bk      = 0.005;      % operating cost ratio. not sure about this parameter value and assume it as 0.005
bc      = 0.006;      % operating cost ratio. not sure about this parameter value and assume it as 0.006
%fi     = 1;          % labor supply curvature
gpk    = -0.026;
gy     =  0.024;

model;

gk     =  gy - gpk;
gzc    = (gy-al*gk)/bb*(1-bb)/(theta-1);
gzk    = (gpk-gzc*bb*(theta-1))/(bb*(1-theta));
gtfp   =  gy-al*gk+gzk*(al*bb*(theta-1))/(1-al*(1-bb));

muc=(1/nc)^0.15+0.12;                    % the relationship between markup and the number of final goods firms in the market, the elasticity is set as 0.15 given by the paper, and constant is set as 0.12
muk=(1/nk)^0.15+0.12;
Psi=pi*k;
psic=bc*Psi*nc^(muc);
psik=bk*Psi*nk^(muk);

y=c+pk*yk+g+sk+hk*(zk-ak)+sc+hc*(zc-ac);
y=pk*yk-(ak)^(1-theta)*mk-psik+yc-(ac)^(1-theta)*mc-psic; % the relationship between markup and the number of final goods firms in the market, the elasticity is set as 0.15 given by the paper, and constant is set as 0.12

bc*Psi=(muc-1)/muc*nc^(-muc)*yc;
bk*Psi=(muk-1)/muk*nk^(-muk)*yk;

yk=nk^(muk-1)*((u*k/l)^(al)*lk)^(1-bb)*mk^(bb);
yc=nc^(muc-1)*((u*k/l)^(al)*lc)^(1-bb)*mc^(bb);
k(+1)=(1-del*u)*k+yk;
k=kk+kc;

pk=(muk/muc)*(nk^(1-muk)/nc^(1-muc))*pi;
pi=(ak/ac)^((1-theta)*bb);
%pi=(pmk/pmc)^(bb);

w=(1-al)*(1-bb)*pk*yk/(muk*lk);
w=muw*(lc+lk)^eta*c;

d+(1-del*u)*pk=al*(1-bb)*yc/(muc*kc);
d+(1-del*u)*pk=al*(1-bb)*yk*pk/(muk*kk);

pmc=bb*yc/(muc*mc);
pmk=bb*pk*yk/(muk*mk);
pmc=theta*ac^(1-theta);
pmk=theta*ak^(1-theta);

k/l=al*w/((1-al)*(d+(1-del*U)*pk));
%kc/lc=k/l;
%kk/lk=k/l;

%U=u*k;
del_U=del*U;
U=(del_U-1)/del-d/(pk*del);

1/c=bet/c(+1)*(d+pk(+1)*(1-del_U))/pk;
r(+1)/c(+1)=bet/c(+1)*(d+pk(+1)*(1-del_U))/pk;

zc(+1)/zc=chic*(sc/Psi)^rho+phi;
zk(+1)/zk=chik*(sk/Psi)^rho+phi;

lamc=(ac*hc^0.9)/Psi;                %lam function according to the elasticity of h to lam---partial log lam/ partial log h=0.9
lamk=(ak*hk^0.9)/Psi;                %lam function according to the elasticity of h to lam---partial log lam/ partial log h=0.9
ac(+1)/ac=lamc*phi*(zc/ac-1)+phi;
ak(+1)/ak=lamk*phi*(zk/ak-1)+phi;

sc=phi*jc(+1)*(zc(+1)-phi*zc)/r(+1);
sk=phi*jk(+1)*(zk(+1)-phi*zk)/r(+1);

jc=-hc+phi/r(+1)*(lamc*vc(+1)+(1-lamc)*jc(+1));
jk=-hk+phi/r(+1)*(lamk*vk(+1)+(1-lamk)*jk(+1));

vc=Pim_c+phi*vc(+1);
vk=Pim_k+phi*vk(+1);

ac/Psi*(0.9*ac*hc^(-0.1)/Psi)*phi*(vc(+1)-jc(+1))=1;
ak/Psi*(0.9*ak*hk^(-0.1)/Psi)*phi*(vk(+1)-jk(+1))=1;

Pim_c=(1-1/theta)*(bb*yc)/(muc*ac);
Pim_k=(1-1/theta)*(bb*pk*yk)/(muk*ak);

muw = 0.6*muw(-1)+ 0.01;          % muw shock with autocorrelation 0.6
end;

initval;
c=0;
yc=0;
yk=0;
y=0;
sc=0;
sk=0;
hc=0;
hk=0;
mc=0;
mk=0;
kk=0;
kc=0;
lk=0;
lc=0;
zk=0;
zc=0;
ak=0;
ac=0;
muw=0;

end;