CalcWorldHub
Statistics · CalcWorldHub

Bayes Theorem Posterior Probability from Prior and Test Accuracy

A Bayes theorem calculator can show how a prior probability changes after a positive test result. Enter prior probability, sensitivity, and false-positive rate as percentages. The result is a mathematical posterior under those assumptions, not an individual diagnosis or a substitute for clinical interpretation.

Open calculator
A positive-result diagram separates true positives from false positives before calculating posterior probability.

Share this article

Condition-present and condition-absent groups contribute true-positive and false-positive results.
Both positive-result paths belong in the denominator

Condition on a positive test result

Let P be the prior probability, Se the sensitivity, and FPR the false-positive rate, all expressed as fractions between 0 and 1. The calculator returns P(condition | positive) = Se×P ÷ [Se×P + FPR×(1−P)]. The denominator is the probability of a positive result across people with and without the condition. The displayed answer is a percentage rounded to five decimal places.

The input fields use percentages, not decimals: 2 means 2%, which is converted to 0.02 inside the calculation. The calculator asks directly for the false-positive rate; if a source reports specificity, convert it as FPR = 100% − specificity. Do not enter sensitivity and specificity as if they were interchangeable.

Understand the prior and test-performance inputs

The prior probability represents the condition frequency or pretest probability in the population to which the test result is being applied. A value from a broad population may not fit a referred clinic, a screening program, or a person with different risk factors. Sensitivity and false-positive rate should come from evidence for the same test threshold, intended population, specimen, and reference standard.

The formula assumes those inputs are appropriate and stable for the question. It does not estimate sensitivity from raw test data, account for confidence intervals, adjust for study bias, or select a threshold. If test performance changes across subgroups or settings, one pooled pair of rates may not represent the person or population of interest.

Why prior probability changes the positive predictive value

A positive result can be a true positive or a false positive. When the condition is uncommon, even a modest false-positive rate can contribute many positive results because the condition-absent group is large. The posterior therefore depends on prevalence as well as test sensitivity and false-positive rate; a test’s sensitivity alone is not the chance that a positive result is correct.

This is the positive predictive value (PPV) for the entered assumptions: the probability that the condition is present given a positive result. The negative predictive value (NPV) answers the complementary question—the probability that the condition is absent given a negative result. Therefore, the probability that the condition is present after a negative result is 1 − NPV when NPV is a fraction, or 100% − NPV when NPV is written as a percentage. This calculator reports PPV for positive results; do not read its output as a negative-result probability.

Use diagnostic examples as mathematics, not advice

Think of the denominator as all positive test results: true positives from the condition-present group plus false positives from the condition-absent group. This count-based view is equivalent to Bayes’ formula and helps identify which assumptions drive PPV.

For an actual test, use evidence for its approved or intended use and a prior probability appropriate to the patient or study population. Regulatory guidance emphasizes that diagnostic performance depends on the intended-use population and reference standard. A calculator cannot review symptoms, history, confirmatory testing, uncertainty, or the consequences of a false result.

Changing the prior probability changes the share of positive results that are true positives.
The prior changes positive predictive value

Worked examples

Use percentages from the same target population and test definition; this calculation is conditional on a positive result.

A low prior with a positive result

Inputs: Prior probability = 2%; sensitivity = 95%; false-positive rate = 5%.

Calculation: PPV = (0.95 × 0.02) ÷ [(0.95 × 0.02) + (0.05 × 0.98)] × 100 = 0.019/0.068 × 100 = 27.941176…% ≈ 27.94118%.

Under these assumptions, about 27.94% of positive results correspond to the condition.

A higher prior with the same false-positive rate

Inputs: Prior probability = 10%; sensitivity = 90%; false-positive rate = 5%.

Calculation: PPV = (0.90 × 0.10) ÷ [(0.90 × 0.10) + (0.05 × 0.90)] × 100 = 0.09/0.135 × 100 = 66.666666…% ≈ 66.66667%.

With this different prior and sensitivity, two thirds of positive results are true positives under the stated model.

Check percentages, rounding, and limits

Each percentage must be between 0 and 100. If prior probability and sensitivity both produce no true-positive path and the false-positive path is also zero, the denominator is zero and the posterior is undefined; the page reports that condition rather than a percentage. Inputs that make the denominator positive produce a computed value, but mathematical validity does not confirm that the rates are clinically transferable.

The result is rounded for display to five decimal places. Do not mistake those digits for certainty about a patient or test. The input rates may themselves be estimates with sampling error, and the prior may be uncertain. For medical decisions, interpret a result with the relevant clinician and validated evidence rather than using the calculator as a stand-alone diagnostic tool.

Sources and further reading

Share this article

Browse all articles · Calculator: Bayes theorem calculator