
Compute P(A|B) from prior probabilities, enter values between 0% and 100%
P(A|B) = P(B|A) × P(A) / P(B)
Powered by Bayes' Theorem · Statistics Tools
User Ratings:
ADVERTISEMENT
ADVERTISEMENT
Imagine you’re a doctor reviewing a positive test result for a rare disease. The test is accurate, but the disease itself is uncommon. What’s the actual chance the patient has the condition? This is the kind of question Bayes’ theorem answers, it lets you update your belief about the probability of one event based on new evidence. But the math can be tricky, especially when you’re dealing with percentages that don’t convert easily into probabilities.
This Bayes’ theorem calculator takes the guesswork out of conditional probability. Enter P(A) (the prior probability of event A), P(B) (the probability of event B), and P(B|A) (the probability of B given A). The tool computes P(A|B), the probability of A given that B has occurred and provides a clear calculation breakdown and interpretation. Whether you’re a data scientist updating a Bayesian model, a medical researcher analyzing test accuracy, or a student learning about conditional probability, this calculator delivers accurate results instantly. All calculations run locally in your browser, keeping your data private.
Enter P(A), the prior probability of event A as a percentage in the first input field.
Enter P(B), the probability of event B as a percentage in the second input field.
Enter P(B|A), the probability of B given A as a percentage in the third input field.
Click Calculate or simply wait for automatic updates the result appears instantly.
Review P(A|B), the conditional probability of A given B, in the highlighted result box.
Check the calculation breakdown and interpretation to understand what the result means.
The calculator applies Bayes’ theorem, which relates conditional probabilities to their inverses using prior probabilities. This theorem is fundamental to probability theory and has applications in statistics, medicine, and machine learning.
Formula: P(A|B) = P(B|A) × P(A) / P(B)
The theorem states that the probability of event A given event B is equal to the probability of B given A multiplied by the prior probability of A, divided by the probability of B. All probabilities are converted from percentages to decimals before computation.
The calculator validates inputs to ensure they’re within the valid range of 0% to 100%. If P(B) is zero, the result is undefined and the calculator displays a clear error message. The result is then converted back to a percentage for display.
A disease affects 10% of the population (P(A) = 10%). A diagnostic test for the disease has a sensitivity of 90% (P(B|A) = 90%), meaning it correctly identifies 90% of people with the disease. The test has a false positive rate such that the overall probability of a positive test result is 30% (P(B) = 30%). What is the probability that a person with a positive test result actually has the disease?
Step 1: Identify the known values
P(A) = 10% (prior probability of having the disease)
P(B|A) = 90% (probability of a positive test given the disease)
P(B) = 30% (overall probability of a positive test)
Step 2: Apply Bayes’ theorem
P(A|B) = (90% × 10%) / 30%
P(A|B) = (0.90 × 0.10) / 0.30
P(A|B) = 0.09 / 0.30
P(A|B) = 0.30 = 30%
Interpretation: Despite the test having 90% sensitivity, the probability that a person with a positive test result actually has the disease is only 30%. This is because the disease is relatively rare (10% prevalence) and the test has some false positives. The calculator helps you understand this counterintuitive result.
Bayes’ theorem is a mathematical rule for updating probabilities based on new evidence. It relates conditional probabilities: P(A|B) = P(B|A) × P(A) / P(B). It’s used in statistics, medicine, and machine learning.
P(A|B) is the probability of A given B, the probability that event A occurs given that B has already occurred. P(B|A) is the probability of B given A. They’re different quantities, and Bayes’ theorem provides the relationship between them.
A prior probability is the probability of an event before considering new evidence. In Bayes’ theorem, P(A) is the prior probability of event A. It’s updated to the posterior probability P(A|B) after considering evidence B.
A posterior probability is the updated probability of an event after considering new evidence. In Bayes’ theorem, P(A|B) is the posterior probability of A given B. It incorporates the prior probability and the likelihood of the evidence.
Bayes’ theorem is essential in medicine because it helps interpret diagnostic test results. A positive test result for a rare disease is not necessarily as alarming as it seems, because the test’s false positive rate and the disease’s prevalence must be considered. Bayes’ theorem provides the correct calculation.
The denominator in Bayes’ theorem is P(B), the overall probability of the evidence. It ensures that the result is a proper probability between 0 and 1. P(B) is often calculated as P(B|A)×P(A) + P(B|not A)×P(not A).
Bayes’ theorem is the foundation of Bayesian machine learning, where prior beliefs about model parameters are updated based on observed data. It’s also used in classification algorithms like Naive Bayes, which is applied in spam filtering and text classification.
If P(B) is zero, Bayes’ theorem is undefined because division by zero is not allowed. This occurs when the evidence has zero probability. The calculator displays an error message in this case, explaining that the conditional probability cannot be calculated.
ADVERTISEMENT
ADVERTISEMENT