Stoch_simul works but estimation does not

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?

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?

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.

After estimation, you can find them in oo_.SmoothedShocks and oo_.SmoothedVariables, see the bottom of dynare.org/manual/index_27.html
Regarding the feeding in of shocks, see [Simulate a model using smoothed shocks)

[quote=“jpfeifer”]After estimation, you can find them in oo_.SmoothedShocks and oo_.SmoothedVariables, see the bottom of dynare.org/manual/index_27.html
Regarding the feeding in of shocks, see [Simulate a model using smoothed shocks)[/quote]

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

[quote=“jpfeifer”]After estimation, you can find them in oo_.SmoothedShocks and oo_.SmoothedVariables, see the bottom of dynare.org/manual/index_27.html
Regarding the feeding in of shocks, see [Simulate a model using smoothed shocks)[/quote]

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?

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.

I said you should check the subfields and whether they exist. Maybe there is only

and not

[quote=“jpfeifer”]I said you should check the subfields and whether they exist. Maybe there is only

and not

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

So you did not run the MCMC. In this case, take the results in

[quote=“jpfeifer”]So you did not run the MCMC. In this case, take the results in

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?

You need to sort this out yourself by checking the content of

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

[quote=“jpfeifer”]You need to sort this out yourself by checking the content of

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

thanks professor J.Peifer, finally it works!