楼主: Glora
3877 12

[DSGE模型初级教程] 课程学习中的疑问 [推广有奖]

11
Glora 发表于 2016-3-18 09:14:11 |只看作者 |坛友微信交流群
ahnulxy 发表于 2016-3-17 20:25
请贴出来代码,或上传mod文件。我记得我也碰到过类似的问题。但要具体问题具体对待
老师,我把文件名修改了一下,它就正常运行了
辛苦老师,感谢您的回答。

使用道具

12
Glora 发表于 2016-3-18 11:27:49 |只看作者 |坛友微信交流群
ahnulxy 发表于 2016-3-17 20:49
方程10是根据粘性价格的设定机制给出的,我没有在notes中写出了,但非常类似于粘性价格的设定。因为工资是 ...
老师,c_t^θ这种形式表示为log-level形式怎么表示呢是exp(θ*c)还是exp(c)^θ,在A simple model中用的是后和中形式,在第四章里用的是前一种形式,A simple model这一节的换为前一种形式会显示没有稳态解?应该是用哪一种呢?
var y c k i lab z;
varexo e;

parameters bet the del alp tau rho s;

bet     = 0.987;
the     = 0.357;
del     = 0.012;
alp     = 0.4;
tau     = 2;
rho     = 0.95;
s       = 0.007;

model;

%(1) Euler equation
(exp(the*c)*(1-exp(lab))^(1-the))^(1-tau)/exp(c)=bet*(exp(z(+1))*exp((1-alp)*lab(+1))*alp*exp((alp-1)*k+1-del))*(exp(the*c(+1))*(1-exp(lab(+1)))^(1-the))^(1-tau)/exp(c(+1));

%(2) wage equation
exp(c)=the/(1-the)*(1-alp)*exp(z)*exp(alp*k(-1))*exp((-alp)*lab)*(1-exp(lab));

%(3) capital accumulation equation
exp(k)=exp(i)+(1-del)*exp(k(-1));

%(4) the production technology
exp(y)=exp(z)*exp(alp*k(-1))*exp((1-alp)*lab);

%(5) the resource constraint
exp(y)=exp(c)+exp(i);

%(6)the technology shock
z=rho*z(-1)+e;
end;

initval;
k   = log(29.71828);
c   = log(1.4);
lab = log(0.3);
z   = log(1);
e   = log(1);
end;

steady;
check;

shocks;
var e=s^2;
end;



%if periods not specify, there will be no simulations.
stoch_simul(periods=1000,irf=40,order=1)
显示结果:
Residuals of the static equations:

Equation number 1 : 0.39325
Equation number 2 : -0.0024444
Equation number 3 : -0.19418
Equation number 4 : -0.32792
Equation number 5 : -0.65768
Equation number 6 : 0


Error using print_info (line 74)
Impossible to find the steady state. 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
Error in steady (line 92)
    print_info(info,options_.noprint, options_);
Error in example3 (line 136)
steady;
Error in dynare (line 180)
evalin('base',fname) ;

使用道具

13
ahnulxy 发表于 2016-3-18 23:05:57 |只看作者 |坛友微信交流群
你好,Glora! 关于你提出的问题,事实上二者是等价的,只不过是不同的写法: exp(θ*c)=exp(c)^θ; 这两种形式无论怎么写都不会影响最终的计算和求解,之所以你不能求解是因为你的初始值和代码中有差异,你仔细看看就会发现差异。初始值很重要。如果你不确定如何赋给初始值,你可以自己求出模型的变量的稳态值,然后把稳态值赋予给变量当作初始值,这样效率最高,dynare根本无需计算即可找到稳态值。这种方法也是常有的方法。
c   = log(exp(1.4));
lab = log(exp(0.3));

使用道具

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注jltj
拉您入交流群

京ICP备16021002-2号 京B2-20170662号 京公网安备 11010802022788号 论坛法律顾问:王进律师 知识产权保护声明   免责及隐私声明

GMT+8, 2024-4-19 23:46