I have a problem to solve DSGE model in which some equations depend
on the steady state of endogenous variables. In parameter block, I declare
the steady state expressed in terms of parameters or equal to certain
values obtained by using "fsolve" in Matlab. However, it seems to me that it cannot work.
- Code: Select all
var ly lc lh ls lg lpih lw lr lrf lrg ld lb ltr ltb lq lgs a;
varexo nua nug;
varexo_det lcstar lpistar lrstar;
parameters beta alpha eta epsilon rho varphi theta gy psigg psitd psigd psitg rhoa chi lambda phi alphastar rrstar rr rrf rrg pihs pis tbs as lws ss qs gss ds bs lhs lggs lys lcs ltrs;
beta = 0.9;
alpha = 0.2;
eta = 2/3;
epsilon = 21;
rho = 1;
varphi = 1;
theta = 75;
gy = 0.2;
psigg = 0.9;
psitd = 0.02;
psigd = -0.02;
psitg = 0.5;
rhoa = 0.85;
chi = 0.00001;
lambda = 1/3;
phi = 1.5;
alphastar = alpha;
// Steady state expressed in terms of parameters
rrstar = 1/beta-1;
rr = 1/beta-1;
rrf = 1/beta-1;
rrg = 1/beta-1;
as = 0;
lws = log((epsilon-1)/epsilon);
pihs = 1;
pis = 1;
tbs = 0;
ss = 1;
qs = 1;
gss = 1;
ds = 0;
bs = 0;
hs = 1;
lggs = 0;
ys = 1;
cs = 1;
ltrs = 0;
Another question I have is about log-linearizing equations. If I want to express variables in percent deviation from steady state, could I use the form of exp(lc), where 'lc'
is log of C (level variable), in all equations? Does Dynare linearize them
for me then?
- Code: Select all
model(linear);
exp(ly) = exp(a+lh);
exp(ly) = (1-alpha)*exp(eta*lgs+lc)+exp(lg)+alphastar*exp(eta*(lq+lgs)+lcstar)+theta/2*((exp(lpih)-1)^2);
exp(lw) = exp(rho*lc+varphi*lh);
1 = beta*(1+exp(lr))*exp(-rho*(lc(+1)-lc)+lgs-lgs(+1)-lpih(+1));
1 = beta*(1+exp(lrf))*exp(-rho*(lc(+1)-lc)+lq(+1)-lq-lpistar(+1));
exp(lrf) = exp(lrstar)-chi*exp(ld-ly);
exp(lr) = exp(log(rr))+phi*(exp(lpih)-exp(log(pihs)));
exp(lpih)*(exp(lpih)-1) = beta*(exp(-rho*(lc(+1)-lc)+lgs-lgs(+1)+lpih(+1))*(exp(lpih(+1))-1))+epsilon/theta*exp(a+lh)*(exp(rho*lc+varphi*lh-a+lgs)-(epsilon-1)/epsilon);
exp(lb(-1)+lq-lq(-1)-lpistar)+exp(lg-lgs) = exp(ltr)+exp(lb)/(1+exp(lrg));
exp(lrg) = exp(lrstar)-chi*exp(lb-ly);
exp(ltb+ly) = exp(ly)-exp(lgs+lc)-exp(lg);
exp(lg) = (1-psigg)*exp(lggs)+psigg*exp(lg(-1))+psigd*exp(lb(-1))+nug;
exp(ltr) = exp((1-psitg)*lggs+psitg*(lg-lgs))+psitd*exp(lb);
a = rhoa*a(-1)+nua;
exp(lc)+exp(ld)/(1+exp(lrf)) = exp(ld+lq-lq(-1)-lpistar)-exp(ltr)+exp(ly-lgs)-theta/2*(((exp(lpih)-1)^2)/exp(lgs));
exp(lgs) = ((1-alpha)+alpha*exp((1-eta)*ls))^(1/(1-eta));
exp(lq) = exp(ls-lgs)*((1-alphastar)+alphastar*exp((eta-1)*ls))^(1/(1-eta));
end;
I will appreciate it a lot if someone can point out my mistake. Thank you.
The following is the error message I got:
Warning: Divide by zero.
> In lnsrch1 at 97
In solve1 at 127
In dynare_solve at 112
In steady_ at 124
In steady at 52
In dynamics2 at 284
In dynare at 132
Warning: Divide by zero.
> In lnsrch1 at 98
In solve1 at 127
In dynare_solve at 112
In steady_ at 124
In steady at 52
In dynamics2 at 284
In dynare at 132
SOLVE: maxit has been reached
??? Error using ==> steady_ at 132
STEADY: convergence problems
Error in ==> steady at 52
steady_;
Error in ==> dynamics2 at 284
steady;
Error in ==> dynare at 132
evalin('base',fname) ;