Bayes' Theorem Calculator (Test Results and Natural Frequencies)

Work out the chance that a positive test is correct from prevalence, sensitivity and specificity.

Runs in your browser. Your files never leave your device. See how to check

…

How to do it

  1. 1
    Step 1: Open Bayes' Theorem Calculator (Test Results and Natural Frequencies) and add your input

    Type your numbers or text, add your file, or pick the options you need. Nothing is uploaded: everything stays in your browser.

  2. 2
    Step 2: What Bayes' Theorem Calculator (Test Results and Natural Frequencies) does

    Work out the chance that a positive test is correct from prevalence, sensitivity and specificity.

  3. 3
    Step 3: Read the result and compare

    The result appears at once. Change one value to see how the answer moves, then keep the figure that fits your case.

  4. 4
    Step 4: Copy or save it

    Copy the result or download it. For an important decision, confirm it with the official source or an adviser.

About this tool

Enter the prevalence of the condition, the sensitivity and the specificity of the test in percent, and a population size. The calculator shows how many people are true and false positives and negatives, the positive predictive value, the negative predictive value and the likelihood ratio.

Bayes' theorem

P(condition | positive) = sensitivity × prevalence ÷ (sensitivity × prevalence + (1 − specificity) × (1 − prevalence)). The natural frequency view counts people: of 10,000 people, 1% have the condition (100), 90 of them test positive; of the 9,900 without it 5% (495) test positive; so only 90 of 585 positives are truly ill, 15.4%.

Lesson

When a condition is rare, most positive results can be false even for a good test. The positive predictive value depends strongly on prevalence.

Other values

Negative predictive value = true negatives ÷ all negatives. Positive likelihood ratio = sensitivity ÷ (1 − specificity).

Worked example

With 1% prevalence, 90% sensitivity and 95% specificity in 10,000 people there are 90 true positives, 495 false positives, 10 false negatives and 9,405 true negatives. A positive result is correct only 15.38% of the time; a negative result 99.89%.

Tips for best results

Check every box before you rely on a result, because one wrong digit changes the whole answer. Use the exact figures from your payslip, bill, certificate or contract, and keep a note of the date you calculated. Rates, thresholds and rules change from time to time, so for tax, fees and legal matters treat the output as an estimate and confirm with the official source named on this page. You can run as many scenarios as you like; nothing is saved or sent, and refreshing the page clears the boxes.

Quick facts

Embed this calculator on your site

Copy this code to show the calculator on your own page. A link back to shobfree.com is included.

Frequently asked questions

Why is the positive predictive value so low?

Because most people tested do not have the condition, so false positives outnumber true ones.

How do I improve it?

Test people at higher risk, or use a more specific test.

What are sensitivity and specificity?

The share of sick people found and the share of healthy people correctly cleared.

Is this medical advice?

No. Discuss results with a clinician.

Guides for this tool

Completely freeNo cost, no sign-up
Files stay privateEverything runs in your browser
Easy in your languageAvailable in many languages