Posterior predictive checks

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.

Re: Posterior predictive checks

Postby hodabbbb » Wed Mar 22, 2017 1:59 pm

Hi Professor Pfeifer !
As a replacement to my last post I have a slightly different thought!

As an update have been thinking of using the ''posterior_demo_function.m '' by combining the posterior distribution from two differnt estimations but
(with my not-so-good knowledge) I have not come up with the solution.

What is in my mind is that I use the draw a sample of i.e.100 simulated series but I want the the posterior for some (one or two) parameters to come from a different estimation
rather than from my baseline estimation . let's say a different '' M_ = set_all_parameters(xparam1,estim_params_,M_); '' from another estimation

For example I like the parameters ''alpha'' and ''beta'' to come from a different estimation_1. '' M_ = set_all_parameters(xparam1,estim_params_,M_); '' so that I overwrite
the mean, mode and credible interval that I have in my baseline estimation_0 for these two parameters .

Is it possible by manipulating the '' M_ = set_all_parameters(xparam1,estim_params_,M_); '' ?

Many thanks in advance Professor!
hodabbbb
 
Posts: 39
Joined: Wed Mar 25, 2015 3:58 pm

Re: Posterior predictive checks

Postby jpfeifer » Thu Mar 23, 2017 8:51 am

That is not easily possible. The way to go here would be to use the
Code: Select all
posterior_sampler
to return you the posterior parameters from both estimations. Then you need to write your own function looping over these parameters, combining them and then loop over setting them and running the desired command to compute the posterior objects.
------------
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: Posterior predictive checks

Postby hodabbbb » Thu Mar 23, 2017 3:09 pm

Many thanks for your patience Professor !
Following your post, I checked the ''posterior_sampler.m'' function . As you said it is involving.
It is a good excercise though.

When /and/ if you get some free time may I asK:
what would be the ''TargetFun'' and ''ProposalFun'' in this case (from the list below of the inputs of the ''posterior_sampler'' ).
I am trying to se how I can do the first step only, i,.e (recall the posterior parameters from both estimations)

0005 % INPUTS
0006 % o TargetFun [char] string specifying the name of the objective
0007 % function (posterior kernel).
0008 % o ProposalFun [char] string specifying the name of the proposal
0009 % density
0010 % o xparam1 [double] (p*1) vector of parameters to be estimated (initial values).
0011 % o sampler_options structure
0012 % .invhess [double] (p*p) matrix, posterior covariance matrix (at the mode).
0013 % o mh_bounds [double] (p*2) matrix defining lower and upper bounds for the parameters.
0014 % o dataset_ data structure
0015 % o dataset_info dataset info structure
0016 % o options_ options structure
0017 % o M_ model structure
0018 % o estim_params_ estimated parameters structure
0019 % o bayestopt_ estimation options structure
0020 % o oo_ outputs structure
hodabbbb
 
Posts: 39
Joined: Wed Mar 25, 2015 3:58 pm

Re: Posterior predictive checks

Postby jpfeifer » Thu Mar 23, 2017 6:50 pm

I did not mean to imply changing that function. That is most probably too involved for you. Rather, that function rather executes the simulation with the
Code: Select all
posterior_function_demo

you wrote. What I meant is returning within
Code: Select all
posterior_function_demo

the posterior draws
Code: Select all
output_cell{1,1}=xparam1;

You can do this for the two estimations you ran separately. That gives you the posterior draws. Afterwards, you can loop over these draws, e.g. http://www.dynare.org/phpBB3/viewtopic.php?f=1&t=4891
------------
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: Posterior predictive checks

Postby hodabbbb » Mon Mar 27, 2017 10:24 am

Apologies for the late reply Professor. I have not been around these days.

Before I try looping over them (I have to go over details of the link you gave) - I just want to make clear to myself.
When I draw a sample of (let's say) 1000 draws using the

posterior_function_demo

(after the estimation command), I basically get 1000 simulated ariables Y,C, etc.
Now my question is am I drawing these draws over the distribution of the estimated parameters or over the distribution of the shocks ?
(I wonder if the question if formulated right !!)
(To mke myself clearer) how does the ''sampler'' obtain the the 1000 different simulated Y's that I get, by ''drawing''
over the distribution of the respective parameter (computed with the MH )?
or over the distribution of the shocks (shock distribution is again computed via MH in this case unlike in a calibrated model ) ???
or over both these (as both the parameters and the size of shocks are considered parameters during the estimation and their distribution is computed via the the MCMH-replic procedure ) ?

ps. I would assume the last one ! Is that right pls ?
hodabbbb
 
Posts: 39
Joined: Wed Mar 25, 2015 3:58 pm

Re: Posterior predictive checks

Postby jpfeifer » Mon Mar 27, 2017 6:36 pm

Your simulation has two dimensions.There are N=1000 simulations with say T=2000 time periods. Each of the N simulated series will be based on a different parameter draw from the posterior (but sampled with replacement). At the same time, for each n in N, the stochastic shocks for each t in T are drawn randomly from the shock distribution based on the current parameter set. You could in principle fix the random number generator seed to avoid random chatter, but this is not done by default.
------------
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: Posterior predictive checks

Postby hodabbbb » Tue Mar 28, 2017 4:44 pm

Thank you Professor!

That is useful to know when it comes to application .

kind regards
hodabbbb
 
Posts: 39
Joined: Wed Mar 25, 2015 3:58 pm

Previous

Return to Dynare help

Who is online

Users browsing this forum: No registered users and 6 guests