Bayes’ Theorem | 贝叶斯定理

📚 Bayes’ Theorem | 贝叶斯定理

Bayes’ Theorem is a fundamental result in probability theory that describes how to update the probability of an event based on new evidence. Named after Thomas Bayes, it formalises the process of learning from data: starting from an initial belief, known as the prior probability, and combining it with observed information to arrive at a revised belief, called the posterior probability. For IB Mathematics students, understanding Bayes’ Theorem is essential for solving problems where conditional probabilities are reversed, such as medical testing, quality control, and forensic science.

贝叶斯定理是概率论中的一个基础定理,它描述了如何根据新的证据更新某事件发生的概率。该定理以托马斯·贝叶斯命名,形式化了从数据中学习的整个过程:从初始信念(先验概率)出发,结合观测到的信息,得到修正后的信念(后验概率)。对于 IB 数学的学生来说,理解贝叶斯定理对于解决需要逆向使用条件概率的问题至关重要,例如医学检测、质量控制和法医学中的概率推断。

1. Introduction to Conditional Probability | 条件概率简介

Before discussing Bayes’ Theorem, we must revisit conditional probability. The conditional probability of event A given that event B has occurred, denoted P(A|B), is defined as the ratio of the probability of both events happening to the probability of B occurring, provided P(B) > 0:

在讨论贝叶斯定理之前,我们需要回顾条件概率。在事件 B 发生的条件下事件 A 发生的概率,记作 P(A|B),定义为两事件同时发生的概率与 B 发生概率的比值,且要求 P(B) > 0:

P(A|B) = P(A ∩ B) / P(B)

This definition is symmetric in the sense that we can also write P(B|A) = P(B ∩ A) / P(A). Since P(A ∩ B) = P(B ∩ A), the two conditional probabilities are connected. This relationship forms the bridge to Bayes’ Theorem.

这个定义在形式上是可互换的,我们同样可以写出 P(B|A) = P(B ∩ A) / P(A)。由于 P(A ∩ B) = P(B ∩ A),这两个条件概率之间存在联系,而这一联系正是通往贝叶斯定理的桥梁。


2. The Law of Total Probability | 全概率公式

A key ingredient for Bayes’ Theorem is the law of total probability. Suppose the sample space is partitioned into a set of mutually exclusive and exhaustive events A₁, A₂, …, Aₙ (i.e. exactly one of them must occur). Then for any other event B, the probability of B can be expressed as the weighted sum of the conditional probabilities of B given each Aᵢ, multiplied by the probabilities of Aᵢ.

贝叶斯定理的一个关键前提是全概率公式。设样本空间被划分为一组互斥且完备的事件 A₁, A₂, …, Aₙ(即必定有且仅有一个发生)。那么对于任意其他事件 B,B 的概率可以表示为给定每个 Aᵢ 后 B 的条件概率与 Aᵢ 概率乘积的加权和。

P(B) = P(B|A₁) P(A₁) + P(B|A₂) P(A₂) + … + P(B|Aₙ) P(Aₙ)

In the simplest case of a binary partition, where we have events A and its complement A’, the formula reduces to P(B) = P(B|A) P(A) + P(B|A’) P(A’). This formula enables us to evaluate the overall probability of an effect by considering all possible causes.

在最简单的二元划分情形中,事件 A 及其对立事件 A’ 构成了一个完备划分,全概率公式简化为 P(B) = P(B|A) P(A) + P(B|A’) P(A’)。这个公式使我们能够通过考虑所有可能的原因来计算某一结果的总概率。


3. Deriving Bayes’ Theorem | 贝叶斯定理的推导

Starting from the definition of conditional probability, we can express the joint probability P(A ∩ B) in two different ways:

从条件概率的定义出发,我们可以用两种不同的方式表示联合概率 P(A ∩ B):

P(A ∩ B) = P(A|B) P(B)   and   P(A ∩ B) = P(B|A) P(A)

Equating these two expressions gives P(A|B) P(B) = P(B|A) P(A). Dividing both sides by P(B) (and using the law of total probability to expand the denominator) yields the most useful form of Bayes’ Theorem for a partition A₁, A₂, …, Aₙ:

令这两个表达式相等可得 P(A|B) P(B) = P(B|A) P(A)。两边同除以 P(B)(并用全概率公式展开分母)就得到了针对划分 A₁, A₂, …, Aₙ 的贝叶斯定理最常用的形式:

P(Aₖ|B) = P(B|Aₖ) P(Aₖ) / [ P(B|A₁) P(A₁) + P(B|A₂) P(A₂) + … + P(B|Aₙ) P(Aₙ) ]

For a simple two-event scenario (A and A’), this becomes:

对于简单的两事件情形(A 与 A’),公式变为:

P(A|B) = P(B|A) P(A) / [ P(B|A) P(A) + P(B|A’) P(A’) ]

This formula allows us to “flip” the conditioning: we can find P(A|B) from knowledge of P(B|A), the prior P(A), and the overall evidence P(B).

这个公式让我们能够对条件概率进行“转向”:我们可以从已知的 P(B|A)、先验 P(A) 以及总的证据 P(B) 反推出 P(A|B)。


4. Understanding the Formula: Prior, Likelihood, Posterior | 理解公式:先验、似然、后验

Bayes’ Theorem is often interpreted in terms of the following components:

贝叶斯定理常常用以下几个组成部分来解释:

Term Meaning 中文含义
Prior probability P(A) Initial degree of belief in A before observing B 先验概率:观测 B 之前对 A 的信念
Likelihood P(B|A) Probability of observing B if A is true 似然:若 A 为真,观测到 B 的概率
Evidence P(B) Total probability of B under all possibilities 证据:在所有可能下 B 的总概率
Posterior probability P(A|B) Updated belief about A after observing B 后验概率:观测 B 之后对 A 的更新信念

The theorem can be read as: posterior = (likelihood × prior) / evidence. This compact statement highlights that Bayes’ Theorem provides a rational mechanism for updating probabilities in light of new data.

这个定理可以简读为:后验 = (似然 × 先验) / 证据。这一简洁的表述强调了贝叶斯定理为根据新数据更新概率提供了一个合乎理性逻辑的机制。


5. Bayes’ Theorem in Tree Diagrams | 树形图中的贝叶斯定理

Tree diagrams are a powerful visual tool for solving Bayes’ type problems. A typical probability tree first branches according to the prior event (e.g. A and A’), with the prior probabilities placed on the first-level branches. Then, from each of those nodes, we branch out to the observation event B and its complement B’, labelling the conditional probabilities P(B|A), P(B’|A), P(B|A’) and P(B’|A’).

树形图是解决贝叶斯类问题的强大可视化工具。一个典型的概率树首先根据先验事件(如 A 和 A’)分支,在每一条一级分支上标出先验概率。然后,从每一个节点再分支出观测事件 B 及其对立事件 B’,并在二级分支上标出条件概率 P(B|A)、P(B’|A)、P(B|A’) 和 P(B’|A’)。

The forward probabilities (e.g. P(A ∩ B) = P(A) × P(B|A)) are found by multiplying along the branches. To reverse the conditioning and find P(A|B), we take the probability of the branch path that represents A and B happening together, and divide it by the sum of the probabilities of all paths that lead to B. This exactly mirrors the Bayes formula and is particularly helpful for beginners.

沿树的分支相乘即可得到正向概率(例如 P(A ∩ B) = P(A) × P(B|A))。为了逆转条件并求出 P(A|B),我们取代表 A 和 B 同时发生的那条分支路径的概率,再除以所有通向 B 的路径概率之和。此过程完美地对应了贝叶斯公式,对于初学者尤为直观。


6. Example 1: Medical Testing | 例题1:医学检测

Suppose a disease affects 1% of a population. A diagnostic test has a sensitivity (true positive rate) of 98% and a specificity (true negative rate) of 95%. This means P(Pos|Disease) = 0.98 and P(Neg|No Disease) = 0.95, so the false positive rate P(Pos|No Disease) = 0.05. A randomly selected person tests positive. What is the probability they actually have the disease?

假设某疾病在人群中的发病率为 1%。有一种诊断测试的灵敏度(真阳性率)为 98%,特异度(真阴性率)为 95%。这意味着 P(阳性|患病) = 0.98,P(阴性|未患病) = 0.95,因此假阳性率 P(阳性|未患病) = 0.05。现有一随机个体检测结果呈阳性,那么他真正患病的概率是多少?

Let D be the event of having the disease, D’ be not having the disease, and T+ be a positive test result. We have P(D) = 0.01, P(T+|D) = 0.98, P(T+|D’) = 0.05. Using Bayes’ Theorem:

设 D 表示患病事件,D’ 表示未患病事件,T+ 表示检测阳性结果。已知 P(D) = 0.01,P(T+|D) = 0.98,P(T+|D’) = 0.05。应用贝叶斯定理:

P(D|T+) = P(T+|D) P(D) / [ P(T+|D) P(D) + P(T+|D’) P(D’) ]

Calculating the values:

代入数值计算:

P(D|T+) = (0.98 × 0.01) / (0.98 × 0.01 + 0.05 × 0.99)
= 0.0098 / (0.0098 + 0.0495) = 0.0098 / 0.0593 ≈ 0.165

Despite the high sensitivity and specificity, the posterior probability that a positively tested person truly has the disease is only about 16.5%. This result is counter-intuitive for many, but it occurs because the disease is very rare and the false positives from the large healthy population overwhelm the true positives.

尽管灵敏度和特异度都很高,检测结果呈阳性的人实际患病的后验概率仅为约 16.5%。这一结果令许多人感到反直觉,但它确实会发生,因为该疾病非常罕见,庞大的健康人群中出现的假阳性结果远远盖过了真阳性结果。


7. Example 2: False Positives and Rare Diseases | 例题2:假阳性和罕见病

The previous example illustrates a crucial statistical lesson: when testing for a rare condition, a positive result from a highly accurate test can still be wrong most of the time. This is often summarised by saying “the false positive paradox”. Even with a test that is 98% sensitive and 95% specific, the false positives (5% of the 99% healthy people) generate a large number of expected positive results, most of which are not from diseased individuals.

上例说明了一条重要的统计学教训:当筛查罕见病时,即便测试本身非常精确,阳性结果在多数情况下仍可能是错误的。人们常将其概括为“假阳性悖论”。即使一个测试有 98% 的灵敏度和 95% 的特异度,由于健康人群基数庞大,假阳性(占 99% 健康人群的 5%)也会产生大量的预期阳性结果,而其中大部分并非来自真正患病者。

To change the situation, we can either raise the prior (e.g., by screening a high‑risk group rather than the general population) or use a test with a higher specificity. For example, if specificity were 99.9% instead of 95%, P(D|T+) would jump to about 91% — demonstrating that in Bayes’ Theorem the prior and the likelihoods work together, and neither can be ignored.

要改变这一局面,我们可以提高先验概率(例如对高风险人群而非普通人群进行筛查),或使用特异度更高的测试。例如,若特异度从 95% 提升至 99.9%,则 P(D|T+) 将跃升至约 91%——这表明在贝叶斯定理中,先验与似然共同起作用,二者不可偏废。


8. Example 3: Sequential Updating | 例题3:序贯更新

Bayes’ Theorem can be applied repeatedly as new information arrives. Consider the same disease and test, but now a person receives two independent positive tests (assuming the test results are conditionally independent given disease status). After the first positive test, the updated probability of having the disease is P(D|T₁+) ≈ 0.165. We now treat this posterior as a new prior for the second test.

当新信息不断出现时,可以反复应用贝叶斯定理。考虑同样的疾病与检测,但某人连续两次独立获得阳性结果(假设给定患病状态时两次测试结果条件独立)。在第一次阳性测试后,患病概率更新为 P(D|T₁+) ≈ 0.165。我们现在将此后验概率视为第二次测试的新的先验。

Applying Bayes’ Theorem a second time:

第二次应用贝叶斯定理:

P(D|T₁+ ∩ T₂+) = P(T₂+|D) P(D|T₁+) / [ P(T₂+|D) P(D|T₁+) + P(T₂+|D’) P(D’|T₁+) ]

Using the same sensitivity 0.98 and false positive rate 0.05, and noting P(D’|T₁+) = 1 – 0.165 = 0.835, we get:

使用相同的灵敏度 0.98 和假阳性率 0.05,并注意到 P(D’|T₁+) = 1 – 0.165 = 0.835,我们可得:

P(D| two positives) = (0.98 × 0.165) / (0.98 × 0.165 + 0.05 × 0.835)
= 0.1617 / (0.1617 + 0.04175) ≈ 0.795

With two positive tests, the probability of having the disease rises to nearly 80%, a drastic shift from the initial 1%. This illustrates how combining multiple pieces of evidence through Bayesian updating can dramatically sharpen our beliefs.

经过两次阳性测试后,患病概率上升至近 80%,与最初的 1% 相比发生了巨大转变。这充分说明,通过贝叶斯更新将多份证据叠加在一起,可以极大地提升我们信念的精确度。


9. Common Misinterpretations | 常见误解

A very frequent error is to confuse P(A|B) with P(B|A), a mistake known as the prosecutor’s fallacy. For instance, a forensic expert might state that the probability of a DNA match if the suspect were innocent is 1 in a million (P(match|innocent) = 10⁻⁶). Many then wrongly conclude that the probability the suspect is innocent given the match is also 1 in a million, ignoring the prior probability of guilt. Bayes’ Theorem shows that the correct inference, P(innocent|match), depends heavily on the size of the population and other evidence.

一个极为常见的错误是将 P(A|B) 与 P(B|A) 混淆,这被称为检察官谬误。例如,法医专家可能会指出,假如嫌疑人无辜,DNA 匹配的概率为百万分之一(P(匹配|无辜) = 10⁻⁶)。许多人便会错误地推断,在 DNA 匹配下嫌疑人无辜的概率也是百万分之一,而忽略了罪责的先验概率。贝叶斯定理表明,正确的推理 P(无辜|匹配) 极大程度上取决于嫌疑群体的大小及其他证据。

Another misconception is assuming that the evidence P(B) always increases the credibility of A. The updated probability P(A|B) depends on the ratio of likelihoods P(B|A) / P(B). Only if P(B|A) > P(B) will the posterior exceed the prior; otherwise, the evidence actually reduces our belief in A.

另一个误解是认为证据 P(B) 总能提升 A 的可信度。实际上,更新后的概率 P(A|B) 取决于似然比 P(B|A) / P(B)。只有当 P(B|A) > P(B) 时后验才会大于先验;否则,证据反而会削弱我们对 A 的信念。


10. Bayes’ Theorem in Real-World Applications | 贝叶斯定理的现实应用

Beyond textbooks, Bayes’ Theorem is the backbone of many modern technologies. Email spam filters, for instance, use a naive Bayes classifier that treats each word’s occurrence as conditionally independent and continually updates the probability that an incoming message is spam. Medical decision making, machine learning, weather forecasting, and financial risk modelling all rely on Bayesian inference to combine prior knowledge with observed data.

在教科书之外,贝叶斯定理是许多现代技术的核心支柱。例如电子邮件垃圾过滤器会使用朴素贝叶斯分类器,将每个单词的出现视为条件独立,并不断更新新邮件是垃圾邮件的概率。医学决策、机器学习、天气预报和金融风险建模都依赖贝叶斯推断来将先验知识与观测数据相融合。

In legal contexts, Bayesian networks help to evaluate how different pieces of evidence interact, ensuring that subjective judgements are combined in a logically coherent way. The theorem thus not only solves mathematics problems but also shapes reasoning in science, policy, and everyday decision making.

在法律领域,贝叶斯网络有助于评估不同证据如何相互作用,以确保主观判断以逻辑连贯的方式组合。因此,该定理不仅解决数学问题,也塑造着科学、政策和日常决策中的推理方式。


11. Summary and Key Takeaways | 总结与要点

Bayes’ Theorem provides a rigorous method for revising probabilities when new information is obtained. The core result, P(A|B) = P(B|A)P(A) / P(B), is derived directly from the definition of conditional probability and the law of total probability. The terms prior, likelihood, and posterior encapsulate the learning process, while

Published by TutorHao | IB Mathematics Revision Series | aleveler.com

更多咨询请联系16621398022(同微信)

Comments

屏轩国际教育cambridge primary/secondary checkpoint, cat4, ukiset,ukcat,igcse,alevel,PAT,STEP,MAT, ibdp,ap,ssat,sat,sat2课程辅导,国外大学本科硕士研究生博士课程论文辅导

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from aleveler.com

Subscribe now to keep reading and get access to the full archive.

Continue reading