Hello
I think it is possible to sample from the predictive distribution using the
zero trick. First you need to use the zero trick to set up a pior for each
predictive distribution. This should be documented (It is in OpenBUGS). You
basically set up a flat prior and then use the zero trick to set up a likelihood
equal to the prior you really want. However I can see a problem here if the
predicive distribution contains unknown parameters doing this will alter the
likelihood for these unknown parameters and hence their estimation. I think
you can get round his by using the cut function in the likelihood you add for
the prediction. Note that BUGS will use metropolis hastings to do the sampling
from the predictive distribution.
Regards
Andrew
On 03/02/2012, Dr. Pablo E. Verde <[log in to unmask]> wrote:
> Hi Dipankar,
>
> Basically, if you have a vector with 7 elements, like my example, you should
> add 7 NAs to your
> data vector and WinBUGS will sample from the predictive posterior.
>
> It is assumed that your data is exchangeable and the predictive posterior
> data as well, so
> the order doesn't mater.
>
> Cheers, Pablo
>
> ----- Original Message -----
> From: Dipankar Bandyopadhyay
> To: [log in to unmask]
> Sent: Thursday, February 02, 2012 7:44 PM
> Subject: Re: [BUGS] generating replicates from zeros trick
>
>
> Thank you Pablo for this solution, but how would I generate "replicates"
> of the first element in your data-vector (i.e. 2) coming from the posterior
> predictive distribution?
>
>
> Dipankar
>
>
>
>
>
>
>
> On Thu, Feb 2, 2012 at 10:16 AM, Dr. Pablo E. Verde
> <[log in to unmask]> wrote:
>
>
> Hi Dipankar,
>
> The answer is not, you cannot sample from the predictive posterior in
> your way.
>
> The easy way to sample from the predictive posterior while you using the
> zeros trick is
> by adding artificial missing data to your data vector.
>
> So if your data set is in a list:
>
> list(x =c(2,5,6,2,4,7,8))
>
> Then do
>
> list(x =c(2,5,6,2,4,7,8, NA, , NA, NA, NA, NA))
>
> the values of x[8:12] are sampled automatically from the predictive
> posterior.
>
> Hope it helps,
>
> Pablo
>
>
> ----- Original Message -----
> From: Dipankar Bandyopadhyay
> To: [log in to unmask]
> Sent: Tuesday, January 31, 2012 8:35 PM
> Subject: [BUGS] generating replicates from zeros trick
>
>
> Hi,
>
>
> I am interested in generating replicates from the posterior predictive
> distribution of a r.v. X, which has been programmed in WinBUGS using the
> zeros trick. Can someone suggest whether I am doing it correctly? So,
> zeros.rep[] in the code below are my replicates.
>
>
>
>
> K <- 1000
> ll[i] <- ...... ## Log-likelihood of X
> zeros[i] < - 0
> zeros[i] ~ dpois(phi[i]) ## Zeros trick
> phi[i] <- - ll[i] + K
> zeros.rep[i] ~ dpois(phi[i]) ## Replicates of y[i] ?
>
>
>
>
> Thanks a bunch,
> Dipankar
>
>
>
>
> ______________________________
>
> Dipankar Bandyopadhyay, PhD
> Associate Professor,
> Division of Biostatistics, School of Public Health,
> University of Minnesota
> Minneapolis, MN 55455 USA
>
>
> http://www.biostat.umn.edu/~dipankar
>
>
>
>
>
> -------------------------------------------------------------------
> This list is for discussion of modelling issues and the BUGS software. For
> help with crashes and error messages, first mail [log in to unmask] To
> mail the BUGS list, mail to [log in to unmask] Before mailing, please check
> the archive at www.jiscmail.ac.uk/lists/bugs.html Please do not mail
> attachments to the list. To leave the BUGS list, send LEAVE BUGS to
> [log in to unmask] If this fails, mail [log in to unmask], NOT
> the whole list
>
>
> ------------------------------------------------------------------- This
> list is for discussion of modelling issues and the BUGS software. For help
> with crashes and error messages, first mail [log in to unmask] To mail
> the BUGS list, mail to [log in to unmask] Before mailing, please check the
> archive at www.jiscmail.ac.uk/lists/bugs.html Please do not mail attachments
> to the list. To leave the BUGS list, send LEAVE BUGS to
> [log in to unmask] If this fails, mail [log in to unmask], NOT
> the whole list
>
> -------------------------------------------------------------------
> This list is for discussion of modelling issues and the BUGS software.
> For help with crashes and error messages, first mail [log in to unmask]
> To mail the BUGS list, mail to [log in to unmask]
> Before mailing, please check the archive at
> www.jiscmail.ac.uk/lists/bugs.html
> Please do not mail attachments to the list.
> To leave the BUGS list, send LEAVE BUGS to [log in to unmask]
> If this fails, mail [log in to unmask], NOT the whole list
>
-------------------------------------------------------------------
This list is for discussion of modelling issues and the BUGS software.
For help with crashes and error messages, first mail [log in to unmask]
To mail the BUGS list, mail to [log in to unmask]
Before mailing, please check the archive at www.jiscmail.ac.uk/lists/bugs.html
Please do not mail attachments to the list.
To leave the BUGS list, send LEAVE BUGS to [log in to unmask]
If this fails, mail [log in to unmask], NOT the whole list
|