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.

4.3. A GAUSSIAN MODEL OF HEIGHT 97FIGURE 4.3. Samples from the posterior distributionfor the heights data. e density of points ishighest in the center, reflecting the most plausiblecombinations of µ and σ.I reproduce this plot in FIGURE 4.3. Note that the function col.alpha is part of the rethinkingR package. All it does is make colors transparent, which helps the plot in FIG-URE 4.3 more easily show density, where samples overlap. Adjust the plot to your tastes byplaying around with cex (character expansion, the size of the points), pch (plot character),and the 0.1 transparency value.Now that you have these samples, you can describe the distribution of confidence in eachcombination of µ and σ by summarizing the samples. ink of them like data and describethem, just like in Chapter 3. For example, to characterize the shapes of the marginal posteriordensities of µ and σ, all we need to do is:dens( sample.mu )dens( sample.sigma )R code4.19e jargon “marginal” here means “averaging over the other parameters.” Execute the abovecode and inspect the plots. ese densities are very close to being normal distributions.And this is quite typical. As sample size increases, posterior densities approach the normaldistribution. If you look closely, though, you’ll notice that the density for σ has a longerrighthand tail. I’ll exaggerate this tendency a bit later, to show you that this condition is verycommon for standard deviation parameters.To summarize the widths of these densities with highest posterior density intervals (HPDIs),just like in Chapter 3:HPDI( sample.mu , prob=0.95 )HPDI( sample.sigma , prob=0.95 )R code4.20Since these samples are just vectors of numbers, you can compute any statistic from them thatyou could from ordinary data. If you want the mean or median, just use the correspondingR functions.Overthinking: Sample size and the normality of σ’s posterior. Before moving on to using quadraticapproximation (map) as shortcut to all of this inference, it is worth repeating the analysis of the heightdata above, but now with only a fraction of the original data. e reason to do this is to demonstratethat, in principle, the posterior is not always so Gaussian in shape.

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

Saved successfully!

Ooh no, something went wrong!