To draw from the prior predictive distribution, first sample theta from p(theta) then, for each sampled theta, draw a value from p(y|theta). For the posterior predictive distribution, sample from the posterior, p(theta|y), then sample new.y from p(new.y|theta). For example, suppose that Gov only has the support of half the population and that has a std dev of about .07. this is approx a Beta(50,50) distribution. --we observe a poll with 400 respondents, 240 of whom (60%) say they will vote for Gov. --because the Beta is conjugate prior for the binomial, the posterior is a Beta with a = a+y and b = b+N-y.b par(mfrow=c(3,2)) draws <- 1000 N <- 400 #####Prior Predictive Dist prior.theta <- rbeta (draws, 50,50) y.prior.pred <- rbinom(draws, N, prior.theta) hist(y.prior.pred,col=2,xlim=c(100,300)) prior.theta.jeff <- rbeta (draws, .5,.5) y.prior.pred.jeff <- rbinom(draws, N, prior.theta.jeff) hist(y.prior.pred.jeff,col='blue',xlim=c(0,400)) #####Data obs.data<-rbinom(draws, N, .6) hist(obs.data, col=2, xlim=c(190,300)) hist(obs.data, col=2, xlim=c(190,300)) ##Posterior Predicitve Dist post.theta <- rbeta(draws, 290,210) y.post.pred <- rbinom(draws,N,post.theta) hist(y.post.pred, col=2, xlim=c(190,300)) post.theta.jeff <- rbeta(draws, 240.4,160.5) y.post.pred.jeff <- rbinom(draws,N,post.theta.jeff) hist(y.post.pred.jeff, col='blue', xlim=c(190,300))