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 <[log in to unmask]> > *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*<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