Last week, we learned how to think like a Bayesian.
Today, we will formalize the model we muddled through last time.
This is called the Beta-Binomial model.
The Beta distribution is the prior.
The Binomial distribution is the data distribution (or the likeihood).
The posterior also follows a Beta distribution.
Conjugate family: When the prior and posterior are the same named distribution, but different parameters.
Example Set Up
Consider the following scenario.
“Michelle” has decided to run for president and you’re her campaign manager for the state of Florida.
As such, you’ve conducted 30 different polls throughout the election season.
Though Michelle’s support has hovered around 45%, she polled at around 35% in the dreariest days and around 55% in the best days on the campaign trail.
Example Set Up
Past polls provide prior information about \pi, the proportion of Floridians that currently support Michelle.
In fact, we can reorganize this information into a formal prior probability model of \pi.
In a previous problem, we assumed that \pi could only be 0.2, 0.5, or 0.8, the corresponding chances of which were defined by a discrete probability model.
However, in the reality of Michelle’s election support, \pi \in [0, 1].
We can reflect this reality and conduct a Bayesian analysis by constructing a continuous prior probability model of \pi.
Example Set Up
A reasonable prior is represented by the curve on the right.
Notice that this curve preserves the overall information and variability in the past polls, i.e., Michelle’s support, \pi can be anywhere between 0 and 1, but is most likely around 0.45.
Example Set Up
Incorporating this more nuanced, continuous view of Michelle’s support, \pi, will require some new tools.
No matter if our parameter \pi is continuous or discrete, the posterior model of \pi will combine insights from the prior and data.
\pi isn’t the only variable of interest that lives on [0,1].
Maybe we’re interested in modeling the proportion of people that use public transit, the proportion of trains that are delayed, the proportion of people that prefer cats to dogs, etc.
The Beta-Binomial model provides the tools we need to study the proportion of interest, \pi, in each of these settings.
Beta Prior
In building the Bayesian election model of Michelle’s election support among Floridians, \pi, we begin with the prior.
Our continuous prior probability model of \pi is specified by the probability density function (pdf).
What values can \pi take and which are more plausible than others?
Beta Prior
Let \pi be a random variable, where \pi \in [0, 1].
The variability in \pi may be captured by a Beta model with shape hyperparameters \alpha > 0 and \beta > 0,
hyperparameter: a parameter used in a prior model.
Create a graph showing what happens to the likelihood for different values of \pi.
Where is the maximum?
Binomial Data Model
Where is the maximum?
Error in `geom_text()`:
! Problem while setting up geom aesthetics.
ℹ Error occurred in the 3rd layer.
Caused by error in `list_sizes()`:
! `x$label` must be a vector, not a <latexexpression/expression> object.
The Beta Posterior Model
Looking at just the prior and the data distributions,
The prior is a bit more pessimistic about Michelle’s election support than the data obtained from the latest poll.
The Beta Posterior Model
Now including the posterior,
We can see that the posterior model of \pi is continuous and \in [0, 1].
The shape of the posterior appears to also have a Beta(\alpha, \beta) model.
The shape parameters (\alpha and \beta) have been updated.
The Beta Posterior Model
If we were to collect more information about Michelle’s support, we would use the current posterior as the new prior, then update our posterior.
How do we know what the updated parameters are?
summarize_beta_binomial(alpha =45, beta =55, y =30, n =50)
The Beta Posterior Model
We used Michelle’s election support to understand the Beta-Binomial model.
Let’s now generalize it for any appropriate situation.
In Mario Kart 8 Deluxe, item boxes give different items depending on race position. To reduce the “position bias,” only item boxes opened while the racer was in mid-pack (positions 4–10) were recorded.
You want to estimate the probability that an item box yields a Red Shell. When playing the Special Cup, only 31 red shells were seen in 114 boxes opened by mid-pack racers.
Find the posterior distribution under two priors:
Flat/uninformative prior, Beta(1,1).
Beta(\alpha, \beta) of your choosing.
Wrap Up: Beta-Binomial Model
We have built the Beta-Binomial model for \pi, an unknown proportion.