Bayesian Updating, Medical Tests, and the Base-Rate Effect

A Bayesian analysis begins with uncertainty before observing new evidence and updates that uncertainty after the evidence becomes available.

The initial probability is called the prior probability. The updated probability is called the posterior probability.

Conceptually:\[ \boxed{ \text{Prior belief} + \text{New evidence} \longrightarrow \text{Posterior belief} } \]

Bayes’ theorem specifies how to perform this update consistently.

Prior and Posterior Probabilities

Suppose 20% of incoming email is spam:\[ P(S)=0.20. \]

Before examining a particular message, 20% is the prior probability that it is spam.

After observing a feature such as the word “money,” the updated probability is:\[ P(S\mid M). \]

This is the posterior probability.

The posterior combines:

  • the prior prevalence of spam;
  • how likely the evidence is in spam;
  • how likely the same evidence is in legitimate email.

The same logic applies to screening tests, fraud detection, manufacturing inspection, weather forecasting, and many other classification problems.

Bayes’ Theorem

For a hypothesis \(H\) and observed evidence \(E\):\[ \boxed{ P(H\mid E) = \frac{ P(E\mid H)P(H) }{ P(E) } } \]

The components are:

TermNameMeaning
\(P(H)\)PriorProbability of the hypothesis before observing evidence
\(P(E\mid H)\)LikelihoodProbability of the evidence if the hypothesis is true
\(P(E)\)EvidenceOverall probability of observing the evidence
\(P(H\mid E)\)PosteriorUpdated probability after observing the evidence

The denominator makes the result a valid probability and incorporates all possible ways the evidence could occur.

A Hypothetical Screening-Test Example

Consider a hypothetical disease and screening test with the following characteristics:

  • 1% of the target population has the disease;
  • 95% of people with the disease test positive;
  • 2% of people without the disease also test positive.

Define:\[ D=\text{the disease is present} \]\[ D^c=\text{the disease is absent} \]\[ T^+=\text{the test result is positive}. \]

The given probabilities are:\[ P(D)=0.01 \]\[ P(T^+\mid D)=0.95 \]\[ P(T^+\mid D^c)=0.02. \]

The question is:\[ P(D\mid T^+). \]

This asks:

Given a positive test result, what is the probability that the disease is actually present under this model?

These numbers are purely illustrative. Real test interpretation depends on the specific test, population, testing conditions, symptoms, and clinical context.

Identifying the Reversed Condition

The test sensitivity provides:\[ P(T^+\mid D)=0.95. \]

But the desired probability is:\[ P(D\mid T^+). \]

These are not the same:\[ P(T^+\mid D)\neq P(D\mid T^+). \]

The first asks:

Among people with the disease, how many test positive?

The second asks:

Among people who test positive, how many have the disease?

Because the denominators differ, Bayes’ theorem is required to reverse the conditioning.

Calculating the Complement

Since:\[ P(D)=0.01, \]

the complement rule gives:\[ P(D^c) = 1-P(D) = 1-0.01 = 0.99. \]

Thus, 99% of the target population does not have the disease.

Calculating the Overall Positive-Test Probability

A positive result can occur in two mutually exclusive ways:

  1. the person has the disease and tests positive;
  2. the person does not have the disease and tests positive.

Therefore, the law of total probability gives:\[ P(T^+) = P(T^+\mid D)P(D) + P(T^+\mid D^c)P(D^c). \]

Substitute the values:\[ P(T^+) = (0.95)(0.01) + (0.02)(0.99). \]

Calculate the two components:\[ (0.95)(0.01)=0.0095 \]

and:\[ (0.02)(0.99)=0.0198. \]

Therefore:\[ P(T^+) = 0.0095+0.0198 = 0.0293. \]

Under this model, 2.93% of the population would test positive.

Applying Bayes’ Theorem

Bayes’ theorem gives:\[ P(D\mid T^+) = \frac{ P(T^+\mid D)P(D) }{ P(T^+) }. \]

Substitute:\[ P(D\mid T^+) = \frac{ (0.95)(0.01) }{ 0.0293 }. \]

Therefore:\[ P(D\mid T^+) = \frac{0.0095}{0.0293} \approx0.3242. \]

As a percentage:\[ \boxed{ P(D\mid T^+)\approx32.4\% } \]

Under the stated assumptions, a randomly selected member of this target population who tests positive has approximately a 32.4% posterior probability of having the disease.

A positive result raises the probability from the 1% prior to approximately 32.4%, which is a substantial update, but it does not make the probability 95%.

Expanded Bayes Formula

The complete calculation can be written in one expression:\[ \boxed{ P(D\mid T^+) = \frac{ P(T^+\mid D)P(D) }{ P(T^+\mid D)P(D) + P(T^+\mid D^c)P(D^c) } } \]

Numerically:\[ P(D\mid T^+) = \frac{ (0.95)(0.01) }{ (0.95)(0.01) + (0.02)(0.99) }. \]

This expanded form is useful when \(P(T^+)\) is not supplied directly.

Natural-Frequency Interpretation

The result becomes easier to understand when probabilities are converted to expected counts.

Imagine testing 10,000 people from the target population.

People with the disease

Because prevalence is 1%:\[ 10{,}000(0.01)=100. \]

Of these 100 people, 95% test positive:\[ 100(0.95)=95. \]

Thus, there are approximately 95 true positives.

People without the disease

The remaining number is:\[ 10{,}000-100=9{,}900. \]

Of these, 2% test positive:\[ 9{,}900(0.02)=198. \]

Thus, there are approximately 198 false positives.

All positive results

The total number of positive results is:\[ 95+198=293. \]

Among the 293 positive results, 95 correspond to people with the disease:\[ P(D\mid T^+) = \frac{95}{293} \approx0.324. \]

Natural frequencies expose the source of the apparently surprising result:

10,000 people
├── 100 with disease
│ ├── 95 positive
│ └── 5 negative
└── 9,900 without disease
├── 198 positive
└── 9,702 negative

There are more false positives than true positives because the disease-free population is much larger.

The Confusion Matrix

The expected counts can be arranged in a table:

Actual statusPositive resultNegative resultTotal
Disease present955100
Disease absent1989,7029,900
Total2939,70710,000

This table distinguishes four possible outcomes:

True positive

The disease is present and the test is positive:\[ D\cap T^+. \]

False positive

The disease is absent but the test is positive:\[ D^c\cap T^+. \]

True negative

The disease is absent and the test is negative:\[ D^c\cap T^-. \]

False negative

The disease is present but the test is negative:\[ D\cap T^-. \]

Sensitivity

Sensitivity is the probability that the test is positive among people who have the disease:\[ \boxed{ \text{Sensitivity} = P(T^+\mid D) } \]

In the example:\[ \text{Sensitivity}=0.95. \]

This means the test detects 95% of disease cases under the stated conditions.

The false-negative rate is its complement:\[ P(T^-\mid D) = 1-0.95 = 0.05. \]

Specificity

Specificity is the probability that the test is negative among people who do not have the disease:\[ \boxed{ \text{Specificity} = P(T^-\mid D^c) } \]

The false-positive rate is:\[ P(T^+\mid D^c)=0.02. \]

Therefore:\[ \text{Specificity} = 1-0.02 = 0.98. \]

The test has 98% specificity under this model.

Positive Predictive Value

The positive predictive value is:\[ \boxed{ \operatorname{PPV} = P(D\mid T^+) } \]

In the example:\[ \operatorname{PPV}\approx0.324. \]

Sensitivity and PPV must not be confused:\[ P(T^+\mid D) \neq P(D\mid T^+). \]

Sensitivity is a property of test performance conditional on disease status. PPV additionally depends strongly on disease prevalence in the tested population.

Negative Predictive Value

The negative predictive value is:\[ \boxed{ \operatorname{NPV} = P(D^c\mid T^-) } \]

From the frequency table:\[ \operatorname{NPV} = \frac{9702}{9707} \approx0.9995. \]

Thus:\[ \operatorname{NPV}\approx99.95\%. \]

The extremely high NPV is influenced by the low disease prevalence. Most people begin without the disease, so most negative results are true negatives.

Why 95% Sensitivity Does Not Mean 95% Disease Probability

The statement:\[ P(T^+\mid D)=0.95 \]

describes how the test behaves among people already known to have the disease.

It does not answer how common the disease is among people receiving positive results.

To calculate:\[ P(D\mid T^+), \]

we must also know:

  • disease prevalence;
  • the false-positive rate.

The posterior probability is low relative to 95% because:\[ P(D)=0.01 \]

while:\[ P(D^c)=0.99. \]

Even a small false-positive rate applied to a very large disease-free population can generate many false positives.

The Base-Rate Effect

The prior disease probability is the base rate:\[ P(D). \]

Posterior probability depends strongly on this value.

Keeping sensitivity at 95% and the false-positive rate at 2% gives:

PrevalenceProbability of disease after positive result
0.1%4.5%
1%32.4%
5%71.4%
10%84.1%
25%94.1%
50%98.0%

The same test result has different meanings in different populations.

A positive result for someone tested because of strong symptoms may have a different posterior interpretation from a positive result found through broad screening of a low-risk population.

Likelihood Ratios

Likelihood ratios summarize how much a result shifts the odds.

Positive likelihood ratio

\[ \operatorname{LR}^+ = \frac{ P(T^+\mid D) }{ P(T^+\mid D^c) }. \]

For the example:\[ \operatorname{LR}^+ = \frac{0.95}{0.02} = 47.5. \]

A positive result is 47.5 times as likely among people with the disease as among those without it.

Negative likelihood ratio

\[ \operatorname{LR}^- = \frac{ P(T^-\mid D) }{ P(T^-\mid D^c) }. \]

Therefore:\[ \operatorname{LR}^- = \frac{0.05}{0.98} \approx0.051. \]

Values of \(\operatorname{LR}^-\) closer to zero provide stronger evidence against disease.

Updating Odds

Convert probability to odds:\[ \text{odds} = \frac{p}{1-p}. \]

The prior disease odds are:\[ \frac{0.01}{0.99} = \frac{1}{99}. \]

Bayesian updating in odds form is:\[ \boxed{ \text{Posterior odds} = \text{Prior odds} \times \text{Likelihood ratio} } \]

After a positive result:\[ \text{Posterior odds} = \frac{1}{99}\times47.5 \approx0.4798. \]

Convert back to probability:\[ p = \frac{0.4798}{1+0.4798} \approx0.3242. \]

This gives the same posterior probability of 32.4%.

What Happens After a Negative Result?

The probability of a negative result is:\[ P(T^-) = P(T^-\mid D)P(D) + P(T^-\mid D^c)P(D^c). \]

Substitute:\[ P(T^-) = (0.05)(0.01) + (0.98)(0.99). \]

Therefore:\[ P(T^-) = 0.0005+0.9702 = 0.9707. \]

The posterior disease probability after a negative result is:\[ P(D\mid T^-) = \frac{ P(T^-\mid D)P(D) }{ P(T^-) }. \]

Thus:\[ P(D\mid T^-) = \frac{ (0.05)(0.01) }{ 0.9707 } \approx0.000515. \]

As a percentage:\[ P(D\mid T^-)\approx0.052\%. \]

The negative result reduces the modeled disease probability from 1% to approximately 0.052%.

Repeated Testing

A second test can provide additional evidence, but repeated-test results cannot automatically be treated as conditionally independent.

If the errors of two tests are conditionally independent given disease status, sequential Bayes updating is possible:\[ \text{New posterior odds} = \text{Current odds} \times \text{second-test likelihood ratio}. \]

However, repeated tests may share:

  • the same specimen;
  • the same biological limitation;
  • the same equipment;
  • the same operator;
  • the same cross-reactivity;
  • the same measurement bias.

If their errors are correlated, multiplying likelihood ratios as though they were independent can greatly overstate the evidence.

A confirmatory test using a different method may provide more independent information than simply repeating the same test.

Bayesian Updating Is Not Guaranteed to Improve Accuracy

Bayes’ theorem updates probabilities coherently, but the posterior is only as reliable as its inputs.

Problems can arise from:

  • incorrect prevalence estimates;
  • sensitivity measured in a different population;
  • specificity changing across settings;
  • poor test administration;
  • spectrum effects;
  • verification bias;
  • data drift;
  • dependence between repeated tests.

The update incorporates evidence. It does not guarantee movement toward the truth if the probability model is inaccurate.

Screening Is Not Diagnosis

A screening test identifies people who may require additional evaluation. A positive screening result does not necessarily establish a diagnosis.

The full interpretation may depend on:

  • symptoms;
  • age;
  • exposure history;
  • family history;
  • physical findings;
  • repeat or confirmatory testing;
  • the target population;
  • consequences of missed and incorrect findings.

The numerical example demonstrates probability reasoning and should not be used to interpret any real medical result without test-specific clinical information.

Connection to Spam Filtering

The medical-test example has the same mathematical structure as spam classification.

Screening contextEmail context
Disease presentSpam
Disease absentLegitimate email
Positive testSuspicious word or feature
SensitivityFeature frequency in spam
False-positive rateFeature frequency in legitimate email
Disease prevalenceSpam base rate
PPVSpam probability after observing the feature

In both cases, a classifier combines:\[ \text{Prior prevalence} \]

with:\[ \text{Evidence likelihood} \]

to obtain:\[ \text{Posterior class probability}. \]

Common Mistakes

Confusing sensitivity with PPV

\[ P(T^+\mid D) \neq P(D\mid T^+). \]

Ignoring prevalence

Predictive values depend on the target population’s base rate.

Assuming a positive result proves disease

A positive result changes probability but does not necessarily make it close to 100%.

Assuming test properties are universal constants

Sensitivity and specificity can vary with population, threshold, specimen quality, and study design.

Treating repeated tests as independent

Shared sources of error can make repeated results highly dependent.

Describing every positive result as a false alarm or confirmed case

A positive result must be interpreted conditionally and may require additional evidence.

Assuming Bayes’ theorem repairs bad inputs

Mathematically correct updating cannot compensate for inaccurate prevalence or test-performance estimates.

A Reliable Calculation Process

  1. Define the disease and test-result events.
  2. identify the prior prevalence.
  3. identify sensitivity.
  4. identify the false-positive rate or specificity.
  5. calculate the complement probabilities.
  6. find the total probability of the observed result.
  7. apply Bayes’ theorem.
  8. verify the result with natural frequencies.
  9. examine how the answer changes with prevalence.
  10. interpret the posterior within the actual testing context.

Key Takeaway

Bayesian analysis updates a prior probability using observed evidence. In the hypothetical screening example, disease prevalence is 1%, sensitivity is 95%, and the false-positive rate is 2%. Bayes’ theorem gives:\[ P(D\mid T^+) = \frac{ (0.95)(0.01) }{ (0.95)(0.01)+(0.02)(0.99) } \approx32.4\%. \]

The result is much lower than 95% because the disease-free population is far larger, producing more false positives than true positives. Sensitivity describes positive results among people with disease; positive predictive value describes disease among people with positive results. The distinction and the underlying prevalence are essential.

Similar Posts

Leave a Reply