11.07.2015 Views

statisticalrethinkin..

statisticalrethinkin..

statisticalrethinkin..

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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

7.1. BUILDING AN INTERACTION 227Density0 1 2 3 4 5-0.4 -0.2 0.0 0.2 0.4 0.6gammaFIGURE 7.5. Posterior distributions of the slope relating terrain ruggednessto log-GDP. Blue: African nations. Black: non-African nations.mean( gamma.Africa)mean( gamma.notAfrica )R code7.14[1] 0.1631653[1] -0.1824547Nearly identical to the MAP values.But not we also have full distributions of the slopes within and outside of Africa. Let’splot them on the same axis, so we can see their overlap clearly:dens( gamma.Africa , xlim=c(-0.5,0.6) , ylim=c(0,5.5) ,xlab="gamma" , col=rangi2 )dens( gamma.notAfrica , add=TRUE )R code7.15And this plot appears as FIGURE 7.5. e posterior distribution of the slope within Africa isshown in blue. e posterior distribution outside of Africa is shown in black.From here, you could use the samples to ask a bunch of questions, depending upon yourinterest. For example, what’s the probability (according to this model and these data) thatthe slope within Africa is less than the slope outside of Africa? All we need to do is computethe difference between the slopes, for each sample from the posterior, and then ask whatproportion of these differences is below zero. is code will do it:diff

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

Saved successfully!

Ooh no, something went wrong!