SolutionstosomeexercisesfromBayesianDataAnalysis,secondeditionbyGelman,Carlin,Stern,andRubin15Mar2004Thesesolutionsareinprogress.Formoreinformationoneitherthesolutionsorthebook(pub-lishedbyCRC),checkthewebsitehttp://www.stat.columbia.edu/∼gelman/book/Foreachgraphandsomeothercomputations,weincludethecodeusedtocreateitusingtheScomputerlanguage.TheScommandsaresetofffromthetextandappearintypewriterfont.Ifyoufindanymistakes,pleasenotifyusbye-mailingtogelman@stat.columbia.edu.Thankyouverymuch.c⃝1996,1997,2000,2001,2003,2004AndrewGelman,JohnCarlin,HalStern,andRichCharnigo.WealsothankJiangtaoDuforhelpinpreparingsomeofthesesolutionsandRobCreecy,XinFeng,andYiLuforfindingmistakes.Wehavecomplete(oressentiallycomplete)solutionsforthefollowingexercises:Chapter1:1,2,3,4,5,6Chapter2:1,2,3,4,5,7,8,9,10,11,12,13,16,19,19,22Chapter3:1,2,3,5,9,10Chapter4:2,3,4Chapter5:1,2,3,5,6,7,8,9,10Chapter6:1,5,6,7Chapter7:1,2,7,15Chapter8:1,2,4,6,8Chapter11:1,2Chapter12:6,7Chapter14:1,3,4,7Chapter17:11.1a.p(y)=Pr(θ=1)p(y|θ=1)+Pr(θ=2)p(y|θ=2)=0.5N(y|1,22)+0.5N(y|2,22).y-50510y_seq(-7,10,.02)dens_0.5*dnorm(y,1,2)+0.5*dnorm(y,2,2)plot(y,dens,ylim=c(0,1.1*max(dens)),type="l",xlab="y",ylab="",xaxs="i",yaxs="i",yaxt="n",bty="n",cex=2)1.1b.Pr(θ=1|y=1)=p(θ=1&y=1)p(θ=1&y=1)+p(θ=2&y=2)=Pr(θ=1)p(y=1|θ=1)Pr(θ=1)p(y=1|θ=1)+Pr(θ=2)p(y=1|θ=2)=0.5N(1|1,22)0.5N(1|1,22)+0.5N(1|2,22)=0.53.11.1c.Asσ→∞,theposteriordensityforθapproachestheprior(thedatacontainnoinformation):Pr(θ=1|y=1)→12.Asσ→0,theposteriordensityforθbecomesconcentratedat1:Pr(θ=1|y=1)→1.1.2.(1.7):Foreachcomponentui,theunivariateresult(1.6)statesthatE(ui)=E(E(ui|v));thus,E(u)=E(E(u|v)),componentwise.(1.8):Fordiagonalelementsofvar(u),theunivariateresult(1.8)statesthatvar(ui)=E(var(ui|v))+var(E(ui|v)).Foroff-diagonalelements,E[cov(ui,uj|v)]+cov[E(ui|v),E(uj|v)]=E[E(uiuj|v)−E(ui|v)E(uj|v)]+E[E(ui|v)E(uj|v)]−E[E(ui|v)]E[E(uj|v)]=E(uiuj)−E[E(ui|v)E(uj|v)]+E[E(ui|v)E(uj|v)]−E[E(ui|v)]E[E(uj|v)]=E(uiuj)−E(ui)E(uj)=cov(ui,uj).1...