Dynare error message

This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location where you will have to reset your password.
Forum rules
This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location (https://forum.dynare.org) where you will have to reset your password.

Dynare error message

Postby Salma.B » Thu Jun 08, 2017 12:08 am

Dear all,
i have a bayesian VAR to estimate, and i am having the same error message:

Error using chol
Matrix must be positive definite.
Error in metropolis_hastings_initialization (line 68)
d = chol(vv);
Error in random_walk_metropolis_hastings (line 63)
metropolis_hastings_initialization(TargetFun, xparam1, vv,
mh_bounds,dataset_,options_,M_,estim_params_,bayestopt_,oo_);
Error in dynare_estimation_1 (line 782)
feval(options_.posterior_sampling_method,objective_function,options_.proposal_distribution,xparam1,invhess,bounds,dataset_,options_,M_,estim_params_,bayestopt_,oo_);


Here's my code, i would be grateful if anyone can help:


var y_obs c_obs i_obs rn_obs er_obs pi_obs tot_obs;

varexo mes_y mes_c mes_i mes_tot mes_pi mes_er mes_rn;

parameters rho_c1 rho_y1 rho_i1 rho_rn1 rho_er1 rho_pi1 rho_tot1
rho_c2 rho_y2 rho_i2 rho_rn2 rho_er2 rho_pi2 rho_tot2
rho_c3 rho_y3 rho_i3 rho_rn3 rho_er3 rho_pi3 rho_tot3
rho_c4 rho_y4 rho_i4 rho_rn4 rho_er4 rho_pi4 rho_tot4
rho_c5 rho_y5 rho_i5 rho_rn5 rho_er5 rho_pi5 rho_tot5
rho_c6 rho_y6 rho_i6 rho_rn6 rho_er6 rho_pi6 rho_tot6
rho_c7 rho_y7 rho_i7 rho_rn7 rho_er7 rho_pi7 rho_tot7;

rho_y1=0.1 ; rho_y2=0.1 ; rho_y3=0.1 ; rho_y4=0.1; rho_y5=0.1; rho_y6=0.1; rho_y7=0.1 ;
rho_c1=0.1 ; rho_c2=0.1; rho_c3=0.1; rho_c4=0.1 ; rho_c5=0.1; rho_c6=0.1; rho_c7=0.1 ;
rho_i1= 0.1 ; rho_i2=0.1; rho_i3=0.1 ; rho_i4=0.1 ; rho_i5=0.1; rho_i6=0.1; rho_i7= 0.1 ;
rho_rn1= 0.1 ; rho_rn2=0.1; rho_rn3=0.1; rho_rn4=0.1; rho_rn5=0.1; rho_rn6=0.1; rho_rn7= 0.1 ;
rho_er1=0.1 ;rho_er2=0.1; rho_er3=0.1; rho_er4=0.1; rho_er5=0.1; rho_er6=0.1; rho_er7= 0.1;
rho_pi1=0.1; rho_pi2=0.1; rho_pi3=0.1; rho_pi4=0.1; rho_pi5=0.1; rho_pi6=0.1; rho_pi7=0.1 ;
rho_tot1=0.1; rho_tot2=0.1; rho_tot3=0.1; rho_tot4=0.1; rho_tot5=0.1; rho_tot6=0.1; rho_tot7= 0.1;


model;
y_obs= rho_y1*y_obs(-1)+rho_c1*c_obs(-1)+rho_i1*i_obs(-1)+rho_rn1*rn_obs(-1)+rho_er1*er_obs(-1)+rho_pi1*pi_obs(-1)+rho_tot1*tot_obs(-1)+mes_y;
c_obs= rho_y2*y_obs(-1)+rho_c2*c_obs(-1)+rho_i2*i_obs(-1)+rho_rn2*rn_obs(-1)+rho_er2*er_obs(-1)+rho_pi2*pi_obs(-1)+rho_tot2*tot_obs(-1)+mes_c;
i_obs= rho_y3*y_obs(-1)+rho_c3*c_obs(-1)+rho_i3*i_obs(-1)+rho_rn3*rn_obs(-1)+rho_er3*er_obs(-1)+rho_pi3*pi_obs(-1)+rho_tot3*tot_obs(-1)+mes_i;
rn_obs= rho_y4*y_obs(-1)+rho_c4*c_obs(-1)+rho_i4*i_obs(-1)+rho_rn4*rn_obs(-1)+rho_er4*er_obs(-1)+rho_pi4*pi_obs(-1)+rho_tot4*tot_obs(-1)+mes_rn;
er_obs= rho_y5*y_obs(-1)+rho_c5*c_obs(-1)+rho_i5*i_obs(-1)+rho_rn5*rn_obs(-1)+rho_er5*er_obs(-1)+rho_pi5*pi_obs(-1)+rho_tot5*tot_obs(-1)+mes_er;
pi_obs= rho_y6*y_obs(-1)+rho_c6*c_obs(-1)+rho_i6*i_obs(-1)+rho_rn6*rn_obs(-1)+rho_er6*er_obs(-1)+rho_pi6*pi_obs(-1)+rho_tot6*tot_obs(-1)+mes_pi;
tot_obs=rho_y7*y_obs(-1)+rho_c7*c_obs(-1)+rho_i7*i_obs(-1)+rho_rn7*rn_obs(-1)+rho_er7*er_obs(-1)+rho_pi7*pi_obs(-1)+rho_tot7*tot_obs(-1)+mes_tot;
end;

steady;
check;


estimated_params;

rho_y1, BETA_PDF, 0.1434, 0.10;
rho_y2, BETA_PDF, 0.0868, 0.10;
rho_y3, BETA_PDF, 0.0541, 0.10;
rho_y4, BETA_PDF, 0.2075, 0.10;
rho_y5, BETA_PDF, 0.0935, 0.10;
rho_y6, BETA_PDF, 0.1053, 0.10;
rho_y7, BETA_PDF, 0.0728, 0.10;
rho_c1, BETA_PDF, 0.1175, 0.10;
rho_c2, BETA_PDF, 0.1, 0.10;
rho_c3, BETA_PDF, 0.0819, 0.10;
rho_c4, BETA_PDF, 0.1342, 0.10;
rho_c5, BETA_PDF, 0.1042, 0.10;
rho_c6, BETA_PDF, 0.0945, 0.10;
rho_c7, BETA_PDF, 0.0977, 0.10;
rho_i1, BETA_PDF, 0.0972 , 0.10;
rho_i2, BETA_PDF, 0.1003, 0.10;
rho_i3, BETA_PDF, 0.1012, 0.10;
rho_i4, BETA_PDF, 0.0973, 0.10;
rho_i5, BETA_PDF, 0.1998, 0.10;
rho_i6, BETA_PDF, 0.0653, 0.10;
rho_i7, BETA_PDF, 0.1, 0.10;
rho_rn1, BETA_PDF, 0.3659, 0.10;
rho_rn2, BETA_PDF, 0.0965, 0.10;
rho_rn3, BETA_PDF, 0.1091, 0.10;
rho_rn4, BETA_PDF, 0.0949, 0.10;
rho_rn5, BETA_PDF, 0.0976, 0.10;
rho_rn6, BETA_PDF, 0.1091, 0.10;
rho_rn7, BETA_PDF, 0.039, 0.10;
rho_er1, BETA_PDF, 0.05, 0.10;
rho_er2, BETA_PDF, 0.1, 0.10;
rho_er3, BETA_PDF, 0.1, 0.10;
rho_er4, BETA_PDF, 0.0949, 0.10;
rho_er5, BETA_PDF, 0.0976, 0.10;
rho_er6, BETA_PDF, 0.013, 0.10;
rho_er7, BETA_PDF, 0.0853, 0.10;
rho_pi1, BETA_PDF, 0.1196, 0.10;
rho_pi2, BETA_PDF, 0.0844, 0.10;
rho_pi3, BETA_PDF, 0.0748, 0.10;
rho_pi4, BETA_PDF, 0.1596, 0.10;
rho_pi5, BETA_PDF, 0.1036, 0.10;
rho_pi6, BETA_PDF, 0.1091, 0.10;
rho_pi7, BETA_PDF, 0.083, 0.10;
rho_tot1, BETA_PDF, 0.0945, 0.10;
rho_tot2, BETA_PDF, 0.0927, 0.10;
rho_tot3, BETA_PDF, 0.0823, 0.10;
rho_tot4, BETA_PDF, 0.111, 0.10;
rho_tot5, BETA_PDF, 0.0662, 0.10;
rho_tot6, BETA_PDF, 0.0934, 0.10;
rho_tot7, BETA_PDF, 0.0533, 0.10;

stderr mes_er, INV_GAMMA_PDF, 0.5, 1.00;
stderr mes_y, INV_GAMMA_PDF, 0.5442, 1.00;
stderr mes_c, INV_GAMMA_PDF, 0.4908, 1.00;
stderr mes_i, INV_GAMMA_PDF, 0.5011, 1.00;
stderr mes_pi, INV_GAMMA_PDF, 0.4995, 1.00;
stderr mes_tot, INV_GAMMA_PDF, 0.6998, 1.00;
stderr mes_rn, INV_GAMMA_PDF, 0.8152, 1.00;
end;

%%%%%%%%%%%%%%%%%%%%%%%%%%%
% OBSERVABLE VARIABLES
%%%%%%%%%%%%%%%%%%%%%%%%%%%

varobs pi_obs rn_obs c_obs y_obs i_obs er_obs tot_obs;

options_.plot_priors=0;

estimated_params_init(use_calibration);
end;

options_.solve_algo=3;

estimation(datafile=data_SA,first_obs=12,mode_compute=4,presample=15,
prefilter=1,mh_replic=20000,mh_nblocks=1,forecast=8);

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5
%Produce historical decomposition
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5

shock_decomposition(parameter_set=posterior_mode) y_obs c_obs i_obs pi_obs rn_obs er_obs tot_obs ;
Salma.B
 
Posts: 1
Joined: Thu Jun 08, 2017 12:04 am

Re: Dynare error message

Postby jpfeifer » Thu Jun 08, 2017 6:24 am

1. The data-file is missing.
2. did you look at the mode_check-plots?
3. Is there a reason, you do not use the bvar-command?
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany


Return to Dynare help

Who is online

Users browsing this forum: Google [Bot] and 12 guests