Help on imposing restrictions on the parameter draws!

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.

Help on imposing restrictions on the parameter draws!

Postby Econbee » Sat Nov 30, 2013 4:24 pm

Hi everyone,

I am estimating a DSGE model. According to the way in which I calibrate parameters and calculate steady state, certain regions of some parameters will deliver unreasonable (out-of-bound or complex) steady state values. Also, certain regions of the parameter space imply model indeterminacy. Unfortunately, there is no closed-form for these boundaries of the parameter space. So, during the searching of the posterior mode and Metropolis-Hastings MCMC, I need to check whether a candidate draw is valid in every iteration. I have an external files solely for solving the steady state and checking for validity. I am wondering if this kind of checking can be embedded in Dynare. How can I be sure Dynare implement this kind of checking all the time?

Thanks a lot for any hints or suggestions!
Econbee
 
Posts: 74
Joined: Fri Nov 08, 2013 8:14 am

Re: Help on imposing restrictions on the parameter draws!

Postby Econbee » Mon Dec 02, 2013 4:03 am

Is there anyone who could provide me some hints? Maybe my previous post is not clear enough. Let me describe my question more clearly as follows:

Right now I am estimating a standard DSGE model similar to Smets and Wouters (2007). The steady state and some calibrated parameters are nonlinear functions of the parameters to be estimated. According to the way in which I calculate steady state values, certain regions of the parameter space deliver unreasonable parameter values and steady state values. For example, some calculated parameters may be out of bound, such as the depreciate rate being larger than one or smaller than zero. Sometimes, the steady state values turn out to be complex numbers. Also, certain regions of the parameter space imply model indeterminacy. Obviously, I would like to discard any draw from these regions during the estimation. Unfortunately, there is no closed-form for these boundaries of the parameter space. So, when searching for the posterior mode and doing Metropolis-Hastings MCMC, I check whether a candidate draw is valid in every iteration. I have external files solely for solving the steady state and checking for parameter validity. Right now, I use my own codes. I am thinking of transiting to Dynare and benefit from the sophisticated functionality of Dynare. But I am not sure if Dynare is flexible enough to embed these kinds of checking into the toolbox.

I guess Dynare has already guaranteed model determinacy during model estimation, right? If so, how is it realized? There must be some kind of checking somewhere in the source code. What I need is just to add some additional checking to the code. I just don't know if it is possible and how it could be done.

Thank you very much!
Econbee
 
Posts: 74
Joined: Fri Nov 08, 2013 8:14 am

Re: Help on imposing restrictions on the parameter draws!

Postby jpfeifer » Mon Dec 02, 2013 4:46 pm

Dynare always checks for
- Blanchard Kahn conditions (unstable and indeterminate solutions)
- existence of steady state
- complex steady states
- violation or prior bounds
- positive definite covariance matrices

You don't have to take care of this yourself. Your example of depreciation would be solved by imposing a beta prior. One way to impose checks yourself is using a steady state file and setting the check indicator to 1 in case of failure. See the NK_baseline.mod in the Dynare examples folder to the recent snapshot.
------------
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: Help on imposing restrictions on the parameter draws!

Postby Econbee » Mon Dec 02, 2013 5:48 pm

Thank you so much, jpfeifer! Your hints are very useful!

As you suggested, I took a look at NK_baseline.mod in the Dynare examples folder to the recent snapshot. The situation described in that file shown as below is quite similar to my case.

"The following parameters are set in the steady state file as they depend on other deep parameters that were estimated in the original study. Setting them in the steady state file means they are updated for every parameter draw in the MCMC algorithm,..."

From my experience, for some draws in the MCMC algorithm, either the updated parameters are out of bounds such as the depreciation rate being less than zero or some steady state values are complex. In this case, imposing prior on the updated parameters does not seem to work as they are not estimated parameters from the first place.

Therefore, imposing checks seems to be the right way to go. You suggested "One way to impose checks yourself is using a steady state file and setting the check indicator to 1 in case of failure." Right now, I do have a steady state file and I do have indicators, in which 1 implies failure. With all these files, is Dynare able to take care of the failure draw automatically by discarding the draw and searching for a new candidate draw? If not, what kind of additional programming do we need?

Dear jpfeifer, I am not very familiar with the fundamental programming of Dynare. And I am not sure if the Dynare group is just working on this kind of problems right now. I just hope to get more of your hints and suggestions. I really appreciate your time and attention!!!
Econbee
 
Posts: 74
Joined: Fri Nov 08, 2013 8:14 am

Re: Help on imposing restrictions on the parameter draws!

Postby jpfeifer » Tue Dec 03, 2013 2:37 pm

Tomorrow's snapshot will have an updated version of the file that shows how to do this. To see it immediately, go to https://github.com/JohannesPfeifer/dynare/blob/1b5641575f0f3e6f22c5d62f386446bdc774b491/examples/NK_baseline_steadystate.m
------------
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: Help on imposing restrictions on the parameter draws!

Postby Econbee » Tue Dec 03, 2013 3:39 pm

Thanks so much for your kind reply, jpfeifer! The updated steady state file is much more clear and instructive. And my problem is nearly solvable with what the latest version provides.

To better understand the mechanism of Dynare, I have three related follow-up questions:

1. During the search for posterior mode and MH-MCMC, the steady state file will be called every time a new candidate draw is obtained. Suppose a draw is invalid and the check indicator in the steady state file is set to 1. This would stop the steady state function immediately and return to the invoking function. At this time, does Dynare stop with error message or just ignore the previous invalid draw and try another draw? In fact, what we need is the latter one and don't want Dynare to stop. In my own code, this could be simply done with a while loop. But I am not sure how this is done in Dynare?

2. In most .mod files, there is a line "check;" after "steady;". Is this line of "check" solely for checking BK condition for determinacy? Or is it related to the check indicator from the steady-state function?

3. Yesterday, you mentioned that "Dynare always checks for Blanchard Kahn conditions (unstable and indeterminate solutions), existence of steady state, complex steady states, violation or prior bounds and positive definite covariance matrices". When any of these is violated during MCMC or mode search, would Dynare stop immediately or discard the current draw and try another draw? If the latter one, why are there so many error messages in the forum saying that "BK condition not satisfied"? Is that because those are for stochastic simulation based on a given set of parameters instead of estimation?

The questions may look naive to the Dynare experts. But I am just a new beginner and want to transit to Dynare. Again, I really appreciate your time, attention and patience!
Econbee
 
Posts: 74
Joined: Fri Nov 08, 2013 8:14 am

Re: Help on imposing restrictions on the parameter draws!

Postby jpfeifer » Tue Dec 03, 2013 5:39 pm

1. Whenever an invalid draw in encoutered (e.g. check=1), this proposed draw is discarded and the current entry of the MC Markov Chain is set to the previous draw. There is no error message. Rather, the proposed draw obtains likelihood 0, is rejected, and the MCMC continues. This exactly the procedure detailed in An/Schorfheide (2007).

2. The check command has nothing to do with check indicator. The check indicator is only a variable local to the steady state file.

3. Yes, as detailed in 1) in those cases a new draw is tried. The error messages you always see do not come from the MCMC. They come from stoch_simul (stochastic simulation with wrong timing or parameter values). The only case you get such an error message from estimation is when the first draw, i.e. the starting value for estimation is invalid.
------------
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: Help on imposing restrictions on the parameter draws!

Postby Econbee » Wed Dec 04, 2013 1:45 am

Great! Thanks so much for your answers, jpfeifer! I will try to code it up soon and see how it works.
Econbee
 
Posts: 74
Joined: Fri Nov 08, 2013 8:14 am


Return to Dynare help

Who is online

Users browsing this forum: Google [Bot] and 5 guests