{"uid":"cap_wF-y8DW8K-pvSe2Los61c","slug":"bayes-theorem-posterior-probability-calculator-49177115","name":"Bayes' Theorem Posterior Probability Calculator","description":"Bayes' theorem: posterior probability from a prior, sensitivity and false-positive rate, with natural frequencies and odds form.","url":"https://probability-calc.x402tookit.com/bayes?utm_source=zero.xyz","method":"GET","headers":{},"bodySchema":{"type":"object","$schema":"https://json-schema.org/draft/2020-12/schema","required":["input"],"properties":{"input":{"type":"object","required":["type","method"],"properties":{"type":{"type":"string","const":"http"},"method":{"enum":["GET"],"type":"string"},"queryParams":{"type":"object","required":["prior","sensitivity"],"properties":{"prior":{"type":"number","description":"Prior probability of the hypothesis (prevalence or base rate), 0 to 1"},"population":{"type":"integer","description":"Population for natural frequencies (default 10000)"},"sensitivity":{"type":"number","description":"P(positive evidence | hypothesis true), 0 to 1 (true positive rate)"},"specificity":{"type":"number","description":"Or P(negative evidence | hypothesis false); false positive rate = 1 - specificity"},"falsePositiveRate":{"type":"number","description":"P(positive evidence | hypothesis false), 0 to 1 (give this or specificity)"}}}},"additionalProperties":false},"output":{"type":"object","required":["type"],"properties":{"type":{"type":"string"},"example":{"type":"object","properties":{"asOf":{"type":["null","string"]},"prior":{"type":["null","number"]},"source":{"type":["null","string"]},"reasons":{"type":["array","null"],"items":{"type":"string"}},"summary":{"type":["null","string"]},"verdict":{"type":["null","string"]},"degraded":{"type":["boolean","null"]},"priorOdds":{"type":["null","number"]},"disclaimer":{"type":["null","string"]},"notChecked":{"type":["array","null"],"items":{"type":"string"}},"sensitivity":{"type":["null","number"]},"specificity":{"type":["null","number"]},"posteriorOdds":{"type":["null","number"]},"falsePositiveRate":{"type":["null","number"]},"naturalFrequencies":{"type":["null","object"],"properties":{"population":{"type":["null","number"]},"trueNegatives":{"type":["null","number"]},"truePositives":{"type":["null","number"]},"falseNegatives":{"type":["null","number"]},"falsePositives":{"type":["null","number"]},"haveHypothesis":{"type":["null","number"]}}},"probabilityOfPositive":{"type":["null","number"]},"posteriorGivenNegative":{"type":["null","number"]},"posteriorGivenPositive":{"type":["null","number"]},"likelihoodRatioPositive":{"type":["null","number"]},"falseAlarmShareOfPositives":{"type":["null","number"]}}}}}}},"responseSchema":null,"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.02","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.02/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.02","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.02","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_7Lwh4qxj5wTohqFl6dKwj","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.02","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Computes posterior probability from a prior, sensitivity, and false-positive rate using Bayes' theorem, with natural frequencies and odds form output.","exampleAgentPrompt":"Using Bayes' theorem, what's the posterior probability that someone actually has a disease if the base rate (prevalence) is 1% (0.01), the test sensitivity is 90% (0.9), and the false positive rate is 5% (0.05)? Also show me the natural frequencies for a population of 10000.","exampleUseCases":[{"title":"Medical diagnostic test accuracy","prompt":"A cancer screening test has 85% sensitivity and a 3% false positive rate. If the disease affects 0.5% of the population (prior = 0.005), what's the real probability someone actually has cancer after testing positive? Show natural frequencies for 100000 people."},{"title":"Spam filter Bayesian update","prompt":"My spam filter flags 95% of real spam (sensitivity = 0.95) but also incorrectly flags 2% of legitimate emails (false positive rate = 0.02). If about 30% of all incoming emails are spam (prior = 0.3), what's the posterior probability that a flagged email is actually spam?"},{"title":"Drug test reliability assessment","prompt":"A workplace drug test has a sensitivity of 0.99 and a specificity of 0.95. Given that roughly 5% of employees use drugs (prior = 0.05), what's the chance an employee who tests positive is actually a user? Give me the natural frequencies for a group of 1000 people."}],"resultDescription":"Returns posterior probability (P(hypothesis|evidence)), prior and posterior odds, specificity and false positive rate, and a natural frequencies breakdown (true positives, false positives, true negatives, false negatives) for the specified population, along with a plain-language summary and verdict.","failureModes":["Missing required parameters (prior or sensitivity) returns a 400 error","Prior, sensitivity, specificity, or falsePositiveRate outside [0,1] range returns a validation error","Providing neither specificity nor falsePositiveRate may result in an incomplete computation","Population set to 0 or negative integer causes a computation error","Conflicting specificity and falsePositiveRate values (where fpr != 1 - specificity) may be flagged or one ignored"],"whenToPreferThis":"Choose this endpoint when you need to perform Bayesian inference from a prior probability, sensitivity, and false-positive rate — especially for medical testing, diagnostic accuracy, or any scenario where you want to update a belief with new evidence. It is ideal when you need natural frequency representations alongside the probability, or when working with non-statisticians who benefit from plain-language summaries. Prefer this over manual calculation when you need both odds form and probability form simultaneously.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-30T00:30:45.871Z","isFirstParty":false,"canonicalSlug":"bayes-theorem-posterior-probability-calculator-49177115"}