Seeking help with Bayesian Estimation

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.

Seeking help with Bayesian Estimation

Postby alphaxuan » Wed Mar 05, 2014 12:37 pm

Hi everyone,
I'm trying to do Bayesian Estimation for my model. The simulation/IRFs work well, but when I run the attached estimation codes, the following pops up and I couldn't get the posterior (only the prior). Attached file wxirf is for IRFs, simudata1 is the datafile for varobs and wxirfsimu is the estimation codes. I'd sincerely appreciate some help! Thank you!



"There are 21 eigenvalue(s) larger than 1 in modulus
for 21 forward-looking variable(s)

The rank condition is verified.


You did not declare endogenous variables after the estimation/calib_smoother command.
Loading 500 observations from simudata1.m

Initial value of the log posterior (or likelihood): 7103.4895

SOLVE: maxit has been reached

SOLVE: maxit has been reached
bad gradient ------------------------
-----------------
-----------------
f at the beginning of new iteration, -7103.4894707395
Predicted improvement: 0.000000000
lambda = 1; f = -7103.4894707
Norm of dx 0

SOLVE: maxit has been reached

SOLVE: maxit has been reached
bad gradient ------------------------
Cliff. Perturbing search direction.
Predicted improvement: 0.000000000
lambda = 1; f = -7103.4894707
Norm of dx 0

SOLVE: maxit has been reached

SOLVE: maxit has been reached
bad gradient ------------------------
----
Improvement on iteration 1 = 0.000000000
improvement < crit termination
Objective function at mode: -7103.489471

SOLVE: maxit has been reached

SOLVE: maxit has been reached

RESULTS FROM POSTERIOR MAXIMIZATION
parameters
prior mean mode s.d. t-stat prior pstdev

d 0.200 0.2000 0.0070 28.7453 norm 0.0500

Log data density [Laplace approximation] is 7099.440496.

MH: Multiple chains mode.
MH: Old metropolis.log file successfully erased!
MH: Creation of a new metropolis.log file.
MH: Searching for initial values...

SOLVE: maxit has been reached

SOLVE: maxit has been reached

SOLVE: maxit has been reached

SOLVE: maxit has been reached

SOLVE: maxit has been reached

SOLVE: maxit has been reached

SOLVE: maxit has been reached

SOLVE: maxit has been reached

SOLVE: maxit has been reached

SOLVE: maxit has been reached

SOLVE: maxit has been reached

SOLVE: maxit has been reached

SOLVE: maxit has been reached

SOLVE: maxit has been reached

SOLVE: maxit has been reached

SOLVE: maxit has been reached

SOLVE: maxit has been reached

SOLVE: maxit has been reached

SOLVE: maxit has been reached

SOLVE: maxit has been reached

SOLVE: maxit has been reached

SOLVE: maxit has been reached

SOLVE: maxit has been reached

SOLVE: maxit has been reached

SOLVE: maxit has been reached

SOLVE: maxit has been reached

SOLVE: maxit has been reached

SOLVE: maxit has been reached

SOLVE: maxit has been reached

SOLVE: maxit has been reached

SOLVE: maxit has been reached

SOLVE: maxit has been reached

SOLVE: maxit has been reached

SOLVE: maxit has been reached

SOLVE: maxit has been reached

SOLVE: maxit has been reached

SOLVE: maxit has been reached

SOLVE: maxit has been reached

SOLVE: maxit has been reached

SOLVE: maxit has been reached

SOLVE: maxit has been reached

SOLVE: maxit has been reached

SOLVE: maxit has been reached

SOLVE: maxit has been reached

SOLVE: maxit has been reached

SOLVE: maxit has been reached

SOLVE: maxit has been reached

SOLVE: maxit has been reached

SOLVE: maxit has been reached

SOLVE: maxit has been reached

SOLVE: maxit has been reached

SOLVE: maxit has been reached

SOLVE: maxit has been reached

SOLVE: maxit has been reached

SOLVE: maxit has been reached

SOLVE: maxit has been reached

SOLVE: maxit has been reached

SOLVE: maxit has been reached

SOLVE: maxit has been reached

SOLVE: maxit has been reached

SOLVE: maxit has been reached

SOLVE: maxit has been reached

SOLVE: maxit has been reached

SOLVE: maxit has been reached

SOLVE: maxit has been reached

SOLVE: maxit has been reached

SOLVE: maxit has been reached

SOLVE: maxit has been reached

SOLVE: maxit has been reached

SOLVE: maxit has been reached

SOLVE: maxit has been reached

SOLVE: maxit has been reached

SOLVE: maxit has been reached

SOLVE: maxit has been reached

SOLVE: maxit has been reached

SOLVE: maxit has been reached

SOLVE: maxit has been reached

SOLVE: maxit has been reached

SOLVE: maxit has been reached

SOLVE: maxit has been reached

SOLVE: maxit has been reached

SOLVE: maxit has been reached

SOLVE: maxit has been reached

SOLVE: maxit has been reached

SOLVE: maxit has been reached

SOLVE: maxit has been reached

SOLVE: maxit has been reached

SOLVE: maxit has been reached

SOLVE: maxit has been reached

SOLVE: maxit has been reached

SOLVE: maxit has been reached

SOLVE: maxit has been reached

SOLVE: maxit has been reached

SOLVE: maxit has been reached

SOLVE: maxit has been reached

SOLVE: maxit has been reached

SOLVE: maxit has been reached

SOLVE: maxit has been reached

SOLVE: maxit has been reached

SOLVE: maxit has been reached

SOLVE: maxit has been reached
MH: I couldn't get a valid initial value in 100 trials.
MH: You should Reduce mh_init_scale...
MH: Parameter mh_init_scale is equal to 0.400000.
MH: Enter a new value... "
Attachments
wxirfsimu.mod
for estimation
(7.87 KiB) Downloaded 53 times
wxirf.mod
simulation/irf
(7.81 KiB) Downloaded 49 times
simudata1.m
datafile
(352.66 KiB) Downloaded 46 times
alphaxuan
 
Posts: 11
Joined: Tue Feb 11, 2014 10:56 pm

Re: Seeking help with Bayesian Estimation

Postby jpfeifer » Wed Mar 05, 2014 1:21 pm

Dynare has a hard time finding the steady state given your initval-block. Please upgrade to 4.4.2 and replace
Code: Select all
steady;

by
Code: Select all
steady(solve_algo=4);

This uses a trust-region solver and performs better in your case.
------------
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: Seeking help with Bayesian Estimation

Postby alphaxuan » Wed Mar 05, 2014 1:41 pm

jpfeifer wrote:Dynare has a hard time finding the steady state given your initval-block. Please upgrade to 4.4.2 and replace
Code: Select all
steady;

by
Code: Select all
steady(solve_algo=4);

This uses a trust-region solver and performs better in your case.


Hi jpfeifer,
Thank you so much! But I use macbook and it seems that 4.4.2 is only available for Windows users? Can I use 4.4.0 on Macbook? Thanks.
alphaxuan
 
Posts: 11
Joined: Tue Feb 11, 2014 10:56 pm

Re: Seeking help with Bayesian Estimation

Postby alphaxuan » Wed Mar 05, 2014 1:56 pm

jpfeifer wrote:Dynare has a hard time finding the steady state given your initval-block. Please upgrade to 4.4.2 and replace
Code: Select all
steady;

by
Code: Select all
steady(solve_algo=4);

This uses a trust-region solver and performs better in your case.

Dear jpfeifer,
May I ask that if you tried my codes on 4.4.2 and they worked? I just upgraded to 4.4.0 on macbook (4.4.2 is not available for macbook), but I still get the same response. In particular, I don't understand why it says 'You did not declare endogenous variables after the estimation/calib_smoother command'. I'd be grateful for your help. Thank you very much!
'
alphaxuan
 
Posts: 11
Joined: Tue Feb 11, 2014 10:56 pm

Re: Seeking help with Bayesian Estimation

Postby jpfeifer » Wed Mar 05, 2014 2:30 pm

You did not declare endogenous variables after the estimation/calib_smoother command
is an unrelated warning. Ignore it.

Your codes worked with 4.4.2. What you can do if you only have 4.4.0 is the following: replace the dynare_solve.m with the one from https://github.com/DynareTeam/dynare/blob/master/matlab/dynare_solve.m and add the trust_region.m from https://github.com/DynareTeam/dynare/blob/master/matlab/trust_region.m
That should yield the 4.4.2 functionality you need.
------------
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: Seeking help with Bayesian Estimation

Postby alphaxuan » Thu Mar 06, 2014 2:25 am

jpfeifer wrote:
You did not declare endogenous variables after the estimation/calib_smoother command
is an unrelated warning. Ignore it.

Your codes worked with 4.4.2. What you can do if you only have 4.4.0 is the following: replace the dynare_solve.m with the one from https://github.com/DynareTeam/dynare/blob/master/matlab/dynare_solve.m and add the trust_region.m from https://github.com/DynareTeam/dynare/blob/master/matlab/trust_region.m
That should yield the 4.4.2 functionality you need.


Dear jpfeifer,
Thank you so much for your suggestions! It worked, but there's something less ideal about my posterior distribution. Normally, I'd expect the posterior to be tighter than the prior distribution, but in my case, they are of similar width and even have the same mean. It seems that posterior isn't very much different from the prior. Does it mean bayesian estimation isn't very useful in my case? What could be potential problems here? Thanks a lot!
alphaxuan
 
Posts: 11
Joined: Tue Feb 11, 2014 10:56 pm

Re: Seeking help with Bayesian Estimation

Postby jpfeifer » Thu Mar 06, 2014 10:42 am

To find that out, use the various diagnostics provided by Dynare. mode_check, convergence diagnostics, identification, etc.
------------
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: Seeking help with Bayesian Estimation

Postby alphaxuan » Thu Mar 06, 2014 1:21 pm

jpfeifer wrote:To find that out, use the various diagnostics provided by Dynare. mode_check, convergence diagnostics, identification, etc.

Dear jpfeifer,
I'm new to Dynare. Would you point to the right direction for me as to how to implement such diagnostics? Thank you!
alphaxuan
 
Posts: 11
Joined: Tue Feb 11, 2014 10:56 pm

Re: Seeking help with Bayesian Estimation

Postby jpfeifer » Sat Mar 08, 2014 11:33 am

See the manual. Just search for the things. For mode_check, you need to specify this option in the estimation-command. Convergence Diagnostics should be computed by default. In your case, use two chains.
------------
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: Google [Bot] and 6 guests