A medical-test example
Suppose a condition affects 1% of a population. A test has 90% sensitivity and 5% false-positive rate. Among 10,000 people, about 100 have the condition and 90 test positive; among the 9,900 without it, about 495 test positive. Thus a positive result corresponds to 90/(90+495) ≈ 15.4% chance of the condition, not 90%.
These values are illustrative; a real interpretation requires validated test performance for the relevant population. Changing prevalence changes the posterior even when sensitivity and specificity stay the same.
Separate prior, likelihood, and posterior
The prior P(A) is the probability assigned to a hypothesis before the evidence. The likelihood P(B|A) says how probable the evidence would be if that hypothesis were true. The posterior P(A|B) is the updated probability after observing B. The denominator P(B) normalises the competing explanations so their posterior probabilities sum to one. A likelihood is not itself a probability that the hypothesis is true.
For the test above, the total positive rate is 0.90(0.01)+0.05(0.99)=0.0585. The positive-and-condition group has probability 0.90(0.01)=0.009, so P(condition | +)=0.009/0.0585≈0.154. The low base rate means false positives from the much larger unaffected group outnumber true positives. If prevalence rises, the same positive test produces a higher posterior. Real screening requires test-performance estimates suited to the population and protocol; this calculation is an illustration, not medical advice.
Bayes’ theorem is also used in spam filtering and reliability analysis. Include all plausible explanations in the denominator; leaving out a competing cause distorts the update.
Try this above
Adjust the prevalence while holding sensitivity and false-positive rate fixed. Notice how the posterior probability changes with the base rate.
For multiple hypotheses A₁,…,Aₖ that form a complete set, P(Aᵢ|B)=P(B|Aᵢ)P(Aᵢ)/ΣⱼP(B|Aⱼ)P(Aⱼ). This form makes explicit that evidence is compared across alternatives. New evidence can be incorporated by taking the current posterior as the next prior, provided the likelihood model is updated consistently. A Bayesian answer depends on both the likelihood and prior; where prior information comes from should be reported when it materially affects the conclusion.
A useful diagnostic is to calculate expected counts as well as probabilities. In a group of 10,000 people, 1% prevalence gives 100 affected people: 90 test positive. Of the 9,900 unaffected people, 495 are false positives, so 90 of 585 positives are true positives. This count view makes the denominator tangible and can prevent reversing sensitivity and positive predictive value. The estimate changes if the screened population has a different prevalence, even when the laboratory test is unchanged.