#example pag 50 gelman book: estimating a rate from poisson data: an idealized example exposure_function(w=0){ if (w == 1) postscript("/home/biostats/fdominic/course/exposure.ps") par(mfrow=c(2,1)) prior.theta_rgamma(1000,3)/5 hist(prior.theta,nclass=50,xlab="theta",ylab="prior",yaxt="n", density=-1,prob=T,cex=2 ,xlim=c(0,3)) abline(v=mean(prior.theta),lwd=2) mtext("PRIOR",side=3) posterior.theta_rgamma(1000,6)/7 hist(posterior.theta,nclass=50,xlab="theta",ylab="posterior",yaxt="n", density=-1,prob=T,cex=2,xlim=c(0,3)) abline(v=mean(posterior.theta),lwd=2) mtext("POSTERIOR",side=3) ppp_ sum(posterior.theta>1)/1000 par(oma=c(0,0,0,0)) par(mfrow=c(1,1)) if (w == 1) dev.off() }