11.07.2015 Views

statisticalrethinkin..

statisticalrethinkin..

statisticalrethinkin..

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

4.4. ADDING A PREDICTOR 117height140 150 160 170 180height140 150 160 170 18030 35 40 45 50 55 60weight30 35 40 45 50 55 60weightFIGURE 4.8. Le: e first 100 values in the distribution of µ at each weightvalue. Right: e !Kung height data again, now with 95% HPDI of the meanindicated by the shaded region. Compare this region to the distributions ofblue points on the le.You can plot these summaries on top of the data with a few lines of R code:# plot raw data# fading out points to make line and interval more visibleplot( height ~ weight , data=d2 , col=col.alpha(rangi2,0.5) )R code4.53# plot the MAP line, aka the mean mu for each weightlines( weight.seq , mu.mean )# plot a shaded region for 95% HPDIshade( mu.HPDI , weight.seq )You can see the results in the righthand plot in FIGURE 4.8.Using this approach, you can derive and plot posterior prediction means and intervalsfor quite complicated models, for any data you choose. It’s true that it is possible to useanalytical formulas to compute intervals like this. I have tried teaching such an analyticalapproach before, and it has always been disaster. Part of the reason is probably my own failureas a teacher, but another part is that most social and natural scientists have never had muchtraining in probability theory and tend to get very nervous around ∫ ’s. I’m sure with enougheffort, every one of them could learn to do the mathematics. But all of them can quicklylearn to generate and summarize samples derived from the posterior distribution. So whilethe mathematics would be a more elegant approach, and there is some additional insightthat comes from knowing the mathematics, the pseudo-empirical approach presented hereis very flexible and allows a much broader audience of scientists to pull insight from theirstatistical modeling. And again, when you start estimating models with MCMC, this is reallythe only approach available. So it’s worth learning now.To summarize, here’s the recipe for generating predictions and intervals from the posteriorof a fit model.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!