Statistics & probability • 2026 edition
\( P(A|B) = \frac{P(B|A) \times P(A)}{P(B)} \)
Where:
Bayes theorem updates prior beliefs with new evidence. It's fundamental in statistics, machine learning, medical diagnosis, and decision-making. The theorem provides a principled way to combine prior knowledge with new data to form updated beliefs.
Example: If a disease affects 1% of the population (P(Disease)=0.01), and a test is 95% accurate for positive results (P(Positive|Disease)=0.95) and 98% accurate for negative results (P(Negative|No Disease)=0.98), then:
\( P(B) = P(Positive|Disease) \times P(Disease) + P(Positive|No Disease) \times P(No Disease) \)
\( P(B) = 0.95 \times 0.01 + 0.02 \times 0.99 = 0.0095 + 0.0198 = 0.0293 \)
\( P(Disease|Positive) = \frac{0.95 \times 0.01}{0.0293} = \frac{0.0095}{0.0293} = 0.324 \)
Even with a positive test, there's only a 32.4% chance of actually having the disease.
Bayes theorem is a fundamental principle in probability theory that describes how to update the probability of a hypothesis based on new evidence. It provides a mathematical framework for incorporating prior knowledge with observed data to form updated beliefs. The theorem is named after Reverend Thomas Bayes and is widely used in statistics, machine learning, medical diagnosis, and decision theory.
The standard form of Bayes theorem:
Extended form with total probability:
Key areas where Bayes theorem is applied:
Mathematical formula for updating probabilities based on new evidence.
\( P(A|B) = \frac{P(B|A) \times P(A)}{P(B)} \)
Updates prior beliefs with new evidence.
Used in medical diagnosis, machine learning, quality control, and decision analysis.
Which of the following statements about Bayes theorem is CORRECT?
The answer is B) Bayes theorem updates prior beliefs with new evidence. This is the fundamental purpose of Bayes theorem - to provide a mathematical framework for updating our beliefs about a hypothesis when we observe new evidence. It applies to both dependent and independent events and has applications across many fields.
This question tests the core understanding of Bayes theorem. The theorem is a method for rational belief updating, not restricted to any particular domain. It provides a principled way to combine prior knowledge with new data, making it fundamental to rational decision-making under uncertainty.
Prior Probability: Initial probability before observing evidence
Posterior Probability: Updated probability after observing evidence
Likelihood: Probability of evidence given the hypothesis
• Applies to dependent events
• Works with both discrete and continuous probabilities
• Universal applicability across domains
• Think of it as a belief updating mechanism
• Always consider the prior probability
• Evidence strength depends on likelihood ratio
• Confusing P(A|B) with P(B|A)
• Ignoring prior probabilities
• Misunderstanding the direction of conditioning
A disease affects 2% of the population. A test for the disease is 90% accurate for positive results and 95% accurate for negative results. If a person tests positive, what is the probability they actually have the disease? Show your work.
Let D = disease, T = positive test
Given:
• P(D) = 0.02 (prior probability of disease)
• P(T|D) = 0.90 (sensitivity)
• P(T|¬D) = 0.05 (false positive rate)
• P(¬D) = 0.98 (probability of no disease)
Step 1: Calculate P(T) using law of total probability:
P(T) = P(T|D) × P(D) + P(T|¬D) × P(¬D)
P(T) = 0.90 × 0.02 + 0.05 × 0.98
P(T) = 0.018 + 0.049 = 0.067
Step 2: Apply Bayes theorem:
P(D|T) = [P(T|D) × P(D)] / P(T)
P(D|T) = (0.90 × 0.02) / 0.067
P(D|T) = 0.018 / 0.067 = 0.269
Therefore, there is a 26.9% probability the person has the disease given a positive test.
This classic example demonstrates how even a highly accurate test can yield a relatively low probability of disease when the disease is rare. This is because the number of false positives can be significant relative to the number of true positives when the base rate is low. This phenomenon is known as base rate neglect.
Sensitivity: P(Positive test | Disease) - True positive rate
Specificity: P(Negative test | No disease) - True negative rate
Positive Predictive Value: P(Disease | Positive test)
• Calculate P(Evidence) using total probability law
• P(Disease|Positive) ≠ P(Positive|Disease)
• Low base rates can significantly impact results
• Always calculate the denominator P(B) first
• Use a 2x2 table to organize information
• Consider the base rate in all calculations
• Forgetting to calculate P(Positive) using total probability
• Confusing sensitivity with positive predictive value
• Not accounting for false positives
A factory produces components with a 5% defect rate. A quality control test correctly identifies 98% of defective components and 97% of non-defective components. If a component tests positive for defects, what is the probability it actually has a defect? Discuss the implications for the factory's quality control process.
Let D = defective component, T = positive test for defects
Given:
• P(D) = 0.05 (defect rate)
• P(T|D) = 0.98 (test sensitivity)
• P(¬T|¬D) = 0.97 (test specificity)
• P(T|¬D) = 1 - 0.97 = 0.03 (false positive rate)
Step 1: Calculate P(T):
P(T) = P(T|D) × P(D) + P(T|¬D) × P(¬D)
P(T) = 0.98 × 0.05 + 0.03 × 0.95
P(T) = 0.049 + 0.0285 = 0.0775
Step 2: Apply Bayes theorem:
P(D|T) = [P(T|D) × P(D)] / P(T)
P(D|T) = (0.98 × 0.05) / 0.0775
P(D|T) = 0.049 / 0.0775 = 0.632
Therefore, there is a 63.2% probability the component is defective given a positive test.
Implications: The factory should be cautious about discarding components based solely on positive tests, as nearly 37% of positively tested components may actually be good. Consider re-testing or additional verification for components that test positive.
This example shows how Bayes theorem applies to industrial quality control. Despite a highly accurate test (98% and 97%), the probability that a positive test indicates a real defect is only 63.2% due to the low defect rate. This demonstrates the importance of considering base rates in quality control decisions.
False Positive: Test indicates defect when component is good
False Negative: Test indicates no defect when component is bad
Quality Control: Process of ensuring product meets specifications
• Consider economic impact of false positives
• Balance sensitivity and specificity
• Account for base rates in decision-making
• Calculate both positive and negative predictive values
• Consider the cost of different types of errors
• Use Bayes to optimize decision thresholds
• Not considering economic implications of false positives
• Assuming test accuracy equals predictive value
• Forgetting to account for base rates
A spam filter uses Bayes theorem with the word "free" to classify emails. If 20% of emails are spam, and "free" appears in 80% of spam emails but only 5% of legitimate emails, what is the probability that an email containing "free" is spam? How should this inform the spam filter's threshold?
Let S = spam email, W = email contains "free"
Given:
• P(S) = 0.20 (spam rate)
• P(W|S) = 0.80 (word "free" in spam)
• P(W|¬S) = 0.05 (word "free" in legitimate)
• P(¬S) = 0.80 (legitimate rate)
Step 1: Calculate P(W):
P(W) = P(W|S) × P(S) + P(W|¬S) × P(¬S)
P(W) = 0.80 × 0.20 + 0.05 × 0.80
P(W) = 0.16 + 0.04 = 0.20
Step 2: Apply Bayes theorem:
P(S|W) = [P(W|S) × P(S)] / P(W)
P(S|W) = (0.80 × 0.20) / 0.20
P(S|W) = 0.16 / 0.20 = 0.80
Therefore, there is an 80% probability the email is spam given it contains "free".
Threshold recommendation: With an 80% probability of being spam, emails containing "free" should likely be classified as spam, but the threshold could be set at a higher probability (e.g., 90%) to reduce false positives.
This demonstrates the classic application of Bayes theorem in spam filtering. The high posterior probability (80%) indicates that "free" is a strong indicator of spam. However, the filter designer must balance between catching spam (high recall) and avoiding misclassifying legitimate emails (high precision).
Naive Bayes: Classification algorithm using Bayes theorem with independence assumption
Recall: Proportion of actual positives correctly identified
Precision: Proportion of predicted positives that are correct
• Combine multiple features for better classification
• Adjust thresholds based on cost considerations
• Consider both false positive and false negative costs
• Use multiple words/features for improved accuracy
• Adjust thresholds based on application needs
• Consider Laplace smoothing for rare features
• Assuming feature independence when it doesn't hold
• Not considering the cost of different types of errors
• Using single features without context
Which of the following is TRUE about Bayes theorem?
The answer is B) It can be applied iteratively as new evidence arrives. Bayes theorem is particularly powerful because the posterior probability from one calculation can serve as the prior for the next calculation when new evidence becomes available. This makes it ideal for sequential learning and updating beliefs over time.
This highlights one of the most valuable properties of Bayes theorem - its iterative nature. Today's posterior becomes tomorrow's prior, allowing for continuous learning and belief updating as new information becomes available. This property is fundamental to many machine learning algorithms and adaptive systems.
Iterative Bayes: Using posterior as prior for subsequent updates
Sequential Learning: Updating beliefs as new data arrives
Adaptive Systems: Systems that learn and adjust over time
• Posterior from one calculation becomes prior for next
• Can handle multiple hypotheses simultaneously
• Works with any valid probability values
• Use iterative updates for streaming data
• Can extend to multiple hypotheses
• Works with continuous probability distributions
• Not utilizing the iterative property
• Thinking it only applies to binary classification
• Assuming restrictive distribution requirements
Q: What's the difference between likelihood and posterior probability?
A: The key differences:
Likelihood P(B|A): Probability of observing evidence B given that hypothesis A is true
\( P(B|A) = \frac{P(A \cap B)}{P(A)} \)
Posterior P(A|B): Probability that hypothesis A is true given that evidence B was observed
\( P(A|B) = \frac{P(B|A) \times P(A)}{P(B)} \)
Likelihood measures how well the hypothesis predicts the data, while posterior measures how probable the hypothesis is given the data. Bayes theorem connects these two concepts.
Q: How do I choose the prior probability in Bayes theorem?
A: Prior selection methods:
The choice of prior is crucial as it significantly influences the posterior, especially with limited data. As more data becomes available, the influence of the prior diminishes.