Using a prior when reversing a conditional probability
The chance of a signal given a category is a different quantity from the chance of the category given a signal. This guide walks through the reversal with a toy model of red tokens and shows how the prior share changes the answer.
Two conditional probabilities that sound alike
A statement such as the signal appears 80 percent of the time for red tokens answers one question. The reader usually wants to answer another one: if the signal appears, how likely is it that the token is red? Those quantities are written P(signal | red) and P(red | signal), and they are not interchangeable. The first is a likelihood and the second is a posterior probability. Mixing them up is one of the most common errors in reading screening results, filter performance and any classifier that fires on a subset of cases. This guide uses a deliberately simple toy model so the mechanics are visible. It makes no claim about real devices, patients, applicants or any consequential decision. The numbers are chosen so the arithmetic is clean, and they come directly from the two worked cases for the Bayes Theorem Calculator.
The inputs and what they mean
The model has three numbers. The prior is the share of red tokens in the population before looking at the signal, here 0.1. The likelihood is the probability that a red token produces the signal, here 0.8. The alternative is the probability that a token that is not red produces the signal, here 0.2. The calculator then computes the evidence, which is the overall probability of seeing the signal: likelihood times prior plus alternative times one minus prior. Finally the posterior equals likelihood times prior divided by evidence. Every input is a probability between 0 and 1, and the prior must describe the same population as the two conditional rates. If the rates were measured on a balanced test set with equal numbers of each kind, they do not tell you the prior of the population where the signal will be used.
The default case with a prior of 0.1
With a prior of 0.1, the red tokens contribute 0.8 times 0.1, which is 0.08, to the signal. The other tokens are 0.9 of the population, and they contribute 0.2 times 0.9, which is 0.18. The evidence is 0.08 plus 0.18, or 0.26. The posterior is 0.08 divided by 0.26, which is four thirteenths, about 0.3077. So even though a red token signals 80 percent of the time, a token that has just signaled is red only about 31 percent of the time. Most signals come from the much larger group of non-red tokens, which signal at a lower rate but are far more numerous. The entered likelihood of 0.8 answers how often red tokens signal, and the 0.3077 answers what a signal says about the token.
Seeing it with counts instead of probabilities
Natural frequencies make the same calculation easier to feel. Imagine 1,000 tokens. With a prior of 0.1, 100 are red and 900 are not. Of the 100 red tokens, 80 produce the signal. Of the 900 other tokens, 20 percent, or 180, also produce it. In total 260 tokens signal, and 80 of those are red. The posterior is therefore 80 out of 260, which reduces to four thirteenths and matches the formula. Counting groups of tokens is often more convincing than the algebra, because the lopsided group sizes are visible. The same trick works for any inputs: scale the population to a convenient number, split it by the prior, apply each conditional rate, and compare the red signals with all signals.
Changing only the prior
The second worked case keeps both conditional rates and changes the prior to 0.5. Now half the tokens are red. The red contribution is 0.8 times 0.5, or 0.4, and the non-red contribution is 0.2 times 0.5, or 0.1. The evidence is 0.5 and the posterior is 0.4 divided by 0.5, which is 0.8. With a balanced population the posterior equals the likelihood in this particular case because the likelihood and the alternative happen to add to 1. The point of the comparison is that the signal itself did not change. Only the population mix changed, and the posterior moved from about 0.31 to 0.80. The same signal carries very different weight depending on how common the category is, which is why the prior has to be part of the calculation.
A rare category and a common one
Two further settings show how far the prior can pull the answer. If the prior is only 0.01, the evidence is 0.8 times 0.01 plus 0.2 times 0.99, which is 0.008 plus 0.198, or 0.206. The posterior is 0.008 divided by 0.206, about 0.0388. A signal that fires 80 percent of the time for red tokens leaves the token red less than 4 percent of the time when red tokens are that rare. At the other end, a prior of 0.9 gives an evidence of 0.72 plus 0.02, or 0.74, and a posterior of 0.72 divided by 0.74, about 0.973. These values are illustrative. They show that identical conditional rates can lead to a posterior that is anywhere from near 0 to near 1, depending only on the prior.
The odds form of the same update
Bayes theorem can also be written with odds, which makes the update a single multiplication. Prior odds for red are 0.1 to 0.9, which is 1 to 9. The likelihood ratio is the likelihood divided by the alternative, 0.8 divided by 0.2, or 4. Posterior odds are the prior odds times the likelihood ratio, so 1 to 9 becomes 4 to 9. Converting odds back to a probability gives 4 divided by 13, the same four thirteenths. This view separates two ingredients: how strong the evidence is, which is the likelihood ratio, and how plausible the category was to begin with, which is the prior odds. A likelihood ratio of 4 is the same strength whether the prior is 1 in 10 or 1 in 1,000, but the resulting posterior differs greatly. Seeing both pieces helps explain why a decent signal does not guarantee a high posterior.
Where the inputs come from
The calculator accepts any three numbers, and none of them are estimated by the tool. Each must come from somewhere. The prior might come from a historical count, a survey, a sampled audit or an explicit assumption. The likelihood and the alternative usually come from a test or evaluation in which the true category was known. Each source has its own uncertainty, and a prior estimated from 20 observations is much less reliable than one from 20,000. Publish the inputs alongside any posterior you report so a reader can substitute their own prior. If the alternative rate is unknown, use a range of plausible values and report the range of posteriors rather than a single figure that hides the uncertainty. The model also assumes only two categories, red and not red, and one signal.
Limits of the worksheet and the undefined case
The posterior is defined only when the evidence is greater than zero. If the prior, likelihood and alternative are arranged so that the signal can never occur, then the division is by zero and no posterior exists. That happens when the likelihood and the alternative are both 0, when the prior is 0 and the alternative is 0, or when the prior is 1 and the likelihood is 0. The calculator stops with an error about a zero denominator in those cases, and it also requires every input to lie between 0 and 1. The worksheet also treats one signal as independent evidence of a single event. It does not combine several signals, and it does not account for correlated errors. Most importantly, it does not apply the result to a medical, legal, eligibility or other consequential decision. For such decisions, the inputs need to be validated for the actual population, and a qualified professional should interpret the result.
How the alternative rate changes the posterior
The alternative probability is the false signal rate, the chance that a token that is not red still produces the signal. In the default case it is 0.2, and it is responsible for most of the signals. Lower it and the posterior rises quickly. Keep the prior at 0.1 and the likelihood at 0.8, but set the alternative to 0.05. The red contribution is still 0.08, the non-red contribution becomes 0.05 times 0.9, which is 0.045, and the evidence is 0.125. The posterior is 0.08 divided by 0.125, or 0.64. Cutting the false signal rate to a quarter of its earlier value lifted the posterior from about 0.31 to 0.64. These numbers are illustrative. With a category this uncommon, most signals are false alarms, so the false signal rate dominates the evidence and is the first place to look when a posterior seems too low.
Using one posterior as the next prior
A posterior can become the prior for a second, independent signal. After the first signal in the default case, the red probability is four thirteenths, about 0.3077. Suppose a second signal arrives and it has the same likelihood of 0.8 and alternative of 0.2, and that it is independent of the first given the category. In odds form, the starting odds of 4 to 9 are multiplied by the likelihood ratio of 4 again, giving 16 to 9, which is a posterior of 16 divided by 25, or 0.64. The independence assumption is the weak point. If the two signals are driven by the same cause, for example the same sensor reading counted twice, the second one adds less than the arithmetic claims, and the result overstates the confidence. The worksheet handles one update at a time.
Typical ways the reversal goes wrong
Several recurring errors are worth watching for. Base-rate neglect means ignoring the prior and reading the likelihood as the answer, which would call the default posterior 0.8 when it is about 0.31. Another is taking a prior from one population and rates from another, such as a prior measured on all tokens and rates measured on a pre-selected group. A third is rounding too early: the four thirteenths posterior looks like 0.31 after rounding, and calculating from that rounded figure can introduce small drift. A fourth is treating the posterior as a certainty. A value of 0.80 describes a probability under the supplied model, and it says nothing about whether the model itself fits the situation. Writing out each input and its source, as the earlier section suggests, makes these errors easier to spot.
Reproduce the checks
Prior red proportion one tenth
Open the Bayes Theorem Calculator and enter:
- Prior probability of A
0.1- Probability of evidence given A
0.8- Probability of evidence given not A
0.2
Expected output:
Probability of evidence
0.26Posterior probability of A
0.3076923076923077The reverse conditional is not the entered likelihood of 0.8.
Prior red proportion one half
Open the Bayes Theorem Calculator and enter:
- Prior probability of A
0.5- Probability of evidence given A
0.8- Probability of evidence given not A
0.2
Expected output:
Probability of evidence
0.5Posterior probability of A
0.8Only the prior changes between the controls.
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
- Primary reference for Bayes Theorem Calculator ↗ · 2026-10-08