Пошаговые инструкции
Identify Your Probabilities (Inputs)
First, clearly define the hypothesis (A) and the evidence (B) you are interested in. Then, gather the necessary input probabilities: 1. **Prior Probability P(A)**: The initial probability of your hypothesis (A) being true before any new evidence. 2. **Likelihood P(B|A)**: The probability of observing the evidence (B) if your hypothesis (A) is true. 3. **Likelihood P(B|not A)**: The probability of observing the evidence (B) if your hypothesis (A) is *not* true. This is often needed to calculate the marginal probability P(B). For our example: * P(A) = P(Disease) = 0.01 * P(B|A) = P(Positive|Disease) = 0.90 * P(B|not A) = P(Positive|No Disease) = 0.05
Calculate the Marginal Probability of Evidence P(B)
The marginal probability of evidence P(B) is the overall probability of observing the evidence, irrespective of whether the hypothesis A is true or not. You calculate this using the Law of Total Probability: `P(B) = P(B|A) * P(A) + P(B|not A) * P(not A)` Remember that `P(not A) = 1 - P(A)`. For our example: * P(not A) = 1 - P(A) = 1 - 0.01 = 0.99 * P(B) = (0.90 * 0.01) + (0.05 * 0.99) * P(B) = 0.009 + 0.0495 * P(B) = 0.0585 This means there is an overall 5.85% chance of a random person testing positive.
Apply Bayes' Theorem Formula
Now that you have all the necessary components, plug them into the Bayes' Theorem formula: `P(A|B) = [P(B|A) * P(A)] / P(B)` Using the values from our example: * P(A|B) = [0.90 * 0.01] / 0.0585 * P(A|B) = 0.009 / 0.0585
Compute the Posterior Probability P(A|B)
Perform the final division to obtain your posterior probability. For our example: * P(A|B) = 0.009 / 0.0585 * P(A|B) ≈ 0.1538
Interpret Your Result
The calculated posterior probability P(A|B) represents your updated belief in the hypothesis A, given the new evidence B. It tells you how the evidence has changed your initial probability (P(A)). In our example, P(Disease|Positive) ≈ 0.1538. This means that even after testing positive for the disease, there is only about a 15.38% chance that the person actually has the disease. This is a significant increase from the initial 1% prior probability, but it's still relatively low due to the rarity of the disease and the false positive rate of the test. This highlights how Bayes' Theorem can produce counter-intuitive results by accurately weighing all available information.
Bayes' Theorem is a fundamental principle in probability theory that allows us to update the probability of a hypothesis as new evidence becomes available. It provides a formal framework for understanding how to revise our beliefs in light of new information. This guide will walk you through the manual calculation of posterior probability using Bayes' Theorem, ensuring a clear understanding of each component and its role.
At its core, Bayes' Theorem connects the conditional probability of A given B (the posterior probability) to the conditional probability of B given A (the likelihood), the prior probability of A, and the marginal probability of B.
Prerequisites for Understanding Bayes' Theorem
Before diving into Bayes' Theorem, a basic understanding of probability concepts is essential. You should be familiar with:
- Probability (P(X)): The likelihood of an event X occurring.
- Conditional Probability (P(X|Y)): The probability of event X occurring given that event Y has already occurred.
- Complementary Events (P(not X)): The probability of event X not occurring, where P(not X) = 1 - P(X).
- Law of Total Probability: A rule relating marginal probabilities to conditional probabilities, often used to calculate the marginal probability of evidence, P(B).
The Bayes' Theorem Formula
Bayes' Theorem is expressed as:
P(A|B) = [P(B|A) * P(A)] / P(B)
Where:
P(A|B): The Posterior Probability – the probability of hypothesis A being true given the evidence B. This is what you are calculating.P(B|A): The Likelihood – the probability of observing the evidence B given that hypothesis A is true.P(A): The Prior Probability – the initial probability of hypothesis A being true before considering any new evidence.P(B): The Marginal Probability of Evidence – the overall probability of observing the evidence B, regardless of whether hypothesis A is true or not. This is often calculated using the Law of Total Probability:P(B) = P(B|A) * P(A) + P(B|not A) * P(not A).
Step-by-Step Manual Calculation
To manually calculate the posterior probability, follow these steps meticulously.
Worked Example: Medical Diagnosis
Let's consider a practical scenario. Imagine a rare disease that affects 1% of the population. A diagnostic test for this disease has a 90% true positive rate (meaning if you have the disease, the test correctly identifies it 90% of the time) and a 5% false positive rate (meaning if you don't have the disease, the test incorrectly says you do 5% of the time).
We want to find the probability that a person actually has the disease, given that they tested positive. This is P(Disease|Positive).
Let:
A= The event that a person has the disease.not A= The event that a person does NOT have the disease.B= The event that the test result is positive.
Given information:
P(A)(Prior Probability of Disease) = 0.01 (1%)P(not A)= 1 - P(A) = 1 - 0.01 = 0.99P(B|A)(Likelihood of Positive Test given Disease) = 0.90 (90% true positive rate)P(B|not A)(Likelihood of Positive Test given NO Disease) = 0.05 (5% false positive rate)
Common Pitfalls to Avoid
- Confusing P(A|B) with P(B|A): This is the most common mistake. The probability of having a disease given a positive test is very different from the probability of testing positive given you have the disease. Bayes' Theorem helps clarify this distinction.
- Incorrectly Calculating P(B): The marginal probability of evidence P(B) is crucial. Failing to use the Law of Total Probability correctly, or forgetting to account for the
P(B|not A) * P(not A)component, will lead to an incorrect posterior probability. - Misinterpreting Prior Probabilities: Ensure your prior probability
P(A)accurately reflects the initial belief or prevalence before any new evidence is considered. An inaccurate prior will propagate errors into the posterior. - Mathematical Errors: Even simple arithmetic mistakes can lead to significantly different results. Double-check all calculations, especially when dealing with decimals.
When to Use a Calculator
While manual calculation is excellent for understanding the mechanics, for more complex scenarios or when dealing with many decimal places, a calculator is invaluable. Statistical software, spreadsheets, or online Bayes' Theorem calculators can quickly compute the posterior probability, reducing the risk of arithmetic errors and allowing you to focus on interpreting the results. They are particularly useful for sensitivity analyses, where you might want to see how changes in prior probabilities or likelihoods affect the posterior probability.