PROBABILITY AND SOLID GEOMETRY CHECKS

Checking a Bayes model with equal signal likelihoods

Give a signal the same likelihood under both categories and Bayes' rule returns the prior unchanged, which makes a quick control for your inputs.

A signal that cannot discriminate

The Bayes Theorem Calculator updates a prior probability after a signal is observed. It needs the prior P(A), the likelihood of the signal if A is true, and the likelihood of the signal if A is false, which the page calls the alternative. If both likelihoods are the same number, the signal is equally expected whether or not A holds, so seeing it should teach you nothing about A. The posterior then equals the prior. This page uses that fact as a control. A calculation that returns anything other than the prior for equal likelihoods contains a typing error or a wrong formula, which makes the control worth running whenever you set up a Bayes worksheet.

The algebra behind the control

The calculator computes evidence = likelihood times prior plus alternative times (1 minus prior), and posterior = likelihood times prior over evidence. When likelihood and alternative both equal L, the evidence is L times prior plus L times (1 minus prior), which is L times 1, so the evidence equals L. The posterior is L times prior over L, which is the prior. The cancellation needs L to be positive, because otherwise it divides zero by zero. The result is independent of the prior, so you can test any prior between 0 and 1 and expect it back unchanged.

Prior 0.3 with likelihood 0.4

Enter prior 0.3, likelihood 0.4 and alternative 0.4. The evidence is 0.4 times 0.3 plus 0.4 times 0.7, which is 0.12 plus 0.28, or 0.4. The posterior is 0.12 over 0.4, which is 0.3. The evidence equals the shared likelihood, as the algebra predicts, and the posterior equals the prior. Here the evidence is the overall probability of seeing the signal, so a signal that occurs 40 percent of the time under either category occurs 40 percent of the time overall. Nothing in the data favors one category over the other, and the calculator reports exactly that.

Raising the likelihoods to 0.8

Change both likelihoods to 0.8 and keep the prior at 0.3. The evidence becomes 0.8 times 0.3 plus 0.8 times 0.7, which is 0.24 plus 0.56, or 0.8. The posterior is 0.24 over 0.8, which is 0.3 again. The evidence doubled, since the signal is now twice as common, but the category odds did not move. This case separates two ideas that are easy to mix up: how common a signal is and how informative it is. A very common signal can be useless for telling categories apart, and a rare signal can be highly informative if its rates differ between the categories.

Contrast with an informative signal

Now let the likelihoods differ: keep prior 0.3, likelihood 0.8 and set the alternative to 0.4. The evidence is 0.24 plus 0.28, or 0.52, and the posterior is 0.24 over 0.52, about 0.4615. The signal is twice as likely under A as under not-A, so the odds of A double, from 3 to 7 to 6 to 7, which is a probability of 6 over 13. With likelihood 0.9 and alternative 0.3, the evidence is 0.27 plus 0.21, or 0.48, and the posterior is 0.5625. The distance between the two likelihoods, in ratio terms, is what moves the posterior.

The likelihood ratio view

In odds form, Bayes' rule says posterior odds equal prior odds times the likelihood ratio, where the ratio is the likelihood divided by the alternative. Equal likelihoods give a ratio of 1, and multiplying by 1 changes nothing. This view explains the control quickly and extends it. A ratio of 2 doubles the odds, a ratio of 0.5 halves them, and a ratio of 1 leaves them alone, regardless of how large or small the individual likelihoods are. With a very small prior of 0.01 and equal likelihoods of 0.9, the posterior stays at 0.01 and the evidence is 0.9.

Why the zero case is excluded

If both likelihoods are zero, the signal is impossible under both categories. The evidence is zero, and the posterior would be zero divided by zero, which is undefined. In practice that means you are conditioning on an event that cannot occur in the model, and no update exists. The calculator cannot give a meaningful posterior there. A tiny positive likelihood is fine, and equal tiny likelihoods still return the prior. The edge case is a reminder to check that the observed signal has positive probability under at least one category before you update on it.

Using the control in real worksheets

Suppose you build a spreadsheet that updates a probability after a test result. Before feeding it real numbers, set the sensitivity and the false-positive rate to the same value and confirm the output equals the prior. If it does not, a cell reference or a complement such as 1 minus prior is wrong. It takes seconds and catches mistakes that a plausible-looking real result would hide. A second quick test is to set the likelihood to 1 and the alternative to 0, a perfectly decisive signal, and confirm the posterior is 1 for any positive prior. A third is to swap the two likelihoods and confirm the posterior falls to 0. If all three tests pass, the main formula and the complement are probably wired correctly, and you can move on to real values. The check is not a validation of the likelihood values themselves, which have to come from data or a documented source.

What this control does not show

The control checks the algebra of a two-category model. It says nothing about whether real signals are independent of the categories, whether the prior is reasonable, or whether likelihood values were estimated well. Real tests have sensitivity and specificity that can vary by population, and the calculator uses the numbers you give it. It is not a medical, legal or financial assessment, and its examples, such as 0.3 and 0.4, are illustrative values. A prior of 0.3 could stand for a base rate in a made-up population, and a likelihood of 0.4 for how often a signal appears. Changing those labels does not change the arithmetic. What matters for interpretation is that the likelihoods describe the same signal under each category, measured in comparable conditions. If the signal is recorded differently in the two groups, for example with a different instrument or threshold, then the two likelihoods are not truly describing one event, and equal numbers would not guarantee an uninformative signal in practice.

Reproduce the checks

Equal likelihoods at four tenths

Open the Bayes Theorem Calculator and enter:

Prior probability of A
0.3
Probability of evidence given A
0.4
Probability of evidence given not A
0.4

Expected output:

Probability of evidence

0.4

Posterior probability of A

0.3

The posterior preserves the supplied prior.

Equal likelihoods at eight tenths

Open the Bayes Theorem Calculator and enter:

Prior probability of A
0.3
Probability of evidence given A
0.8
Probability of evidence given not A
0.8

Expected output:

Probability of evidence

0.8

Posterior probability of A

0.3

The evidence frequency changes without changing category odds.

References and implementation scope

The examples describe the behavior of the linked Computandum tools. A successful local check does not establish that another application accepts the same format or applies the same limits.

Sources

Related tasks