No history yet

Introduction to Bayesian Statistics

Probability as Belief

How do you think about probability? Many people first learn about it as a long-term frequency. If you flip a fair coin 10,000 times, you expect to get heads about 5,000 times. The probability of heads, 50%, is the proportion you'd see over countless trials.

This is the core of the frequentist approach to statistics. It defines probability as the relative frequency of an event in the long run. It's objective and works well for repeatable events like coin flips or dice rolls.

But what about questions where you can't run thousands of trials? For example, what's the probability that a specific political candidate will win the next election? Or the probability that a newly discovered planet harbors life? These events will only happen once. A frequentist approach doesn't quite fit.

Bayesian statistics offers a different perspective. It treats probability as a degree of belief or confidence in a statement. This belief can be updated as new evidence becomes available. It's a measure of our uncertainty about the world.

The entire goal of Bayesian inference is to provide us with a rational and mathematically sound procedure for incorporating our prior beliefs, with any evidence at hand, in order to produce an updated posterior belief.

The Bayesian Recipe

The process of updating beliefs in a Bayesian framework has three key ingredients: the prior, the likelihood, and the posterior.

Prior

noun

Our initial belief about a quantity before we see any data. It's a probability distribution that represents our uncertainty based on previous experience or knowledge.

Imagine you're trying to determine the average weight of a house cat. You haven't weighed any cats yet, but you know they aren't as light as a hamster or as heavy as a lion. Your prior distribution might be centered around 10 pounds, with a wide spread to reflect your uncertainty.

Likelihood

noun

The information brought by the data. It's a function that tells us how probable the observed data is for different values of the quantity we're interested in.

Now, you go out and weigh a sample of 20 cats. This is your data. The likelihood function uses this data to evaluate your initial belief. If your sample of cats has an average weight of 12 pounds, the likelihood will peak at 12. It tells you that, given the data, a 12-pound average is more plausible than a 10-pound or 15-pound average.

Posterior

noun

The updated belief after combining the prior with the likelihood. The posterior distribution is a compromise between your initial belief and the evidence from your data.

The posterior is the result of the Bayesian process. You combine your prior belief (centered at 10 pounds) with the evidence from your data (the likelihood, centered at 12 pounds). The resulting posterior distribution will be a new belief, likely centered somewhere between 10 and 12 pounds. It will also be narrower than your prior, reflecting that you are now less uncertain.

Bayes' Theorem

This whole process is formalized by a simple but powerful equation called Bayes' Theorem.

Lesson image

Let's use HH to represent a hypothesis (e.g., the average cat weight is 10 lbs) and DD to represent our data (the 20 cat weights we collected). Bayes' Theorem looks like this:

P(HD)=P(DH)P(H)P(D)P(H|D) = \frac{P(D|H) \cdot P(H)}{P(D)}

Let's break that down into the concepts we just learned:

TermNameMeaning
P(HD)P(H \| D)PosteriorThe probability of our hypothesis being true, given the data.
P(DH)P(D \| H)LikelihoodThe probability of seeing our data, if our hypothesis were true.
P(H)P(H)PriorThe initial probability of our hypothesis being true, before seeing data.
P(D)P(D)EvidenceThe total probability of observing the data. It acts as a normalizing constant.

In words, the theorem states:

Posterior Belief = (Likelihood of Evidence) x (Prior Belief) / (Total Probability of Evidence)

The key takeaway is that Bayesian statistics provides a formal framework for updating what we know. We start with a prior belief, collect data, and use that data to arrive at a more informed posterior belief. It's a natural model for how we learn about the world.