Stored results policy and transition function

Hi all,

I have a Dynare mod file that does both simulation and bayesian estimation. Therefore, the reported policy and transition function in the command window does not match the workspace oo_.dr.ghx and oo_dr.ghu results. My question is, which solution do these two variables in the workspace represent? Is it just the solution of my last MCMC-drawn parameters or what? Is there a way to solve and store the policy transition matrix for each draw?

three_eq_nk3.mod (3.3 KB)

You mean at the end of estimation? It should be from the last draw. You could use a posterior_function to get the policy functions for posterior draws. But what exactly are you trying to do?

Thank you, prof Pfeifer! The reason I need all the policy function values is that my JMP is doing something that requires the solutions from each MCMC draw.

Then you should go for the posterior_function approach. An example is DSGE_mod/Jermann_Quadrini_2012/Jermann_Quadrini_2012_NK at master · JohannesPfeifer/DSGE_mod · GitHub

Hi, prof Pfeifer, I have a follow-up question, in my case, I should put the posterior_function(function ) in the mod file after the estimation section, right? Essentially what it does is compute the policy functions again, with the posterior draws? And I need to input a function to do the policy function computation for each draw by specifying sampling_draws =# of posterior draws? What would the function be? Sorry I could not find it…

This should do the trick:
three_eq_nk3.mod (3.4 KB)
get_policy_rules.m (1.3 KB)

That works! You are a lifesaver! To better understand these results, if I have 4 chains, each with 10000 draws and mh_drop=0.5, when I set sample_draw numbers = 20000, which is the max number allowed. Should the retrieved policy functions correspond to each draw in three_eq_nk3_mh1_blck from 5001-10000 from file 1 to file 4 in order? It’s weird when I searched through the 20000 results and could not find one match for my final oo_.dr.ghx result, which should be the last draw for the last chain, right?

No, this will be a random subsample from the draws.

I see, well that’s not exactly what I want. I guess I just need one more output from get_policy_rules.m together with the policy functions so that the draws and policies match, should it be M_.params?

That depends on whether you want the full parameter vector or just the estimated parameters. xparam1 is the estimated one.