Error in mode finding

Dear helper,

I constructed a log-linearized model. I transformed my data according to your guide paper. To be specific, I first take log-difference and then demean the non-stationary data. As for the stationary data, for example inflation and interest rate, I just take log and demean the data. Thus I think my observables exactly represent the percentage deviation from the steady state, which can match my model variable correctly. I set “mode_compute=6”. I also have used the “identification” command, which shows that
==== Identification analysis ====

Testing prior mean


Parameter error:
The model does not solve for prior_mean with error code info = 3

info==3 %! Blanchard & Kahn conditions are not satisfied: no stable equilibrium.

Try sampling up to 50 parameter sets from the prior.

All parameters are identified in the model (rank of H).

All parameters are identified by J moments (rank of J)

==== Identification analysis completed ====

Q1: Does it mean all the parameters are identified? If yes, why does it show that "The model does not solve for prior_mean with error code info = 3

info==3 %! Blanchard & Kahn conditions are not satisfied: no stable equilibrium." ?

Q2: Since mode_compute=6 is very inefficient and it takes about 3 hours for each round, when I set “mode_compute=4”, it first shows that

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 code at 1033
In dynare at 180

And then stop 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 code (line 1033)
dynare_estimation(var_list_);

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

What is the problem and how to fix it?

Q3: As for the graphs of impulse response functions, I found it seems to be odd, which means that it fluctuates up and down the steady state for two or three tims, and some converge to the steady state very quickly. Is this result reliable? If not, how to fix it?

Here attached the impulse response graphs and my code&data file. Any help is highly appreciated!

Regards,
data100.xls (39.5 KB)
code.mod (10.6 KB)
irf.pdf (128 KB)

Anyone can help?

Q1. Identification starts testing identification at the prior mean. But your model does not solve at the prior mean as it does not satify the Blanchard-Kahn conditions. Instead of then aborting, Dynare samples from the prior and tests these draws for identification. In your case, these samples were successful and no problems were detected.

Q2. The problem is an irregular posterior with many local maxima and sharp ridges. Local optimizers that rely on Newton-type approaches often fail in theses cases. You could try to use such an optimizer and then use the mcmc_jumping_covariance to circumvent the Hessian problem. But what you buy in time here you will most probably lose later in the MCMC due to poor convergence when the sampler drifts to the global maximum.

Q3. It seems you are working with news shocks. IRFs like that do not seem to be that uncommon. See for example Figures 3 and 4 of Beaudry/Portier (2004): An exploration into Pigou’s theory of cycles. Your estimated persistence seems a bit low but is not unheard of. At least the IRF does not raise immediate red flags.

Dear Jpfeifer,

Many thanks for your kindly help. As for Q3, could you explain why model with news shocks can generate such a little bit oscillatory impulse response while contemporaneous shocks do no?

Regards,

Simply because the news shocks provide agents with time to adjust their behavior while the actual shock has not realized. See my last post at [Deterministic Shock in A Stochastic Model- IRF)

Dear Jpfeifer,

Thanks for your explaination.

However, I find another problem: When I use “mode_compute=5”, I got the following warning:

Check whether your model in truly linear
lambda = -7.7435e-09; f = 1130.9424644
STEADY: numerical initial values or parameters incompatible with the following equations
32

Check whether your model in truly linear
lambda = -2.5812e-09; f = 1130.9424644
Norm of dx NaN
Try gradient direction
Predicted improvement: 0.000004632
lambda = 1; f = 1129.9424592
Norm of dx 3.0437e-05
No further improvement is possible!
Warning: Matrix is singular to working precision.]
> In mr_hessian at 212
In newrat at 175
In dynare_estimation_1 at 337
In dynare_estimation at 89
In code at 1041
In dynare at 180]
Warning: Matrix is singular, close to singular or badly scaled. Results may be inaccurate. RCOND
= NaN.]
> In mr_hessian at 219
In newrat at 175
In dynare_estimation_1 at 337
In dynare_estimation at 89
In code at 1041
In dynare at 180]
Warning: Matrix is singular, close to singular or badly scaled. Results may be inaccurate. RCOND
= NaN.]
> In mr_hessian at 220
In newrat at 175
In dynare_estimation_1 at 337
In dynare_estimation at 89
In code at 1041
In dynare at 180]
Warning: Matrix is singular, close to singular or badly scaled. Results may be inaccurate. RCOND
= NaN.]
> In mr_hessian at 230
In newrat at 175
In dynare_estimation_1 at 337
In dynare_estimation at 89
In code at 1041
In dynare at 180]
Actual dxnorm 3.0439e-05
FVAL 1129.9425
Improvement 5.2553e-06
Ftol 1e-05
Htol 1e-05
Gradient norm 9.5013
Minimum Hessian eigenvalue 1
Maximum Hessian eigenvalue 1
Estimation successful.

But the code can still work and estimation can be done. I also used “model diagnosis” and no problem is referred. What’s the problem? Is the estimation result reliable?

Regards,

Sorry, but I cannot replicate the issue. Did you use a mode-file?

Dear Jpfeifer:

I just correct some priors of my code and found the following warning when I set"mode_compute=5":

Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND =
6.288194e-21.]
> In newrat at 135
In dynare_estimation_1 at 337
In dynare_estimation at 89
In code at 1044
In dynare at 180]

Here attached my new code and data file. Except for the warnings, everything seems to be well. Can I trust this result?
ddata.xls (39.5 KB)
code.mod (10.7 KB)

As always, this is hard to tell. If you think your model is correct, warnings like this during optimization are not a problem. The worst that can happen is that you do not get the right mode and convergence and mixing behavior are poor. What you can always try is using the found mode as a mode-file for a different optimizer to cross-check the result.