Page 1 of 1

Bayesian estimation problem

PostPosted: Thu Sep 08, 2016 3:16 pm
by yshguo123
POSTERIOR KERNEL OPTIMIZATION PROBLEM!
(minus) the hessian matrix at the "mode" is not positive definite!
=> posterior variance of the estimated parameters are not positive.
You should try to change the initial values of the parameters using
the estimated_params_init block, or use another optimization routine.
Warning: The results below are most likely wrong!
> In dynare_estimation_1 at 694
In dynare_estimation at 89
In dsge_esti at 568
In dynare at 180

RESULTS FROM POSTERIOR ESTIMATION
parameters
prior mean mode s.d. prior pstdev

gamma_l 0.500 0.6794 0.0000 beta 0.1000
sigma 0.800 0.9798 0.0136 beta 0.1000
upsilon 0.500 0.5236 0.0000 beta 0.1000
alpha 0.400 0.6672 0.0000 beta 0.1000
chi_m 1.000 0.9751 0.0000 gamm 0.1000
phi 0.500 0.5545 0.0000 beta 0.1000
iota_d 0.500 0.5010 0.0000 beta 0.1000
iota_f 0.500 0.5503 0.0000 beta 0.1000
el 0.500 0.4682 0.0000 beta 0.1000
gamma 0.500 0.4909 0.0000 beta 0.1000
rho_rr 0.500 0.4420 0.0000 beta 0.1000
rho_r 0.500 0.9492 0.0052 beta 0.1000
lambda_y 1.500 1.4307 0.0000 gamm 0.1000
lambda_pi 0.500 0.4584 0.0884 gamm 0.1000
lambda_m 0.500 0.4804 0.0000 gamm 0.1000
lambda_q 0.500 0.2747 0.0000 gamm 0.1000
rho_y 0.500 0.0582 0.0000 beta 0.1000
rho_w 0.500 0.4091 0.0000 beta 0.1000
rho_rf 0.500 0.4846 0.1054 beta 0.1000
rho_ex 0.500 0.4714 0.1057 beta 0.1000
rho_a 0.500 0.4621 0.0000 beta 0.1000
rho_g 0.500 0.3133 0.0387 beta 0.1000

standard deviation of shocks
prior mean mode s.d. prior pstdev

mu_r 0.500 0.7280 0.0000 invg 0.1000
mu_rf 0.500 0.2119 0.0173 invg 0.1000
mu_ex 0.500 0.2330 0.0206 invg 0.1000
mu_q 0.500 0.3960 0.0000 invg 0.1000
mu_w 0.500 0.3286 0.0000 invg 0.1000
mu_a 0.500 0.2395 0.0217 invg 0.1000
mu_g 0.500 0.5089 0.0000 invg 0.1000


Log data density [Laplace approximation] is 140.455307.

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 62)
[ ix2, ilogpo2, ModelName, MetropolisFolder, fblck, fline, npar, nblck, nruns,
NewFile, MAX_nruns, d ] = ...

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_);

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

Error in dsge_esti (line 568)
dynare_estimation(var_list_);

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

Re: Bayesian estimation problem

PostPosted: Fri Sep 09, 2016 2:32 pm
by jpfeifer
First and foremost, your model does not handle parameter dependence correctly. See Pfeifer(2013): "A Guide to Specifying Observation Equations for the Estimation of DSGE Models" https://sites.google.com/site/pfeiferecon/Pfeifer_2013_Observation_Equations.pdf

Re: Bayesian estimation problem

PostPosted: Sun Sep 11, 2016 1:47 pm
by yshguo123
Hello, jpfeifer

Thanks to you for your help. Now I meet another problem as follow.

Improvement on iteration 13 = 0.000000000
improvement < crit termination
Objective function at mode: 806.127685

POSTERIOR KERNEL OPTIMIZATION PROBLEM!
(minus) the hessian matrix at the "mode" is not positive definite!
=> posterior variance of the estimated parameters are not positive.
You should try to change the initial values of the parameters using
the estimated_params_init block, or use another optimization routine.
Warning: The results below are most likely wrong!
> In dynare_estimation_1 at 694
In dynare_estimation at 89
In dsge_esti at 549
In dynare at 180


The model equations are linear: I'd like to know how to set the steady state values of these parameters: (R_R R_F MM T_M NN D_M KK I_K D_I RR_R PI_PI PI_F QQ M_RR Y_R PI_R Q_R G_M C_Y I_Y G_Y EX_Y IM_Y) . as the model equations are linear, the initial values of all endogenous variables are zero. But the parameters like R_R is not endogenous variable.

Thanks to everyone.


model(linear);
(gamma_l*(1-sigma)-1)*c=lambda-(1- gamma_l)*(1-sigma)*m;
beta_PI*(m-c) =(beta_PI)*(lambda(+1)-pi(+1)-lambda);
upsilon*n=lambda+w;
(beta_PI*(1+R_R)-1)*d= beta_PI*(1+R_R)*(lambda(+1)-pi(+1)-lambda)+beta_PI*R_R*r;
(beta_PI*(1+R_F)-1)*(s-f)= beta_PI*(1+R_F)*(lambda(+1)+s(+1)-s-pi(+1)-lambda)+beta_PI*R_F*r;
//C_M*c=WN_M*(w+n)+D_M*((1+R_R)*d(-1)+R_R*r(-1)-d)+(iota_d*D_M/iota_f)*((1+R_F)*(s+f(-1))+R_F*rf(-1)-(s+f))-((MM/2)*(iota_d+iota_d^2/iota_f)*D_M^2)*z-MM*(m-m(-1))-T_M*t;
C_M*c=(NN^( upsilon+1)/((gamma_l*MM^(-sigma)*C_M^(gamma_l*(1-sigma)-1))*MM))*(w+n)+D_M*((1+R_R)*d(-1)+R_R*r(-1)-d)+(iota_d*D_M/iota_f)*((1+R_F)*(s+f(-1))+R_F*rf(-1)-(s+f))-((MM/2)*(iota_d+iota_d^2/iota_f)*D_M^2)*z-MM*(m-m(-1))-T_M*t;
((MM/2)*(iota_d+iota_d^2/iota_f)*D_M^2)*z=iota_d*MM*(D_M^2)+iota_f*MM*((iota_d*D_M/iota_f))^2*(s+f);
y=alpha*k+(1-alpha)*(a+n);
rr=xi+y-k;
w=xi+y-n;
KK*k(+1)=(I_K-el*(I_K-delta))*(i-k)+(1-delta)*KK*k;
//KK*k=(I_K-el*(I_K-delta))*(i-k(-1))+(1-delta)*KK*k(-1);
i=(1-eta_zeta)*D_I*d+e_w;
pih=(1-phi)*(1-beta*phi)*xi/phi+beta*pih(+1);
pif=(1-phi)*(1-beta*phi)*xi/phi+beta*pif(+1);
pi=gamma*pih+(1-gamma)*pif;
R_R*r=(1-gamma_l)*(RR_R*rr+PI_PI*pi)+gamma_l*(R_F*rf-PI_F*pif+PI_PI*pi(+1)+QQ*q(+1)-QQ*q)+e_q;
rr=rho_rr*rr(-1)+(1-rho_rr)*chi_m*M_RR*(m-m(-1));
r=rho_r*r(-1)+(1-rho_r)*(lambda_y*Y_R*y+lambda_pi*PI_R*pi+lambda_m*PI_R*nu+lambda_q*Q_R*q)+mu_r;
nu=m+pi-m(-1);
T_M*t=G_M*g-m+(m(-1)-pi)/PI_PI;
y=C_Y*c+I_Y*i+G_Y*g+EX_Y*ex-IM_Y*im;
im=rho_y+e_q;
e_q=rho_q*e_q(-1)+mu_q;
e_w=rho_w*e_w(-1)+mu_w;
rf=rho_rf*rf(-1)+mu_rf;
ex=rho_ex*rf(-1)+mu_ex;
a=rho_a*a(-1)+mu_a;
g=rho_g*g(-1)+mu_g;

end;

Re: Bayesian estimation problem

PostPosted: Tue Sep 13, 2016 9:20 am
by jpfeifer
You need to compute these objects from the steady state of your nonlinear model. There is no way around this.