Calculator
Example Data Table
| Case | P(H0) | P(H1) | P(x | H0) | P(x | H1) | False Alarm | Miss | Expected Action |
|---|---|---|---|---|---|---|---|
| Balanced prior | 0.50 | 0.50 | 0.35 | 0.65 | 0.05 | 0.10 | Often H1 |
| Rare H1 | 0.90 | 0.10 | 0.20 | 0.70 | 0.02 | 0.20 | Depends on cost |
| High miss cost | 0.70 | 0.30 | 0.45 | 0.75 | 0.08 | 0.05 | Often H1 |
Formula Used
Evidence probability: P(x) = P(H0)P(x | H0) + P(H1)P(x | H1)
Posterior for H0: P(H0 | x) = P(H0)P(x | H0) / P(x)
Posterior for H1: P(H1 | x) = P(H1)P(x | H1) / P(x)
Likelihood ratio: LR = P(x | H1) / P(x | H0)
Risk of choosing H0: R0 = C00P(H0 | x) + C01P(H1 | x)
Risk of choosing H1: R1 = C10P(H0 | x) + C11P(H1 | x)
Bayes rule: choose the action with the smaller posterior risk.
Expected error: P(error) = P(H0)P(false alarm) + P(H1)P(miss)
Power: 1 - P(miss)
Specificity: 1 - P(false alarm)
How to Use This Calculator
- Enter prior probabilities for H0 and H1.
- Enter the likelihood of the observed evidence under each hypothesis.
- Add decision costs for correct and incorrect decisions.
- Enter false alarm and miss rates for operating performance.
- Set a target alpha level for comparison.
- Press Calculate to view posterior probabilities and decision risk.
- Use CSV or PDF buttons to download the result.
Binary Decisions in Statistics
Binary Decisions in Statistics
Binary hypothesis testing compares two rival claims. One claim is usually called H0. The other is called H1. A test uses data to choose between them. The choice should be consistent, transparent, and tied to measurable error.
How Evidence Enters the Test
Evidence is summarized through likelihoods. A likelihood tells how compatible the observation is with each claim. The likelihood ratio divides the H1 likelihood by the H0 likelihood. A large ratio favors H1. A small ratio favors H0. Priors add background knowledge before the observation arrives. Costs add the impact of a wrong or correct decision.
Bayes Rule and Practical Risk
Bayes rule combines priors and likelihoods. It produces posterior probabilities after the data are observed. The calculator compares posterior risk for both available actions. It selects the action with the smaller conditional risk. This is useful when false alarms and missed detections do not have equal consequences. In medical screening, a missed case may be very costly. In spam filtering, a false alarm may block an important message.
Error Rates and Operating View
A complete test should also show operating behavior. False alarm rate measures how often H1 is selected when H0 is true. Miss rate measures how often H0 is selected when H1 is true. Power equals one minus the miss rate. Accuracy, expected error, and Bayes risk summarize performance after priors are applied. These values help compare different thresholds.
Using Results Carefully
This calculator is educational and analytical. It does not replace a full study design. Good inputs should come from validated models, experiments, or domain data. Likelihoods must be positive. Priors should add to one. Costs should reflect the decision context. Review the threshold before changing a rule. A lower threshold detects more H1 cases, but it can raise false alarms. A higher threshold protects H0 decisions, but it can increase missed detections. Document every assumption before sharing results.
When inputs are uncertain, run several scenarios. Compare optimistic, central, and conservative assumptions. Look for decisions that remain stable. Stable decisions are easier to defend. Unstable decisions need more data, better modeling, or lower stakes. The exported files create a useful record for peer review and repeatable classroom exercises and team discussions.
FAQs
What is binary hypothesis testing?
It is a statistical decision process with two competing claims. The calculator compares H0 and H1 using priors, likelihoods, costs, and error rates.
What does H0 mean?
H0 usually means the null hypothesis. It often represents no effect, normal behavior, no signal, or the default condition being tested.
What does H1 mean?
H1 is the alternative hypothesis. It often represents an effect, signal, change, fault, fraud, disease, or another condition of interest.
What is a likelihood ratio?
The likelihood ratio compares how well the same evidence fits H1 against H0. Higher values usually support H1 more strongly.
What is Bayes risk?
Bayes risk is the expected decision loss after combining posterior probabilities with decision costs. The smaller risk gives the preferred action.
What is a false alarm?
A false alarm happens when the test chooses H1 while H0 is true. It is also called a Type I error in many testing settings.
What is a miss rate?
A miss happens when the test chooses H0 while H1 is true. It is closely related to Type II error and statistical power.
Can I use this for real decisions?
Use it for planning, education, and transparent comparison. For high-stakes decisions, validate inputs with domain experts and reliable data.