Bayes' Theorem Interactive Experiment

Through a medical testing case, intuitively understand how new evidence updates our probability judgments

🎯 Key Question: Does a positive test result mean you definitely have the disease?
Core Formula
$$P(A|B) = \frac{P(B|A) \cdot P(A)}{P(B)}$$
\(P(A|B)\) - Posterior Probability: Updated belief about event \(A\) after seeing evidence \(B\).
\(P(A)\) - Prior Probability: Background probability before seeing evidence (initial belief).
\(P(B|A)\) - Likelihood: Probability of observing evidence \(B\) given \(A\) occurs.
\(P(B)\) - Normalizing Constant: Total probability of evidence occurring (total probability formula).
1
Bayes' Theorem Formula
$$P(患病|阳性) = \frac{P(阳性|患病) \times P(患病)}{P(阳性)}$$
Posterior P(Disease|Positive): Probability of actually having disease given positive test
Prior P(Disease): Prevalence before testing (base rate)
Likelihood P(Positive|Disease): Probability of positive test given disease (sensitivity)
Evidence P(Positive): Total probability of testing positive
2

Medical Testing Case

Suppose a disease has a prevalence of 5% in the population. Now there's a test available:

  • Sensitivity 90%: 90% of people with the disease test positive
  • False Positive Rate 10%: 10% of people without the disease test positive incorrectly

💡 Key Insight:

Even if the test is positive, you're not necessarily 100% likely to have the disease. Multiple factors like prevalence and test accuracy need to be considered.

3

Interactive Parameters

Adjust the sliders to observe how probabilities change. You'll notice:
• Lower prevalence means positive results are more likely false positives
• Higher false positive rate reduces test reliability

Test Result Interpretation
Real-time Calculation
Probability of disease given positive test
0%
Calculated from current parameters
Population Distribution Visualization
True Positive
False Negative
False Positive
True Negative
Prior Probability (P(Disease))
--
Base Prevalence
Sensitivity (P(Positive|Disease))
--
True Positive Rate
Specificity (P(Negative|Healthy))
--
True Negative Rate
Positive Predictive Value
--
Probability after positive test
💡 Bayesian Thinking: How to Update Beliefs?
1
Prior Belief

Initial judgment based on existing knowledge and experience before acquiring new information. For example: the base prevalence of a disease in the population.

2
Gather Evidence

Acquire new data through observation, experimentation, or testing. For example: a positive medical test result.

3
Update Belief

Update the original belief using Bayes' theorem based on new evidence to obtain a more accurate posterior probability.