Bayes’ Theorem: Derivation and Applications | 贝叶斯定理:推导与应用

📚 Bayes’ Theorem: Derivation and Applications | 贝叶斯定理:推导与应用

Bayes’ Theorem is a cornerstone of probability theory and statistical inference. It allows us to update our beliefs about an event based on new evidence, making it essential for fields as diverse as medicine, machine learning, and decision theory.

贝叶斯定理是概率论与统计推断的基石。它让我们能够根据新证据更新对某一事件的信念,因此在医学、机器学习、决策理论等众多领域中至关重要。


1. Conditional Probability and Notation | 条件概率与记号

Before stating Bayes’ Theorem, we need to understand conditional probability. The conditional probability of event A given event B is written as P(A|B), and it represents the probability that A occurs under the assumption that B has already occurred.

在陈述贝叶斯定理之前,我们需要理解条件概率。在事件 B 已发生的条件下,事件 A 发生的条件概率记为 P(A|B),它表示在假设 B 已发生的条件下 A 发生的概率。

The formal definition is:

其正式定义如下:

P(A|B) = P(A ∩ B) / P(B), where P(B) > 0

Here P(A ∩ B) is the probability that both A and B occur. Rearranging gives the multiplication rule: P(A ∩ B) = P(A|B) × P(B) = P(B|A) × P(A).

其中 P(A ∩ B) 是 A 与 B 同时发生的概率。变形可得乘法公式:P(A ∩ B) = P(A|B) × P(B) = P(B|A) × P(A)。


2. Partition of the Sample Space | 样本空间的分割

A collection of mutually exclusive events B₁, B₂, …, Bₙ is called a partition of the sample space if their union is the entire sample space. In other words, exactly one of these events must occur in any given experiment.

一组互斥事件 B₁, B₂, …, Bₙ 如果它们的并集是整个样本空间,则称为样本空间的一个分割。换句话说,在任何一次试验中,这些事件中恰好有一个必然发生。

For example, in a medical test, the events “patient has the disease” and “patient does not have the disease” form a partition.

例如,在医学检测中,“患者患病”和“患者未患病”这两个事件构成了一个分割。

Partitions are useful because they allow us to break a complex probability into simpler pieces using the law of total probability.

分割之所以有用,是因为它允许我们利用全概率公式将一个复杂的概率分解为更简单的部分。


3. Law of Total Probability | 全概率公式

If B₁, B₂, …, Bₙ form a partition of the sample space, then for any event A, the law of total probability states:

如果 B₁, B₂, …, Bₙ 构成样本空间的一个分割,那么对任意事件 A,全概率公式表明:

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

This formula is essential because it expresses P(A) as a weighted average of conditional probabilities, where the weights are the probabilities of the partition events.

这个公式至关重要,因为它将 P(A) 表示为条件概率的加权平均,权重就是分割中各事件的概率。

In the simplest case with only two events B and its complement Bᶜ, the law becomes P(A) = P(A|B)P(B) + P(A|Bᶜ)P(Bᶜ).

在只有两个事件 B 及其补事件 Bᶜ 的最简单情形下,全概率公式变为 P(A) = P(A|B)P(B) + P(A|Bᶜ)P(Bᶜ)。


4. Statement of Bayes’ Theorem | 贝叶斯定理的表述

Bayes’ Theorem connects P(B|A) to P(A|B). For a partition B₁, B₂, …, Bₙ, the theorem states:

贝叶斯定理将 P(B|A) 与 P(A|B) 联系起来。对于分割 B₁, B₂, …, Bₙ,定理表述如下:

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

In the two-event form, with events B and Bᶜ, this becomes:

在包含 B 与 Bᶜ 的双事件形式中,上式变为:

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

Here P(B) is called the prior probability of B, and P(B|A) is called the posterior probability, because it is computed after observing evidence A.

此处 P(B) 称为 B 的先验概率,P(B|A) 称为后验概率,因为它是在观察到证据 A 之后计算得到的。


5. Derivation of Bayes’ Theorem | 贝叶斯定理的推导

The derivation follows directly from the definition of conditional probability. Start with the symmetric relationship between A and B:

推导直接来自条件概率的定义。首先写出 A 与 B 之间的对称关系:

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

Now solve for P(B|A):

现在解出 P(B|A):

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

Finally, replace the denominator P(A) using the law of total probability:

最后,用全概率公式替换分母 P(A):

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

This completes the derivation. Notice that no new assumptions are needed; the theorem is a logical consequence of the axioms of probability.

推导至此完成。注意,这里不需要任何新的假设;该定理是概率公理的逻辑推论。


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

A disease affects 1% of a population, so P(D) = 0.01. A diagnostic test is 95% accurate: it gives a positive result for 95% of infected patients, P(Pos|D) = 0.95, and gives a negative result for 95% of healthy patients, so P(Pos|Dᶜ) = 0.05.

某种疾病影响 1% 的人群,即 P(D) = 0.01。一项诊断测试的准确率为 95%:对 95% 的感染者呈阳性,P(Pos|D) = 0.95;对 95% 的健康者呈阴性,因此 P(Pos|Dᶜ) = 0.05。

If a randomly selected person tests positive, what is the probability they actually have the disease?

如果随机选中的一个人检测结果为阳性,那么他真正患病的概率是多少?

Using Bayes’ Theorem:

利用贝叶斯定理:

P(D|Pos) = (0.95 × 0.01) / (0.95 × 0.01 + 0.05 × 0.99) = 0.0095 / 0.059 ≈ 0.161

Thus, despite the test’s high accuracy, only about 16.1% of positive results are true positives. This surprising result illustrates why Bayes’ Theorem is vital in medical screening.

因此,尽管测试准确率很高,但阳性结果中真正患病的比例仅为约 16.1%。这一令人惊讶的结果说明了为什么贝叶斯定理在医学筛查中至关重要。


7. Example: Spam Filtering | 实例:垃圾邮件过滤

Email filters use Bayes’ Theorem to classify messages as spam or legitimate. Suppose 20% of all emails are spam, so P(Spam) = 0.20. If the word “free” appears in 30% of spam emails and in 2% of legitimate emails, then:

电子邮件过滤器使用贝叶斯定理将邮件分类为垃圾邮件或正常邮件。假设所有邮件中 20% 是垃圾邮件,即 P(Spam) = 0.20。如果单词“免费”出现在 30% 的垃圾邮件和 2% 的正常邮件中,那么:

P(Spam|Free) = (0.30 × 0.20) / (0.30 × 0.20 + 0.02 × 0.80) = 0.06 / 0.076 ≈ 0.789

So an email containing “free” has about a 78.9% chance of being spam. Real filters combine many words and use sophisticated Bayesian models.

因此,包含“免费”一词的邮件约有 78.9% 的概率是垃圾邮件。真正的过滤器会综合多个单词并使用复杂的贝叶斯模型。


8. Bayesian vs Frequentist Interpretation | 贝叶斯学派与频率学派

Bayes’ Theorem is the foundation of Bayesian statistics. In this view, probability represents a degree of belief, and data update that belief. The prior P(B) can be subjective, chosen from previous knowledge or expert opinion.

贝叶斯定理是贝叶斯统计学的基础。在这一观点中,概率代表信念的程度,数据用于更新这种信念。先验 P(B) 可以是主观的,可根据已有知识或专家意见选择。

Frequentist statistics, by contrast, defines probability as the long-run frequency of events. It does not assign probabilities to hypotheses, and it rejects subjective priors. Instead, it relies on confidence intervals and p-values.

相比之下,频率学派将概率定义为事件在长期重复试验中的频率。它不对假设赋予概率,也拒绝主观先验。相反,它依赖于置信区间和 p 值。

  • Bayesian: Probability is a degree of belief; parameters are random variables; inference uses posterior distributions.
  • 贝叶斯学派:概率是信念程度;参数是随机变量;推断使用后验分布。
  • Frequentist: Probability is long-run frequency; parameters are fixed but unknown; inference uses sampling distributions.
  • 频率学派:概率是长期频率;参数是固定的但未知;推断使用抽样分布。

Both frameworks have strengths, and IB Mathematics encourages understanding the conceptual difference without judging which is “better”.

两种框架各有优势,IB 数学鼓励理解其概念差异,而不评判哪种“更好”。


9. Common Mistakes and Pitfalls | 常见误区

One common error is confusing P(B|A) with P(A|B). In the medical example, many people erroneously think that if the test is 95% accurate, then a positive result implies a 95% chance of disease.

一个常见错误是混淆 P(B|A) 与 P(A|B)。在医学例子中,许多人错误地认为,如果测试准确率为 95%,那么阳性结果就意味着有 95% 的概率患病。

Another mistake is ignoring the prior probability. The base rate of the disease plays a crucial role in the posterior probability. Even with a highly accurate test, a rare disease yields few true positives.

另一个错误是忽略先验概率。疾病的患病率在后验概率中起着关键作用。即便测试准确率很高,罕见疾病产生的真正阳性仍然很少。

A third pitfall is failing to check that events B and Bᶜ form a partition. Bayes’ Theorem requires the sample space to be completely covered by mutually exclusive hypotheses.

第三个误区是未检查事件 B 与 Bᶜ是否构成分割。贝叶斯定理要求样本空间被一组互斥的假设完全覆盖。

Finally, remember that P(A|B) is not the same as P(A ∩ B). Conditional probability is always defined relative to a condition.

最后,请记住 P(A|B) 与 P(A ∩ B) 并不相同。条件概率永远是相对于某一条件而定义的。


10. Applications Across Disciplines | 跨学科应用

  • Medicine: Interpreting diagnostic tests, drug efficacy, and genetic risk prediction.
  • 医学:解读诊断测试、药物疗效和遗传风险预测。
  • Machine learning: Naive Bayes classifiers for text categorisation and recommendation systems.
  • 机器学习:朴素贝叶斯分类器用于文本分类和推荐系统。
  • Finance: Updating risk assessments and detecting fraudulent transactions.
  • 金融:更新风险评估和识别欺诈交易。
  • Law: Evaluating the probative value of evidence in court cases.
  • 法律:评估法庭证据的证明价值。
  • Sports: Modelling player performance and predicting match outcomes.
  • 体育:模拟运动员表现和预测比赛结果。

In every application, the central idea is identical: start with a prior belief, observe evidence, and update to a posterior belief.

在所有应用中,核心思想是一致的:从先验信念出发,观察证据,更新到后验信念。


11. Worked Problem in IB Style | IB 风格例题

A company has two factories, A and B. Factory A produces 60% of the products, and factory B produces 40%. The defect rate is 2% at factory A and 5% at factory B. A randomly selected product is found to be defective. Find the probability that it came from factory A.

某公司有两个工厂 A 和 B。工厂 A 生产 60% 的产品,工厂 B 生产 40%。工厂 A 的次品率为 2%,工厂 B 的次品率为 5%。随机抽取一件产品发现为次品。求它来自工厂 A 的概率。

Let D be the event that the product is defective. We want P(A|D).

设 D 表示产品为次品这一事件。我们要求 P(A|D)。

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

= (0.02 × 0.60) / (0.02 × 0.60 + 0.05 × 0.40) = 0.012 / 0.032 = 0.375

Thus, the defective product has a 37.5% chance of having come from factory A, even though A produces more items overall.

因此,这件次品来自工厂 A 的概率为 37.5%,尽管总体而言 A 生产的产品更多。


12. Conclusion | 总结

Bayes’ Theorem is a simple yet powerful tool for updating probabilities with new evidence. Its derivation relies only on conditional probability and the law of total probability, but its implications reach far beyond the classroom.

贝叶斯定理是一个简单但强大的工具,用于根据新证据更新概率。其推导仅依赖条件概率和全概率公式,但其影响远远超出了课堂。

Mastering this theorem enables you to critically evaluate diagnostic tests, build machine learning models, and make informed decisions under uncertainty. In IB Mathematics, it is not only a key exam topic but also a bridge to real-world reasoning.

掌握这个定理,你就能批判性地评估诊断测试、构建机器学习模型,并在不确定性下做出明智决策。在 IB 数学中,它不仅是重要的考试主题,更是通往现实世界推理的桥梁。


Published by TutorHao | Mathematics Revision Series | aleveler.com

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

Comments

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

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

Exit mobile version