Page 1 of 2

stoch_simul works but estimation does not

PostPosted: Thu Dec 24, 2015 11:53 am
by shuixing
hi

while I use stoch_simul for a fully calibrated model the model seems to work well,

but if I use observations to estimae some parameters then a problem always exists:

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 458
In dynare_estimation at 70
In lcmr at 304
In dynare at 120

MODE CHECK

Fval obtained by the minimization routine: -655.668810

Most negative variance -284255.670560 for parameter 1 (e_epsil = 0.006506)
Warning: Matrix is close to singular or badly scaled.
Results may be inaccurate. RCOND = 1.757306e-016.
> In dynare_estimation_1 at 473
In dynare_estimation at 70
In lcmr at 304
In dynare at 120

what seems to be the problem?

Re: stoch_simul works but estimation does not

PostPosted: Sat Dec 26, 2015 10:16 am
by jpfeifer
Please search the forum on this. A first indication can derived from the mode-check plots.

Re: stoch_simul works but estimation does not

PostPosted: Tue Dec 29, 2015 11:42 am
by shuixing
jpfeifer wrote:Please search the forum on this. A first indication can derived from the mode-check plots.

thanks professor jpfeifer, a few parameters' mode chek plot do have red dots within some range, so should I impose parameters bound restriction?

Re: stoch_simul works but estimation does not

PostPosted: Tue Dec 29, 2015 3:08 pm
by jpfeifer
Red dots are not an issue. The question is whether the modes are at the peaks of the posterior and whether there are vertical likelihood kernels.

Re: stoch_simul works but estimation does not

PostPosted: Sat Jan 02, 2016 4:54 am
by shuixing
jpfeifer wrote:Red dots are not an issue. The question is whether the modes are at the peaks of the posterior and whether there are vertical likelihood kernels.


thanks dear professor jpfeifer, you are always so helpful, just one more question, the dynare manul does not provide enough details to deal with ouput of dynare ,for example where is the smoothed shock or variable saved and how to feed some smoothed shocks into simulation while shut off other shocks, so where can I find some learning materials for a further study about things like these, thanks jpfeifer.

Re: stoch_simul works but estimation does not

PostPosted: Sat Jan 02, 2016 7:25 am
by jpfeifer
After estimation, you can find them in oo_.SmoothedShocks and oo_.SmoothedVariables, see the bottom of http://www.dynare.org/manual/index_27.html
Regarding the feeding in of shocks, see http://www.dynare.org/phpBB3/viewtopic.php?f=1&t=4471

Re: stoch_simul works but estimation does not

PostPosted: Wed Jan 13, 2016 11:43 am
by shuixing
jpfeifer wrote:After estimation, you can find them in oo_.SmoothedShocks and oo_.SmoothedVariables, see the bottom of http://www.dynare.org/manual/index_27.html
Regarding the feeding in of shocks, see http://www.dynare.org/phpBB3/viewtopic.php?f=1&t=4471


finally I can login this forum... I really appreciate your hellp,thanks, professor jpfeifer!

Re: stoch_simul works but estimation does not

PostPosted: Wed Jan 13, 2016 1:04 pm
by shuixing
jpfeifer wrote:After estimation, you can find them in oo_.SmoothedShocks and oo_.SmoothedVariables, see the bottom of http://www.dynare.org/manual/index_27.html
Regarding the feeding in of shocks, see http://www.dynare.org/phpBB3/viewtopic.php?f=1&t=4471


I add the code
ex_=[oo_.SmoothedShocks.Median.e_a oo_.SmoothedShocks.Median.e_m]
y0=oo_.dr.ys;
dr=oo_.dr
iorder=1;
y_=simult_(y0,dr,ex_,iorder);'

in the mod.file after the estimation command line, but it reports the following error

??? Reference to non-existent field 'Median'.

Error in ==> lcmr at 305
ex_=[oo_.SmoothedShocks.Median.e_a oo_.SmoothedShocks.Median.e_m]

Error in ==> dynare at 120
evalin('base',fname) ;

is there any details I misunderstand?

Re: stoch_simul works but estimation does not

PostPosted: Thu Jan 14, 2016 9:30 am
by jpfeifer
Please check which fields in oo_.SmoothedShocks exist. Maybe you only have the mean there.

Re: stoch_simul works but estimation does not

PostPosted: Thu Jan 14, 2016 3:05 pm
by shuixing
jpfeifer wrote:Please check which fields in oo_.SmoothedShocks exist. Maybe you only have the mean there.


dear jpfeifer, I did not do anything wiht the result just add the code lines, so the oo_.SmoothedShocks are still in oo_ field.

Re: stoch_simul works but estimation does not

PostPosted: Thu Jan 14, 2016 3:22 pm
by jpfeifer
I said you should check the subfields and whether they exist. Maybe there is only
Code: Select all
oo_.SmoothedShocks.Mean

and not
Code: Select all
oo_.SmoothedShocks.Median

Re: stoch_simul works but estimation does not

PostPosted: Sat Jan 16, 2016 3:04 am
by shuixing
jpfeifer wrote:I said you should check the subfields and whether they exist. Maybe there is only
Code: Select all
oo_.SmoothedShocks.Mean

and not
Code: Select all
oo_.SmoothedShocks.Median


hi professor jpfeifer,I have checked, and it seems only oo_.SmoothedShocks exist.

Re: stoch_simul works but estimation does not

PostPosted: Tue Jan 19, 2016 9:41 am
by jpfeifer
So you did not run the MCMC. In this case, take the results in
Code: Select all
oo_.SmoothedShocks

Re: stoch_simul works but estimation does not

PostPosted: Thu Jan 21, 2016 1:56 pm
by shuixing
jpfeifer wrote:So you did not run the MCMC. In this case, take the results in
Code: Select all
oo_.SmoothedShocks

thanks professor Jpeifer,
so I use code:

ex_=[oo_.SmoothedShocks];
y0=oo_.dr.ys;
dr=oo_.dr;
iorder=1;
y_=simult_(y0,dr,ex_,iorder);

but I get error
??? Undefined function or method 'mtimes' for input arguments of type 'struct'.

Error in ==> simult_ at 99
epsilon = dr.ghu*transpose(ex_);

Error in ==> lcmr at 324
y_=simult_(y0,dr,ex_,iorder);

Error in ==> dynare at 120
evalin('base',fname) ;

my model is loglinearized by hand, so I think maybe iorder=1 is wrong ,then I change iorder=0,but I only get two columns of zeros in y_, what seems to be the problem?

Re: stoch_simul works but estimation does not

PostPosted: Sun Jan 24, 2016 7:10 pm
by jpfeifer
You need to sort this out yourself by checking the content of
Code: Select all
oo_.SmoothedShocks

The error message tells you that it is a structure. But you claimed that there are no subfields before.