Bayesian Calculator Inputs
Enter prior probability, test sensitivity, test specificity, expected sample size, and your evidence type. The calculator updates posterior probabilities using Bayes’ theorem.
Plotly Graph
This chart compares the prior probability with updated posterior estimates and related performance measures.
What Is a Bayesian Calculator
A Bayesian calculator applies Bayes’ theorem to update a starting belief after new evidence appears. It combines the prior probability with evidence quality, often measured through sensitivity and specificity. The result is a posterior probability, which is the revised chance after considering the new information.
This is useful in diagnostics, fraud detection, quality control, forecasting, and decision analysis. It helps explain why strong tests can still produce misleading results when the starting event is rare.
Formula Used
The calculator uses Bayes’ theorem for two common outcomes. It assumes one event and one observed test result.
| Scenario | Formula |
|---|---|
| Posterior after positive evidence | P(H|E+) = [P(E+|H) × P(H)] / {[P(E+|H) × P(H)] + [P(E+|¬H) × P(¬H)]} |
| Posterior after negative evidence | P(H|E−) = [P(E−|H) × P(H)] / {[P(E−|H) × P(H)] + [P(E−|¬H) × P(¬H)]} |
| Using test measures | P(E+|H)=Sensitivity, P(E−|¬H)=Specificity, P(E+|¬H)=1−Specificity, P(E−|H)=1−Sensitivity |
- P(H) is the prior probability.
- P(H|E) is the posterior probability after evidence.
- Sensitivity measures true positive detection.
- Specificity measures true negative detection.
How to Use This Calculator
- Enter the prior probability before new evidence.
- Input sensitivity and specificity as percentages.
- Select whether your observed evidence is positive or negative.
- Add a sample size to estimate the confusion matrix.
- Choose how many decimal places you want.
- Press the calculate button.
- Review posterior probabilities, odds, and expected counts.
- Use the export buttons for CSV or PDF output.
Example Data Table
The following example uses a 5% prior probability, 92% sensitivity, 96% specificity, and a sample size of 10,000.
| Example Metric | Example Value |
|---|---|
| Prior probability | 5.00% |
| Sensitivity | 92.00% |
| Specificity | 96.00% |
| Posterior after positive evidence | 54.76% |
| Posterior after negative evidence | 0.44% |
| True positives | 460 |
| False positives | 380 |
| True negatives | 9,120 |
| False negatives | 40 |
| Negative predictive value | 99.56% |
Frequently Asked Questions
1. What does a Bayesian calculator actually do?
It updates a starting probability after new evidence appears. The output shows how much the evidence changes the original belief.
2. Why is prior probability important?
The prior sets the baseline before the test result. Rare events can remain unlikely even after a strong positive test.
3. What is the difference between sensitivity and specificity?
Sensitivity measures how well a test catches true cases. Specificity measures how well it rejects non-cases. Both are needed for Bayesian updating.
4. Why can a positive result still be misleading?
If the event is rare, false positives may outnumber true positives. Bayes’ theorem reveals that hidden effect clearly.
5. What does posterior probability mean?
Posterior probability is the revised chance after combining the prior belief with new evidence. It is the main output of Bayesian reasoning.
6. What is negative predictive value?
Negative predictive value is the probability that no event exists after a negative result. Higher values mean stronger reassurance.
7. Where is this calculator useful?
It is useful in medicine, manufacturing, fraud analysis, forecasting, machine learning, and decision science. Any evidence-based update can use it.
8. Can I export the results?
Yes. After calculating, use the CSV or PDF buttons to save a report of the current results and summary metrics.