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:
[log in to unmask]" href="mailto:[log in to unmask]" target="_blank">Dipankar
Bandyopadhyay
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