--- title: "Chapter 3 Beta-Binomial Bayesian Model Notes" author: "Emanuel Rodriguez" execute: message: false warning: false format: html: monofont: "Cascadia Mono" highlight-style: gruvbox-dark css: styles.css callout-icon: false callout-apperance: simple toc: false html-math-method: katex --- ```{r} library(bayesrules) library(tidyverse) ``` The chapter is set up with an example of polling results. We are put into the scenario where we are managig the campaing for a candidate. We know that on average her support based on recent polls is around 45%. In the next few sections we'll work through our Bayesian framework and incorporate a new tool the **Beta-Binomial** model. This model will take develop a continuous prior, as opposed to the discrete one's we've been working with so far. ## The Beta prior :::{.callout-note} ## Probability Density Function Let $\pi$ be a continuous random variable with probability density function (pdf) $f(\pi)$. Then $f(\pi)$ has the following properties: 1. $f(\pi) \geq 0$ 2. $\int_{\pi}f(\pi)d\pi = 1$ (this is analogous to $\sum$ in the case of pmfs) 3. $P(a < \pi < b) = \int_a^bf(\pi)d\pi$ when $a\leq b$ ::: :::{.callout-tip icon="true"} a quick note on (1) above. Note that it does not place a restriction on $f(\pi)$ being less than 1. This means that we can't interpret values of $f$ as probabilities, we can however use to interpret plausability of two different events, the greater the value of $f$ the more plausible. To calculate probabilities using $f$ we must determine the area under the curve it defines, as shown in (3). :::