Estimation problem


I try to do a robustness check when estimating Taylor rule with a reaction to 1)current inflation, 2)expected inflation. Therefore, the Taylor in Dynare code look
1)Rhat = (1-rR)rqqinf + (1-rR)rpipihat+ry*(1-rR)Yhat+rRRhat(-1)+eRhat; for current inflation
2)Rhat = (1-rR)rqqinf + (1-rR)rpipihat(+1)+ry*(1-rR)Yhat+rRRhat(-1)+eRhat; for expected inflation

Although I get estimated the model with a reaction to current inflation, I get an error when estimating the model with a reaction to expected inflation. Here is the error message:

??? 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 1057

Error in ==> dynare_estimation at 62

Error in ==> A_new at 311

Error in ==> dynare at 132
evalin(‘base’,fname) ;

Could you help me on this, please?
I enclose my Dynare code and data used for the estimation.

Many many thanks in advance,
A_new.mod (4.29 KB)
data_new.m (3.49 KB)

Try mode_compute=6. Seach the forum for it and you will find many answers.

Could you tell, pls, where in the code I have to make a change mode_compute=6?


this message error means that the mode optimization hasnt converged and dynare can’t run MH from such a bad mode. I tried with another solver by adding in the estimation command the option “mode_compute=4” and now it works.
Plz see the attached file.

A_new.mod (4.3 KB)

Sorry, but mode_compute=4 is the estimation default. So that should be what you have done anyway. Due to the random element in the csminwel, it sometimes works, but sometimes doesn’t. Usually, the alternative is mode_compute=6 (

the code work only with
Rhat = (1-rR)rqqinf + (1-rR)rpipihat+ry*(1-rR)Yhat+rRRhat(-1)+eRhat

and not with:
Rhat = (1-rR)rqqinf + (1-rR)rpipihat(+1)+ry*(1-rR)Yhat+rRRhat(-1)+eRhat; for expected inflation.

I attach now the code which generates error.
I tried to write mode_compute=6 but it took 30 mins to do MH and still no results, so I aborted the process.

Could you help, please, I am desperate…
data_new.m (3.49 KB)
A_new.mod (4.29 KB)

ok thought it was 0 but thats right by default it is 4. Anyway I can send you the mode I got if you wanna (seems that mat.* files cant be attached here) that may help for the initialization of the optimization procedure. In that case you’ll need to load it using the option “mode_file=A_new_mode”

Hope this helps.

is it with pihat or pihat(+1)?

my previous reply relates to the first mod.* file you posted. Regarding the second one, I recommend you to change the initial values of the parameters to be estimated by adding a block “estimated_params_init;” Note that they are initialized at their prior mean by default.


Just FYI: using mode_compute=6 almost always gets you a positive definite inverse Hessian, so the Cholesky decomposition will not fail (you won’t get “Matrix must be positive definite.”). However, the huge drawback is that for larger models it sometimes takes several hours to complete. You can change the parameters mentioned in the Wiki to speed it up, but you will buy speed with less accuracy.
As AssiaEzzeroug says, changing the initial parameters might help, but my experience for larger models is that most of the time you will still get the same error message with mode_compute=4 (the default).

but if I change parameters, there will not be any robustness check… My aim is to check the model with the same parameters but with two types of rule: expected inflation and current inflation.

I tried mode_compute=6 but the estimators are quite different…