Bayes Theorem Calculator

Bayes Theorem Calculator

Update P(A) after evidence B using the standard Bayes formula, compare likelihood ratios, false positives, diagnostic PPV-style inputs, odds form, and sensitivity across base rates.

🎯Bayes Scenario Presets

📝Bayes Inputs

Base rate before seeing evidence B.

Diagnostic equivalent: sensitivity or true-positive rate.

Diagnostic equivalent: 1 minus specificity.

Posterior probability 0% P(A|B)
Evidence probability 0% P(B)
Likelihood ratio 0x P(B|A) / P(B|not A)
Posterior odds 0 : 1 odds for A after evidence

🔢Bayes Symbol Snapshot

P(A)Prior chance
P(not A)Complement
P(B|A)Likelihood
P(B|not A)False positive
P(B)Evidence rate
P(A|B)Posterior
LR+Evidence lift
PPVDiagnostic read

📐Bayes Formula Reference

QuantityFormulaMeaningDiagnostic nameWatch for
PriorP(A)Chance before evidencePrevalenceBase-rate error
ComplementP(not A) = 1 – P(A)Chance A is falseNo conditionMust match prior
LikelihoodP(B|A)Evidence rate when A is trueSensitivityLow values miss cases
False positiveP(B|not A)Evidence rate when A is false1 – specificityCan dominate rare priors
Evidence rateP(B|A)P(A)+P(B|not A)P(not A)Overall chance of BPositive-test rateDenominator of Bayes
PosteriorP(A|B) = numerator / denominatorUpdated chance after BPPVNot the same as sensitivity

🔍Diagnostic PPV Style Examples

ScenarioPriorSensitivityFalse positivePosterior if positiveWhy it matters
Rare screen1%95%5%16.1%False positives outnumber true positives
Moderate clinic10%92%8%56.1%Prior makes the same test more persuasive
High-risk group40%90%10%85.7%Base rate and evidence reinforce each other
Quality sensor3%88%4%40.5%Inspection flags still need confirmation
Spam classifier30%94%7%85.2%High prior improves trust in the flag
Fraud alert0.8%85%1.5%31.3%Very low prior keeps posterior moderate
Weather radar25%80%15%64.0%Evidence shifts the forecast but not to certain
Negative result10%95%5%0.6%Absent evidence can strongly reduce probability

📊Current Sensitivity Grid

Likelihood Ratio Lookup

LR bandPositive evidence strengthExample input pairPosterior effectCommon caution
1.0No update80% / 80%Prior unchangedEvidence is not diagnostic
1.5 to 2Small lift60% / 35%Gentle movementBase rate still dominates
2 to 5Useful lift80% / 25%Clear but not finalConfirm if decision is costly
5 to 10Strong lift90% / 12%Large posterior jumpInput accuracy matters
10 to 20Very strong lift95% / 6%Often decisiveRare priors can still surprise
20+Extreme lift98% / 2%Posterior can approach 1Validate independence and sampling

Full Formula Breakdown

Standard BayesP(A|B)=P(B|A)P(A)/[P(B|A)P(A)+P(B|not A)P(not A)].
NumeratorP(B|A)P(A) is the joint probability that A is true and evidence B appears.
DenominatorP(B)=P(B|A)P(A)+P(B|not A)P(not A), the total probability of seeing evidence B.
Negative evidenceP(A|not B)=P(not B|A)P(A)/[P(not B|A)P(A)+P(not B|not A)P(not A)].
Diagnostic PPVUse prevalence for P(A), sensitivity for P(B|A), and false-positive rate for P(B|not A).
Likelihood ratioFor B present, LR+ = P(B|A) / P(B|not A). Posterior odds = prior odds × LR+.
Negative LRFor B absent, LR- = P(not B|A) / P(not B|not A). It usually should be below 1.
Odds conversionPrior odds = P(A)/(1 – P(A)); posterior probability = odds/(1 + odds).

💡Bayes Calculation Tips

Base-rate check: If P(A) is rare, even a strong likelihood can yield a moderate posterior because many non-A cases may also produce evidence B.
False-positive check: In diagnostic PPV style, enter P(B|not A), not specificity. If specificity is 97%, the false-positive input is 3%.
Evidence direction: Switch to B absent when you want the chance A is still true after a negative result, no alert, or missing signal.
Decision threshold: Treat the posterior as an updated probability; compare it with your action threshold before calling the result decisive.

Screening tests can cause your heart to skip a beat: you get the results and they are positive! The test say you have the condition, but then the doctor hesitates to tell you. Why? More often than not it’s not because the machine is busted. It’s because the machine doesn’t understand the neighborhood or how common this condition is where you live.

Bayes theorem is the mathematical tool that plugs that hole and lets you revise your beliefs as new evidence pours in. Most of us intuitively believe that if test is very accurate, a positive result must be close to certainly true. That intuition is almost always wrong if the condition we’re testing for are rare.

Why a Positive Test Might Still Be Wrong

It does all of this complicated math for you on calculator up top, and then lets you think about what it all means for your decision. First, enter your base rate (otherwise known as starting chance). That’s the one-in-a-thousand chance that a disease would affect you if you didn’t take the test. That’s the chance you started with. It doesn’t go away just because you took the test even though many people will screw this part up.

Enter in sensitivity and false-positive rate next. The sensitivity represent the percent of the time that the test identifies someone who has disease (if they really do). The false positive rate represent the percent of the time that the test falsely reports that you have the disease when you don’t.

And that’s where the counterintuitive bit come in. If the condition is rare enough, even most accurate test, at 99 percent, can mostly be wrong. Let’s say it has a one percent false positive rate. If only zero point one percent of population has the disease, the sick minority will produce fewer true positives than the healthy majority will false ones.

The calculator illustrates this by showing the posterior probability, your updated chance of having the condition given that you saw that result. And it frequently appears to be far less different than what you thought it would be. That is the whole point. The test merely nudges the probability around the base rate, and truth is anchored by the base rate.

Imagine it’s similar to looking for a needle in a haystack, except most of the hay are shaped like needles and sticks to the needle-shaped things. So you use the test which pulls lots of twigs (that look like needles) along with actual needle. But the more twigs to needles, the less certain you feel about the grab. The ability to switch views to see what’s actualy present/absent in the sample is key.

A negative reading are equally meaningful. If the test can rules things out, a negative result will take your suspicion from ten percent down to almost none. And this is where likelihood ratio becomes so helpful. It gives you a sense of how much stronger or weaker the evidence is by showing how likely you were to see that particular result if you had the condition compared to if you did not. Not? High = strong. Low = weak.

This is logic that doctors apply daily, but they don’t usually bother writing down the equations. They estimate base rate of the disease, then factor in accuracy of their tests. The calculator lets you play doctor, if only temporarily. You force yourself to face the base rate. You let yourself admit that most people don’t have whatever it is your shiny new test pick up.

The reference table on the page spells it out plainly: how different priors will swing the final result wildly. One test could of been incredibly helpful at picking up a problem in high-risk group, while being almost useless as a screener among general public.

And that’s the point: Evidence isn’t absolutes. Evidence is relative to your pre-existing beliefs. Evidence is clues, not verdicts. Running the numbers helps you distinguish between signal and noise. And when you run the numbers, you stop reacting to the headline result; you begin to understand the underlying probability.

This is a small thing. But it makes a big difference. If there’s a 50% chance this will happen, it’ll make me do one thing. If there’s a 99% chance it will happen, it’ll make me do another thing altogether.

Bayes theorem doesn’t simply spit out a number for you. It spits out perspective. You began with a guess. You added some evidence. Now you’ve got a better guess. And that’s the whole point about learning.

Bayes Theorem Calculator