Error in mode finding

This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location where you will have to reset your password.
Forum rules
This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location (https://forum.dynare.org) where you will have to reset your password.

Error in mode finding

Postby Grant » Tue Sep 23, 2014 8:50 am

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,
Attachments
data100.xls
(39.5 KiB) Downloaded 114 times
code.mod
(10.61 KiB) Downloaded 149 times
irf.pdf
(128.4 KiB) Downloaded 133 times
Grant
 
Posts: 95
Joined: Tue Jun 10, 2014 2:37 pm

Re: Error in mode finding

Postby Grant » Wed Sep 24, 2014 3:40 am

Anyone can help?
Grant
 
Posts: 95
Joined: Tue Jun 10, 2014 2:37 pm

Re: Error in mode finding

Postby jpfeifer » Wed Sep 24, 2014 11:56 am

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.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: Error in mode finding

Postby Grant » Thu Sep 25, 2014 4:24 am

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,
Grant
 
Posts: 95
Joined: Tue Jun 10, 2014 2:37 pm

Re: Error in mode finding

Postby jpfeifer » Thu Sep 25, 2014 6:19 am

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 http://www.dynare.org/phpBB3/viewtopic.php?f=1&t=5936
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: Error in mode finding

Postby Grant » Thu Sep 25, 2014 12:43 pm

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 <a href="matlab: opentoline('C:\dynare\4.4.3\matlab\mr_hessian.m',212,1)">mr_hessian at 212</a>
In <a href="matlab: opentoline('C:\dynare\4.4.3\matlab\newrat.m',175,1)">newrat at 175</a>
In <a href="matlab: opentoline('C:\dynare\4.4.3\matlab\dynare_estimation_1.m',337,1)">dynare_estimation_1 at 337</a>
In <a href="matlab: opentoline('C:\dynare\4.4.3\matlab\dynare_estimation.m',89,1)">dynare_estimation at 89</a>
In <a href="matlab: opentoline('C:\Users\English\Desktop\2 new mode5 0.5 0.1 2 4 period\code.m',1041,1)">code at 1041</a>
In <a href="matlab: opentoline('C:\dynare\4.4.3\matlab\dynare.m',180,1)">dynare at 180</a>]
[Warning: Matrix is singular, close to singular or badly scaled. Results may be inaccurate. RCOND
= NaN.]
[> In <a href="matlab: opentoline('C:\dynare\4.4.3\matlab\mr_hessian.m',219,1)">mr_hessian at 219</a>
In <a href="matlab: opentoline('C:\dynare\4.4.3\matlab\newrat.m',175,1)">newrat at 175</a>
In <a href="matlab: opentoline('C:\dynare\4.4.3\matlab\dynare_estimation_1.m',337,1)">dynare_estimation_1 at 337</a>
In <a href="matlab: opentoline('C:\dynare\4.4.3\matlab\dynare_estimation.m',89,1)">dynare_estimation at 89</a>
In <a href="matlab: opentoline('C:\Users\English\Desktop\2 new mode5 0.5 0.1 2 4 period\code.m',1041,1)">code at 1041</a>
In <a href="matlab: opentoline('C:\dynare\4.4.3\matlab\dynare.m',180,1)">dynare at 180</a>]
[Warning: Matrix is singular, close to singular or badly scaled. Results may be inaccurate. RCOND
= NaN.]
[> In <a href="matlab: opentoline('C:\dynare\4.4.3\matlab\mr_hessian.m',220,1)">mr_hessian at 220</a>
In <a href="matlab: opentoline('C:\dynare\4.4.3\matlab\newrat.m',175,1)">newrat at 175</a>
In <a href="matlab: opentoline('C:\dynare\4.4.3\matlab\dynare_estimation_1.m',337,1)">dynare_estimation_1 at 337</a>
In <a href="matlab: opentoline('C:\dynare\4.4.3\matlab\dynare_estimation.m',89,1)">dynare_estimation at 89</a>
In <a href="matlab: opentoline('C:\Users\English\Desktop\2 new mode5 0.5 0.1 2 4 period\code.m',1041,1)">code at 1041</a>
In <a href="matlab: opentoline('C:\dynare\4.4.3\matlab\dynare.m',180,1)">dynare at 180</a>]
[Warning: Matrix is singular, close to singular or badly scaled. Results may be inaccurate. RCOND
= NaN.]
[> In <a href="matlab: opentoline('C:\dynare\4.4.3\matlab\mr_hessian.m',230,1)">mr_hessian at 230</a>
In <a href="matlab: opentoline('C:\dynare\4.4.3\matlab\newrat.m',175,1)">newrat at 175</a>
In <a href="matlab: opentoline('C:\dynare\4.4.3\matlab\dynare_estimation_1.m',337,1)">dynare_estimation_1 at 337</a>
In <a href="matlab: opentoline('C:\dynare\4.4.3\matlab\dynare_estimation.m',89,1)">dynare_estimation at 89</a>
In <a href="matlab: opentoline('C:\Users\English\Desktop\2 new mode5 0.5 0.1 2 4 period\code.m',1041,1)">code at 1041</a>
In <a href="matlab: opentoline('C:\dynare\4.4.3\matlab\dynare.m',180,1)">dynare at 180</a>]
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,
Grant
 
Posts: 95
Joined: Tue Jun 10, 2014 2:37 pm

Re: Error in mode finding

Postby jpfeifer » Fri Sep 26, 2014 9:06 am

Sorry, but I cannot replicate the issue. Did you use a mode-file?
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: Error in mode finding

Postby Grant » Fri Sep 26, 2014 9:51 am

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 <a href="matlab: opentoline('C:\dynare\4.4.3\matlab\newrat.m',135,1)">newrat at 135</a>
In <a href="matlab: opentoline('C:\dynare\4.4.3\matlab\dynare_estimation_1.m',337,1)">dynare_estimation_1 at 337</a>
In <a href="matlab: opentoline('C:\dynare\4.4.3\matlab\dynare_estimation.m',89,1)">dynare_estimation at 89</a>
In <a href="matlab: opentoline('C:\Users\English\Desktop\2 dd mode5 0.5 0.001 0.01\code.m',1044,1)">code at 1044</a>
In <a href="matlab: opentoline('C:\dynare\4.4.3\matlab\dynare.m',180,1)">dynare at 180</a>]

Here attached my new code and data file. Except for the warnings, everything seems to be well. Can I trust this result?
Attachments
ddata.xls
(39.5 KiB) Downloaded 121 times
code.mod
(10.73 KiB) Downloaded 131 times
Grant
 
Posts: 95
Joined: Tue Jun 10, 2014 2:37 pm

Re: Error in mode finding

Postby jpfeifer » Fri Sep 26, 2014 11:35 am

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.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany


Return to Dynare help

Who is online

Users browsing this forum: No registered users and 4 guests

cron