Mathwords logoMathwords

Posterior Probability — Definition, Formula & Example

Posterior probability is the probability you assign to a hypothesis after you take new evidence into account. It is your original belief (the prior) updated by what you just observed.

Let HH be a hypothesis and EE an observed event with P(E)>0P(E) > 0. The posterior probability of HH is the conditional probability P(H∣E)=P(H∩E)P(E)P(H \mid E) = \dfrac{P(H \cap E)}{P(E)}. By Bayes' theorem this equals P(E∣H) P(H)P(E)\dfrac{P(E \mid H)\,P(H)}{P(E)}. Computing it therefore requires three inputs: the prior P(H)P(H), the likelihood P(E∣H)P(E \mid H), and the evidence probability P(E)P(E). You can supply P(E)P(E) directly or build it with the law of total probability: P(E)=P(E∣H) P(H)+P(E∣Hc) P(Hc)P(E) = P(E \mid H)\,P(H) + P(E \mid H^c)\,P(H^c).

Key Formula

P(H∣E)=P(E∣H) P(H)P(E∣H) P(H)+P(E∣Hc) P(Hc)P(H \mid E) = \frac{P(E \mid H)\,P(H)}{P(E \mid H)\,P(H) + P(E \mid H^c)\,P(H^c)}
Where:
  • P(H∣E)P(H \mid E) = Posterior: probability of the hypothesis given the evidence
  • P(H)P(H) = Prior: probability of the hypothesis before seeing the evidence
  • P(E∣H)P(E \mid H) = Likelihood: probability of the evidence if the hypothesis is true
  • P(E∣Hc)P(E \mid H^c) = Probability of the evidence if the hypothesis is false
  • P(Hc)P(H^c) = Prior probability that the hypothesis is false, equal to 1−P(H)1 - P(H)

Worked Example

Problem: An email filter knows that 10% of incoming email is spam. A flagged word appears in 90% of spam messages and in 10% of legitimate messages. A message contains the flagged word, and then a second check, with the same 90% and 10% rates and independent of the first given whether the message is spam, also flags it. Find the probability that the message is spam after each flag.
Step 1: Let HH = the message is spam and E1E_1 = the first flag. Write the prior and the likelihoods, then find the total probability of a flag.
P(H)=0.10,P(E1∣H)=0.90,P(E1∣Hc)=0.10,P(E1)=(0.90)(0.10)+(0.10)(0.90)=0.18P(H) = 0.10, \quad P(E_1 \mid H) = 0.90, \quad P(E_1 \mid H^c) = 0.10, \qquad P(E_1) = (0.90)(0.10) + (0.10)(0.90) = 0.18
Step 2: Divide the spam part by the total to get the first posterior.
P(H∣E1)=0.090.18=0.50P(H \mid E_1) = \frac{0.09}{0.18} = 0.50
Step 3: The posterior becomes the new prior. Update again with the second flag E2E_2, using 0.500.50 in place of 0.100.10.
P(H∣E1,E2)=(0.90)(0.50)(0.90)(0.50)+(0.10)(0.50)=0.450.50=0.90P(H \mid E_1, E_2) = \frac{(0.90)(0.50)}{(0.90)(0.50) + (0.10)(0.50)} = \frac{0.45}{0.50} = 0.90
Answer: After the first flag the probability of spam is 0.500.50. Using that posterior as the prior for the second flag gives 0.900.90. Each posterior becomes the prior for the next piece of evidence, so the probability climbs from 10% to 50% to 90%.

Why It Matters

Posterior probabilities drive medical screening decisions, spam filters, and the parameter estimates in a college Bayesian statistics course. Each new observation can turn today's posterior into tomorrow's prior, which is how Bayesian filters and models update their estimates.

Common Mistakes

Mistake: Reading the 90% as the answer: 90% of spam contains the flagged word, so a flagged message must be 90% likely to be spam.
Correction: That treats the likelihood P(E∣H)=0.90P(E \mid H) = 0.90 as the posterior P(H∣E)P(H \mid E). The posterior also depends on the prior (only 10% of email is spam) and on the 10% of legitimate email that contains the word. After one flag it is 0.090.18=0.50\frac{0.09}{0.18} = 0.50, or 50%.

Related Terms