Could anyone please explain how to calculate the credit (confidence) intervals for some deep parameters after Bayesian estimation. For example, assume that I have estimated parameters x and y using Bayesian method, so that both have posterior density. Now if I would like to know the credit intervals or density of z, which is a deep parameter in the model and z=x/y. Is there a method to do that? Many thanks.
Not sure I understand the question perfectly, but i will have a go at answering it.
You can do it easily enough by loading the matrix x2 in the mh_block file from the metropolis folder that is created when you do MCMC, or you can pick random draws from that matrix.
If you have say 1000 draws for x and 1000 draws of y, z=x./y (that is element by element), and then use the matlab percentile commands to get the intervals, or do a ksdensity or histogram if you are interested in that.
I guess you mean “credible sets”. Note that if
z=x/y, then z is not a deep parameter, but rather an object derived from the deep parameters
To compute its density, you can rely on the posterior draws of
y and compute the statistics of interest the way @punnoosejacob suggested.
A related question. When I plot density of z (which is a parameter whose value is defined in the steady and dependent on x and y, and changes every time during each estimation), I notice that some values of z are negative. So there seems to be some MCMC draws that lead to negative z. However, the economic meaning of z should be positive (imagine it is standard deviation). And z matters as it affects the steady state of the model. So I am wondering whether there is a simple way to restrict the process of MCMC during estimation, so that whenever z is negative, the corresponding draws are dropped? Is changing the likelihood of estimated function to -infty going to work? If so, where can I find the dynare code file that contains that likelihood function? Many thanks!
As far as I know, i dont think you can restrict the domain of the parameters MCMC with say a command like estimated_param_bounds. That can be applied only for the optimisation.
But in your case, you can simply discard the negative draws for the relevant parameters using an if condition, right? In principle, that would not be very different from restricting the domain for MCMC?
If you are using a steady state file that is easy to do. Simply set the
check-indicator to 1 if the condition is violated.
I would like to have continuous draws. Discarding it would create non continuous draws I guess…
Thank you! So I set check=1 whenever z does not make sense, and then MCMC will reject this draw and return to the previous one?
check=1 is the indicator for discarding draws. The MCMC will then continue with the previous draw. @punnoosejacob That is important, because otherwise the reversibility condition would not be satisfied and you do not obtain correct draws from the posterior. For that reason, you cannot simply take the posterior without this restriction and throw away some draws.
But @jpfeifer , when Dynare runs MCMC, does it not accept parameter draws that satisfy the Blanchard-Kahn conditions for a stable unique solution? It does discard other potential parameter sets. Does that routine ensure reversibility as well?
The reversibility condition roughly states that you need to be as likely to jump from one parameter vector to another as it is likely to jump back. That is e.g. ascertained by staying at a particular parameter vector instead of jumping if the BK conditions are not violated. This results in a valid posterior.
Now consider the case above where you impose a restriction on
z being positive. If you ran an MCMC without this restriction, you may have that you jumped from
z=2. You suggested to now throw away the draw with
z=-1 so that the sequence would become
z=1, z=2. But that would be wrong. You are not allowed to jump to
z=-1 so you stay at
z=1 and now need to consider how likely it is to jump to
z=2. Therefore, a valid posterior Markov Chain would look very different.