Calculate conditional posterior probability P(A|B), positive predictive value (PPV), false positives, and medical test accuracy.
Did this calculation save you time?
Student ProjectHi! I'm a student developer building Calculat in my spare time. I was tired of searching for basic math tools and having to click through 10 spammy popups, loan ads, and cookie trackers.
I keep this website 100% free, private, and ad-free. If this helped you with your homework, project, or finances today, bookmarking this page or telling a friend helps me keep building more free tools!
Bayes' Theorem is a foundational mathematical formula that updates the probability of a hypothesis (prior probability) as new evidence or test results become available. It is widely applied in medical diagnostic testing, spam filtering algorithms, and machine learning.
P(A|B) = \frac{P(B|A) P(A)}{P(B)} = \frac{P(B|A) P(A)}{P(B|A) P(A) + P(B|A') P(A')}Where P(A|B) is the posterior probability of A given evidence B, P(B|A) is the likelihood/sensitivity, P(A) is the prior probability, and P(B) is the total marginal probability of observing evidence B.
Scenario: A rare disease affects 1% of people (P(A) = 0.01). A diagnostic test has 95% sensitivity (P(B|A) = 0.95) and a 5% false positive rate (P(B|A') = 0.05). If a patient tests positive, what is the probability they actually have the disease?
True Positives in 10,000 people: 10,000 × 0.01 × 0.95 = 95.
False Positives in 10,000 people: 10,000 × 0.99 × 0.05 = 495.
Total Positive Tests: 95 + 495 = 590.
Apply Bayes' rule: P(Disease | Positive) = 95 / 590 ≈ 0.1610 (16.10%).
Because when a condition is rare (e.g. 1 in 100), the 99 healthy people produce vastly more false positive test results (approx 5) than the single sick person produces true positive results (~1).
Prior probability is your estimate before observing new evidence (e.g. general disease prevalence). Posterior probability is the revised estimate after incorporating the test result.
Specificity is the True Negative rate: the probability that a healthy person tests negative. A test with a 5% false positive rate has a 95% specificity.
Naive Bayes spam filters calculate the probability an incoming email is spam given the presence of specific words (e.g. "free", "crypto", "wire transfer") based on historical training data.
Calculate the probability of single events, union of events, intersection, conditional probability P(A|B), and complements.
Compute exact P(X=k) and cumulative binomial probabilities P(X≤k), P(X≥k), distribution mean, variance, and standard deviation.
Convert between probability percentages, decimal odds, fractional odds, and American moneyline odds with payout estimates.
e.g. 0.01 = 1% prevalence
True positive detection rate
1 - Specificity
If you test positive, the probability you genuinely have condition A is 16.1%.