class: center, middle, inverse, title-slide # Continuous priors & posterior analysis ### Math 315: Bayesian Statistics --- class: middle, clear ## 1. Updating a continuous prior ## 2. Summarizing the posterior --- class: middle, inverse # Updating a continuous prior --- # Design, redux .Large[ **Data:** N N N N <font color = "tomato">B B</font> N N N <font color = "tomato">B</font> N N N N N N N (14 Ns; <font color = "tomato">3 Bs</font>) <br> **Data model:** Some true proportion of guesses, `\(\theta\)` Toss a coin with probability of heads, `\(\theta\)` <br> **Belief about `\(\theta\)`:** Uniform over (0, 1) ] --- class: center, middle, clear <img src="figs/002x006.png" width="575" /> --- class: inverse # Your turn .Large[ - Break into groups - Derive the posteriors - Are you working with a conjugate family? ] --- class: middle, inverse # Summarizing the posterior --- # Posterior analysis .large[ > To a Bayesian, the best information one can ever have about `\(\theta\)` is to know the posterior density. > > — Christensen, et al; *Bayesian Ideas and Data Analysis*, p. 31 ] .center[ <img src="03-posterior-analysis_files/figure-html/unnamed-chunk-2-1.svg" width="75%" /> ] --- # Point estimates .Large[ - <font color = "#9C27B0"> <strong>Posterior mean</strong> </font> - <font color = "#26A69A"> <strong>Posterior median </strong></font> - <font color = "#FDD835"> <strong>Posterior mode </strong></font> — i.e. *maximum a posteriori* (MAP) estimate ] .center[ <img src="03-posterior-analysis_files/figure-html/unnamed-chunk-3-1.svg" width="80%" /> ] --- # Credible intervals .center[ <img src="03-posterior-analysis_files/figure-html/ci1-1.svg" width="80%" /> ] ```r # q*() functions calculate quantiles from the specified distribution c(lower = qbeta(0.055, 14, 4), upper = qbeta(1 - 0.055, 14, 4)) ``` ``` ## lower upper ## 0.6100397 0.9126956 ``` --- # Credible intervals are not unique .large[Here are three 89% credible intervals] <br> <img src="03-posterior-analysis_files/figure-html/ci2-1.svg" width="100%" /> --- # Highest Posterior Density Interval (HPDI) .center[ <!-- --> ] --- class: center <!-- --> <!-- --> --- # Testing a hypothesis .large[ Suppose the researchers were interested in testing .pull-left[ `\(H_0: \theta \le 0.5\)` `\(P(\theta \le 0.5 | Y = 14) = 0.004\)` <!-- --> ] .pull-right[ `\(H_1: \theta > 0.5\)` `\(P(\theta > 0.5 | Y = 14) = 0.996\)` <!-- --> ] ]