楼主: YYQX的鹤
1451 2

[宏观经济指标] dynare做贝叶斯估计时出来的图只有先验分布没有后验分布 [推广有奖]

  • 1关注
  • 1粉丝

硕士生

26%

还不是VIP/贵宾

-

威望
0
论坛币
1833 个
通用积分
3.0004
学术水平
0 点
热心指数
0 点
信用等级
0 点
经验
1174 点
帖子
56
精华
0
在线时间
201 小时
注册时间
2018-11-30
最后登录
2023-3-16

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
提示的错误信息为:
You did not declare endogenous variables after the estimation/calib_smoother command.
Posterior IRFs will be computed for the 12 endogenous variables
of your model, this can be very long....


Choose one of the following options:

[1] Consider all the endogenous variables.
[2] Consider all the observed endogenous variables.
[3] Stop Dynare and change the mod file.

options [default is 1] =   [2]

Error using load_xls_file_data (line 117)
load_xls_file_data: I am not able to read the dates!

Error in read_variables (line 92)
        [freq,init,data,varlist] = load_xls_file_data(fullname,xls_sheet,xls_range);

Error in initialize_dataset (line 32)
rawdata = read_variables(datafile,varobs,[],xls.sheet,xls.range);

Error in dynare_estimation_init (line 475)
dataset_ = initialize_dataset(options_.datafile,options_.varobs,options_.first_obs,options_.nobs,transformation,options_.prefilter,xls);

Error in dynare_estimation_1 (line 81)
[dataset_,xparam1, hh, M_, options_, oo_, estim_params_,bayestopt_] = dynare_estimation_init(var_list_, dname, [], M_, options_, oo_,
estim_params_, bayestopt_);

Error in dynare_estimation (line 89)
    dynare_estimation_1(var_list,dname);

Error in tztzsixone (line 297)
dynare_estimation(var_list_);

Error in dynare (line 180)
evalin('base',fname) ;
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

关键词:dynare 贝叶斯估计 先验分布 ARE 贝叶斯

沙发
YYQX的鹤 发表于 2020-6-16 19:52:12 |只看作者 |坛友微信交流群
有没有大神帮忙解决一下,可有偿,微信:15638421291

使用道具

藤椅
YYQX的鹤 发表于 2020-6-16 19:53:49 |只看作者 |坛友微信交流群
我的代码为:
var a n c k r  g1 g2 w y p i y_obs;
varexo ea ep;
parameters theta theta1 enta beta delta alpha1 alpha2 alpha3 rho1 rho2 sda;
parameters ns cs ks as rs ws  g1s g2s ps ys m;
alpha1 = 0.346;
alpha2 = 0.510;
alpha3 = 0.144;
beta  = 0.925;
delta = 0.1;
theta = 0.8;
theta1 = 0.8;
rho1 = 0.8;
rho2 = 0.937;        
enta = 1 ;
sda = 0.019;
as = 1;
ps = 1;
rs = 1/beta-1+delta;
m = (alpha2/(alpha1*beta))-(alpha2/alpha1)+((alpha2*delta)/alpha1)+(1/beta)-1;
ws = (alpha2/alpha1)*((alpha1/rs)^(1/alpha2)*((1-theta1)*m)^(alpha3/alpha2))*rs;
ns = ((theta1)*(theta1*m)^(theta1*(1-theta1)-1)*((alpha1/rs)^(1/alpha2)*((1-theta1)*m)^(alpha3/alpha2))^(-theta)*ws)^(1/(enta+theta));
ks = ns*(alpha1/rs)^(1/alpha2)*((1-theta1)*m)^(alpha3/alpha2);
cs = (3*theta1/(10-7*theta1))*m*ks;
ys = alpha1*rs*ks;
is = delta*ks;
g1s =((1-theta1)/theta1)*(3*theta1/(10-7*theta1))*m*ks;
g2s = (7/3)*((1-theta1)/theta1)*m*ks;

model;
%(1)
theta1*exp(c)^(theta1*(1-theta)-1)*exp(g1)^((1-theta1)*(1-theta))=beta*theta1*exp(c(1))^(theta1*(1-theta)-1)*exp(g1(1))^((1-theta1)*(1-theta))*(exp(r(1))+1-delta);
%(2)
exp(g1)=((1-theta1)/theta1)*(exp(c)/exp(p));
%(3)
exp(r)=alpha1*exp(a)*exp(k(-1))^(alpha1-1)*exp(n)^(alpha2)*(exp(p)*exp(g2))^(alpha3);
%(4)
exp(w)=alpha2*exp(a)*exp(k(-1))^(alpha1)*exp(n)^(alpha2-1)*(exp(p)*exp(g2))^(alpha3);
%(5)
exp(y)=exp(c)+exp(i)+exp(p)*(exp(g1)+exp(g2));
%(6)
exp(k)=exp(i)+(1-delta)*exp(k(-1));
%(7)
exp(y)=exp(a)*exp(k(-1))^(alpha1)*exp(n)^(alpha2)*(exp(p)*exp(g2))^(alpha3);
%(8)
exp(n)^enta=theta1*exp(c)^(theta1*(1-theta)-1)*exp(g1)^((1-theta1)*(1-theta))*exp(w);
%(9)
a=(rho1)*a(-1)+ea;
%(10)
p=(rho2)*p(-1)+ep;
%(11)
g2=(7/3)*g1;
%(12)
y_obs=log(y)-log(ys);
end;
initval;
k=log(ks);
y=log(ys);
c=log(cs);
a=log(as);
r=log(rs);
i=log(is);
w=log(ws);
n=log(ns);
p=log(ps);
g1=log(g1s);
g2=log(g2s);
end;
resid;
steady;
shocks;
var ea = sda^2;
var ep = sda^2;
end;
resid(1);
steady;
check;  
%Uses HP filter before computing moments.
stoch_simul(order =1,irf=40, hp_filter =1600,periods=1000);
stoch_simul(order=1, periods=0,irf=40, conditional_variance_decomposition =[1:40]);
estimated_params;
rho1,beta_pdf,0.8,0.02;
rho2,beta_pdf,0.937,0.06;
alpha1,normal_pdf,0.346,0.037;
alpha2,normal_pdf,0.510,0.05;
alpha3,normal_pdf,0.144,0.023;
beta,normal_pdf,0.925,0.05;
delta,normal_pdf,0.1,0.05;
theta,normal_pdf,0.8,0.05;
theta1,normal_pdf,0.8,0.05;     
enta,normal_pdf,1,0.05;
stderr ea ,inv_gamma_pdf,0.01,inf;
stderr ep ,inv_gamma_pdf,0.01,inf;
end;
varobs y_obs;
%mh_replic=10000 will take about 21mins, 1000 will take about 4mins;
estimation(datafile=DATA03,mh_replic=1000,mh_jscale=0.9,mode_check,bayesian_irf);

使用道具

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

本版微信群
加JingGuanBbs
拉您进交流群

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

GMT+8, 2024-4-19 21:06