楼主: rastila
67315 187

[经济学模型] DSGE模型讨论之七——最简单的DSGE模型的Dynare模拟和MLE,Bayesian估计   [推广有奖]

21
wcxzcy 发表于 2012-4-9 12:25:26
这个帖子太好啦

22
kever133 发表于 2012-4-9 12:35:12
虽然不是很懂,但是感觉很厉害的样子

23
floydgyf 在职认证  发表于 2012-4-9 13:05:42
学习了!

24
floydgyf 在职认证  发表于 2012-4-9 13:07:03
请问可以申请读你的博士吗?

25
ksk5808 发表于 2012-4-9 13:45:20
看来高手还挺多。
haha

26
rastila 在职认证  发表于 2012-4-9 15:00:47
zhdefei 发表于 2012-4-9 10:37
自己编了一个mod,出现以下问题
There are 5 eigenvalue(s) larger than 1 in modulus
for 4 forward-lo ...
你能传mod上来么?

27
zhdefei 在职认证  发表于 2012-4-9 15:34:55
rastila 发表于 2012-4-9 15:00
你能传mod上来么?
出现以下错误信息:

There are 5 eigenvalue(s) larger than 1 in modulus
for 4 forward-looking variable(s)

The rank conditions ISN'T verified!

??? Error using ==> print_info at 40
Blanchard Kahn conditions are not satisfied: no stable equilibrium
Error in ==> stoch_simul at 71
    print_info(info, options_.noprint);
Error in ==> doctor at 264
info = stoch_simul(var_list_);
Error in ==> dynare at 120
evalin('base',fname) ;
努力就会有结果,要成功就得努力!!!

28
zhdefei 在职认证  发表于 2012-4-9 16:01:43
rastila 发表于 2012-4-9 15:00
你能传mod上来么?
运行出来的完整信息如下:
Configuring Dynare ...
[mex] Generalized QZ.
[mex] Sylvester equation solution.
[mex] Kronecker products.
[mex] Sparse kronecker products.
[mex] Bytecode evaluation.
[mex] k-order perturbation solver.
[mex] k-order solution simulation.

Starting Dynare (version 4.2.5).
Starting preprocessing of the model file ...
WARNING: doctor.mod:78.13-21: dr_algo option is now deprecated, and may be removed in a future version of Dynare
Found 18 equation(s).
Evaluating expressions...done
Computing static model derivatives:
- order 1
Computing dynamic model derivatives:
- order 1
- order 2
Processing outputs ...done
Preprocessing completed.
Starting MATLAB/Octave computing.


STEADY-STATE RESULTS:

c1                  0
c2                  0
y                   0
l1                  0
w1                  0
l2                  0
w2                  0
x                   0
b1                  0
b2                  0
h1                  0
h2                  0
pi                  0
r                   0
q                   0
A                   0
d                   0
er                  0

EIGENVALUES:
         Modulus             Real        Imaginary

      1.666e-016      -1.666e-016                0
             0.9              0.9                0
            0.95             0.95                0
            0.98             0.98                0
           1.007            1.007                0
           1.045            1.045                0
           1.202             1.18           0.2289
           1.202             1.18          -0.2289
           2.003            2.003                0


There are 5 eigenvalue(s) larger than 1 in modulus
for 4 forward-looking variable(s)

The rank conditions ISN'T verified!

??? Error using ==> print_info at 40
Blanchard Kahn conditions are not satisfied: no stable equilibrium

Error in ==> stoch_simul at 71
    print_info(info, options_.noprint);

Error in ==> doctor at 264
info = stoch_simul(var_list_);

Error in ==> dynare at 120
evalin('base',fname) ;
谢谢!
努力就会有结果,要成功就得努力!!!

29
rastila 在职认证  发表于 2012-4-9 16:24:20
zhdefei 发表于 2012-4-9 16:01
运行出来的完整信息如下:
Configuring Dynare ...
[mex] Generalized QZ.
你把下面的程序到.mod里,你自己跑一遍看。
var  c1 c2 y l1  w1  l2 w2 x b1 b2 h1 h2 pi r q A d ;
varexo espor ed ea er;
%predetermined_parameter q;

%%
parameters beta1 alpha xx rr m2 dd gmae hh1 eta beta2 theta c1toy c2toy qh1toy b2toy k b1toy qh2toy deta ruod ruoa ruor R;
alpha=0.64;
beta1=0.99;
dd=0.08;
xx=1.05;
rr=0.3;
hh1=0.1;
gmae=0.99;
eta=0.54;
beta2=0.98;
theta=0.75;
deta=0.7;
ruod=0.98;
ruoa=0.95;
ruor=0.9;
R=1/beta1;
m2=0.9;
b1toy=0;

c2toy=(1-alpha)*xx/(1+(rr-1)*beta1*m2*dd/(1-gmae));
qh2toy=c2toy*(dd/(1-gmae));
b2toy=beta1*m2*qh2toy;
c1toy=1-c2toy;
qh1toy=c1toy*dd/hh1;
k=(1-theta)/theta*(1-beta1*theta);

%%
initval;
c1=0;
c2=0;
y=0;
l1=0;
w1=0;
  l2=0;
w2=0;
x=0;
b1=0;
b2=0;
h1=0;
h2=0;
pi=0;
r=0;
q=0;
A=0;
d=0;
%er=0;
end;

%%
model(linear);
y=c1toy*c1+c2toy*c2;
c1=-(eta-1)*l1+w1;
c2=-(eta-1)*l2+w2;
y=A+alpha*l1+(1-alpha)*l2;
x=y-l1-w1;
l2+w2=y-x;
b1toy*b1=b2toy*b2;
h1*(-qh1toy)=h2*qh2toy;
c1=c1(+1)+pi(+1)-r;
q=(1-beta1)*(d-h1)+beta1*(q(+1)-c1(+1))+c1;
b2toy*b2=c2toy*c2+qh2toy*deta*h2+rr*b2toy*(b2(-1)+r(-1)-pi)-(1-alpha)*(y-x)/xx;
q=(beta2+m2*(beta1-beta2))*q(+1)+(1-(beta2+m2*(beta1-beta2)))*(d-h2)+(1-m2*beta1)*(c2-(beta2-m2*beta2)/(1-m2*beta1)*c2(+1))-m2*beta1*(r-pi(+1));
b2=q(+1)+h2+pi(+1)-r;
%pi=beta1*pi(+1)-k*x;
pi=beta1*pi(+1)-k*x(+1);         %what is 'x'? what does theory says about it?
r=0.95*pi+0.95*y+er;
d=ruod*d(-1)+ed;
%A=ruoa*A(-1)+ea;
A=0.9*A(-1)+ea;
%er=ruor*er(-1)+espor;
end;


%%
steady;
check;
resid;

shocks;
%var espor;
%stderr 0.8;
var ed;
stderr 0.08;
var ea;
stderr 2.5;
var er;
stderr 2.5;
end;

%%
stoch_simul(irf=20,nograph,order=1, periods=500) c1 c2 y l1  w1  l2 w2 x b1 b2 h1 h2 pi r q A d;
%stoch_simul(dr_algo=0,periods=1000); datatomfile('simudata',[]);

我仅仅只是把它改得能跑完模拟,但是问题很多。有几个变量都没法模拟出数值来。你如果参数设置完全是按照谋篇论文来的,那么可能参数设置问题不大,但如果你模型有任何修改的地方,都可以导致系统不稳定。我不知道你的.mod根据什么论文来做的,但是我认为你需要找错的话,先从模型逻辑上出发。
已有 1 人评分经验 学术水平 热心指数 信用等级 收起 理由
zhdefei + 100 + 1 + 1 + 1 热心帮助其他会员

总评分: 经验 + 100  学术水平 + 1  热心指数 + 1  信用等级 + 1   查看全部评分

30
rastila 在职认证  发表于 2012-4-9 16:29:03
rastila 发表于 2012-4-9 16:24
你把下面的程序到.mod里,你自己跑一遍看。
var  c1 c2 y l1  w1  l2 w2 x b1 b2 h1 h2 pi r q A d ;
v ...
我没法帮你找出具体的错误,因为这需要对你模型的逻辑非常熟悉。需要你自己再自己读一下论文,同时看有那些变量根据理论是需要定为predetermined或者是nonpredetermined。模型的推导如果有错误也会导致模型解不出来。

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

本版微信群
jg-xs1
拉您进交流群
GMT+8, 2025-12-26 18:17