#posterior inference under a normal-normal model normalnormal_function(w=0,y=2,sigmasqr=1,mu=seq(-2,6,.001)){ if (w == 1) postscript("/home/biostats/fdominic/course/normalnormal.ps") par(mfrow=c(3,2)) mu0_seq(0,5,1) tau0sqr_1.5 tau1sqr_(1/sigmasqr+1/tau0sqr)^{-1} mu1_(y/sigmasqr+mu0/tau0sqr)*tau1sqr for(i in 1:length(mu0)){ plot(mu,dnorm(mu,mu0[i],tau0sqr),xlab="mu",ylab="", xaxs="i",yaxs="i",yaxt="n",bty="n",xlim=c(-2,10),ylim=c(0,1)) lines(mu,dnorm(mu,y,sigmasqr),lty=1) lines(mu,dnorm(mu,mu1[i],tau1sqr),lty=2) } par(oma=c(0,0,0,0)) par(mfrow=c(1,1)) if (w == 1) dev.off()} }