# Bayes' rule: Definition

Bayes’ rule is the mathematics of probability theory governing how to update your beliefs in the light of new evidence.

## Notation

In much of what follows, we’ll use the following notation:

Let the hypotheses being considered be \(H_1\) and \(H_2\).

Let the evidence observed be \(e_0.\)

Let \(\mathbb P(H_i)\) denote the prior probability of \(H_i\) before observing the evidence.

Let the conditional probability \(\mathbb P(e_0\mid H_i)\) denote the likelihood of observing evidence \(e_0\) assuming \(H_i\) to be true.

Let the conditional probability \(\mathbb P(H_i\mid e_0)\) denote the posterior probability of \(H_i\) after observing \(e_0.\)

## Odds/proportional form

Bayes’ rule in the odds form or proportional form states:

In other words, the prior odds times the likelihood ratio yield the posterior odds. Normalizing these odds will then yield the posterior probabilities.

In other other words: If you initially think \(h_i\) is \(\alpha\) times as probable as \(h_k\), and then see evidence that you’re \(\beta\) times as likely to see if \(h_i\) is true as if \(h_k\) is true, you should update to thinking that \(h_i\) is \(\alpha \cdot \beta\) times as probable as \(h_k.\)

Suppose that Professor Plum and Miss Scarlet are two suspects in a murder, and that we start out thinking that Professor Plum is twice as likely to have committed the murder as Miss Scarlet (prior odds of 2 : 1). We then discover that the victim was poisoned. We think that Professor Plum is around one-fourth as likely to use poison as Miss Scarlet (likelihood ratio of 1 : 4). Then after observing the victim was poisoned, we should think Plum is around half as likely to have committed the murder as Scarlet: \(2 \times \dfrac{1}{4} = \dfrac{1}{2}.\) This reflects posterior odds of 1 : 2, or a posterior probability of ^{1}⁄_{3}, that Professor Plum did the deed.

## Proof

The proof of Bayes’ rule is by the definition of conditional probability \(\mathbb P(X\wedge Y) = \mathbb P(X\mid Y) \cdot \mathbb P(Y):\)

## Log odds form

The log odds form of Bayes’ rule states:

E.g.: “A study of Chinese blood donors found that roughly 1 in 100,000 of them had HIV (as determined by a very reliable gold-standard test). The non-gold-standard test used for initial screening had a sensitivity of 99.7% and a specificity of 99.8%, meaning that it was 500 times as likely to return positive for infected as non-infected patients.” Then our prior belief is −5 orders of magnitude against HIV, and if we then observe a positive test result, this is evidence of strength +2.7 orders of magnitude for HIV. Our posterior belief is −2.3 orders of magnitude, or odds of less than 1 to a 100, against HIV.

In log odds form, the same strength of evidence (log likelihood ratio) always moves us the same additive distance along a line representing strength of belief (also in log odds). If we measured distance in probabilities, then the same 2 : 1 likelihood ratio might move us a different distance along the probability line depending on whether we started with prior 10% probability or 50% probability.

## Visualizations

Graphical of visualizing Bayes’ rule include frequency diagrams, the waterfall visualization, the spotlight visualization, the magnet visualization, and the Venn diagram for the proof.

## Examples

Examples of Bayes’ rule may be found here.

## Multiple hypotheses and updates

The odds form of Bayes’ rule works for odds ratios between more than two hypotheses, and applying multiple pieces of evidence. Suppose there’s a bathtub full of coins. ^{1}⁄_{2} of the coins are “fair” and have a 50% probability of producing heads on each coinflip; ^{1}⁄_{3} of the coins produce 25% heads; and ^{1}⁄_{6} produce 75% heads. You pull out a coin at random, flip it 3 times, and get the result HTH. You may legitimately calculate:

^{1}⁄

_{3}:

^{1}⁄

_{6}) \cong & (3 : 2 : 1) & \\ \times & (2 : 1 : 3) & \\ \times & (2 : 3 : 1) & \\ \times & (2 : 1 : 3) & \\ = & (24 : 6 : 9) & \cong (8 : 2 : 3) \end{array}$$

Since multiple pieces of evidence may not be conditionally independent from one another, it is important to be aware of the Naive Bayes assumption and whether you are making it.

## Probability form

As a formula for a single probability \(\mathbb P(H_i\mid e),\) Bayes’ rule states:

## Functional form

In functional form, Bayes’ rule states:

The posterior probability function over hypotheses given the evidence, is *proportional* to the likelihood function from the evidence to those hypotheses, times the prior probability function over those hypotheses.

Since posterior probabilities over mutually exclusive and exhaustive possibilities must sum to \(1,\) normalizing the product of the likelihood function and prior probability function will yield the exact posterior probability function.

Parents:

- Bayes' rule
Bayes’ rule is the core theorem of probability theory saying how to revise our beliefs when we make a new observation.

- Bayesian reasoning
A probability-theory-based view of the world; a coherent way of changing probabilistic beliefs based on evidence.

- Bayesian reasoning

It’s not totally clear what the antecedent of this “it’s” is. (Because “it’s” often means “it is the case that”)

Too Eliezer-voice. What would Sal Khan say?

Made a minor edit. If you want anything more, you’ll need to be more specific.

Yeah, that wasn’t a great comment from me :P