Page 1 of 1

something wrong with RBC_Est?

PostPosted: Mon Nov 09, 2009 11:34 am
by davidforum
when I am trying to replicate the Bayesian estimation with the example of RBC_Est which is done in the User Guide version beta (chapter 5). I get the error information as following :
??? Error using ==> chol
Matrix must be positive definite.
Error in ==> metropolis_hastings_initialization at 52
d = chol(vv);
Error in ==> random_walk_metropolis_hastings at 43
[ ix2, ilogpo2, ModelName, MhDirectoryName, fblck, fline, npar,
nblck, nruns, NewFile, MAX_nruns, d ] = ...
Error in ==> dynare_estimation_1 at 940
feval(options_.posterior_sampling_method,'DsgeLikelihood',options_.proposal_distribution,xparam1,invhess,bounds,gend,data);
Error in ==> dynare_estimation at 62
dynare_estimation_1(var_list,varargin{:});
Error in ==> RBC_Est at 132
dynare_estimation(var_list_);
Error in ==> dynare at 102
evalin('base',fname) ;

Could someone tell me the reason? (I did not do any change with the code; the softwares which I use are dynare 4.04 and Matlab R2008 ;the attachments are the code of RBC_Est.mod and the data)
Thank you in advance.

david

Re: something wrong with RBC_Est?

PostPosted: Sat Nov 28, 2009 7:50 pm
by pakocica
Dear David,

this issue is related to the fact that the standard deviations of the parameters are too small. Especially the std(epsilon) is to small. Consequently the numerical solution in Matlab will be unstable. You can solve this problem simply by considering the variable epsilon10 = 10*epsilon, see below:

Code: Select all
var y c k i l y_l w r z;
varexo e;
parameters beta psi delta alpha rho epsilon10;

model;
(1/c) = beta*(1/c(+1))*(1+r(+1)-delta);
psi*c/(1-l) = w;
c+i = y;
y = (k(-1)^alpha)*(exp(z)*l)^(1-alpha);
w = y*((epsilon10-10)/epsilon10)*(1-alpha)/l;
r = y*((epsilon10-10)/epsilon10)*alpha/k(-1);
i = k-(1-delta)*k(-1);
y_l = y/l;
z = rho*z(-1)+e;
end;

varobs  y;

initval;
  k = 9;
  c = 0.76;
  l = 0.3;
  w = 2.07;
  r = 0.03;
  z = 0;
  e = 0;
end;

estimated_params;
alpha, beta_pdf, 0.35, 0.02;
beta, beta_pdf, 0.99, 0.002;
delta, beta_pdf, 0.025, 0.003;
psi, gamma_pdf, 1.75, 0.02;
rho, beta_pdf, 0.95, 0.05;
epsilon10, gamma_pdf, 100, 0.3;
stderr e, inv_gamma_pdf, 0.01, inf;
end;


estimation(datafile=simuldataRBC,nobs=200,first_obs=500,mh_replic=2000,mh_nblocks=2,mh_drop=0.45,mh_jscale=0.8);


Best,
Pavel

Re: something wrong with RBC_Est?

PostPosted: Sun Nov 29, 2009 2:08 pm
by davidforum
Dear Pavel,
I very appreciate your help. I follow your advice and change the code, It works!
Thanks again!