∴Logic WikiA library of reasoningSearch concepts, fallacies, and cases/中文

Bayesian updating

贝叶斯更新

How evidence changes a judgment depends on its likelihood under competing hypotheses.

P(H∣E)=P(E∣H)P(H)P(E)P(H\mid E)=\frac{P(E\mid H)P(H)}{P(E)}

The concept and its limits

Bayes’ rule combines prior probabilities and likelihoods into posterior probabilities. A calculation must specify the prior; a likelihood evaluates the probability of evidence given a hypothesis. Evidence matters when it discriminates between hypotheses.

Numerical results depend on model, priors, and data quality. Correct algebra does not certify inputs; report assumptions and examine sensitivity.

Working through an example

For a rare fault, false alarms can make up most positive results even with a sensitive test. Counts of true and false positives within the same 10,000 objects are clearer than sensitivity alone.

What Bayes’ theorem reverses

Knowing how often a detector alerts when an item is defective does not directly tell us how often an alerted item is defective. Bayes’ theorem links the directions using the prior defect rate and the false-positive rate. Let D mean defective and + mean an alert. The formula below applies when D and its complement exhaust the possibilities and an alert has positive probability.

A prior is the probability before incorporating this evidence; it need not be an arbitrary guess. It may come from historical data or an explicit model. The likelihood P(+∣D) concerns evidence given a hypothesis. The posterior P(D∣+) concerns the hypothesis after the evidence.

P(D∣+)=P(+∣D)P(D)P(+∣D)P(D)+P(+∣¬D)P(¬D)P(D\mid +)=\frac{P(+\mid D)P(D)}{P(+\mid D)P(D)+P(+\mid\neg D)P(\neg D)}

Section sources: HKU T15: priors, posteriors, and confirmation ↗

Work through a cohort of 1,000

Imagine 1,000 items matching the assumed rates exactly: 20 defective and 980 sound. The detector identifies 95% of defective items and also alerts on 10% of sound items. There are 19 + 98 = 117 alerts, of which 19 concern defective items: about 16.24%. These are original idealized data, not measured performance of a real device.

An alert still provides support: the defect probability rises from 2% to about 16%. A substantial increase is different from near certainty. If detector performance stays the same but the prior defect rate becomes 20%, the posterior becomes 0.19/(0.19 + 0.08), about 70.37%. Transporting a result between production lines requires checking the baseline rate.

Original model: from all items to alerted items
StateAlertNo alertTotal
Defective19120
Sound98882980
Total1178831000

Support and decisions

Updating a probability does not by itself decide whether production should stop. Decisions also depend on missed-defect losses, retesting costs, and alternatives. The same posterior may support retesting first or immediate suspension when losses are severe; additional decision assumptions are needed.

Repeated checks do not automatically supply proportionally more evidence. Two alerts caused by the same sensor fault may remain dependent given the product’s state. Sequential updating can use P(E₂∣D,E₁); replacing it with P(E₂∣D) requires conditional independence. Using data to choose a prior and then treating those same data as wholly new evidence can likewise count information twice.

Rebuild the table with new data

Calculate counts before reporting a proportion. This makes it easier to detect confusion between sensitivity and positive predictive value.

Independent exercise 1

Original model: 5% of 2,000 items are defective. Sensitivity is 80%, and the false-positive rate among sound items is 5%. What is the probability of a defect after an alert?

Show answer and reasoning

Of 100 defective items, 80 alert. Of 1,900 sound items, 95 alert. The posterior is 80/(80 + 95) = 16/35, about 45.71%. The denominator contains all alerted items, not all defective items; 80% answers the reverse conditional question.

Independent exercise 2

An alert has probability 30% both when an item is defective and when it is sound. The prior defect rate is 4%. What is the posterior after an alert?

Show answer and reasoning

It remains 4%: 0.30 × 0.04/[0.30 × 0.04 + 0.30 × 0.96] = 0.04. The signal does not discriminate between the two states and supplies no new support for a defect. Its alarming name does not alter the probabilities.

Check your understanding

Question: Does a high posterior make a judgment final? Answer: No. Further evidence or model revision can change it.

References

  1. Critical thinking web ↗
    Joe Lau and Jonathan Chan · Critical Thinking Web · Selected sections
    Fallacies and scientific-method tutorials; statistics T01 §§2, 4–5 and T15 Bayesian confirmation
    Version, terms, and access scope