Conditional probability and Bayes: update a model with counted evidence

Conditional probability answers a question within a restricted set of possibilities. Bayes theorem lets us reverse the direction of a conditional statement when the required background information is available. Confusing those two directions is a common source of misleading claims. This tutorial uses an invented parcel-inspection model, not medical advice or a real screening system, to make every denominator visible.

Conditioning changes the reference group

Suppose a record concerns a randomly selected parcel from a defined batch. Let D mean that the parcel has a defect and F mean that an inspection flags it. P(F given D) asks about flags among defective parcels. P(D given F) asks about defects among flagged parcels. The words contain the same events, but the groups being counted differ. The Wisconsin lecture on conditional probability states the elementary rule P(A given B)=P(A and B)/P(B), requiring P(B) to be positive. Always name the denominator before interpreting the number.

Construct a hypothetical frequency model

Imagine 10,000 parcels, of which 100 are defective. An invented inspection flags 90 of those defective parcels and also flags 198 of the 9,900 non-defective parcels. These are classroom assumptions chosen for arithmetic, not measured performance. There are 288 flagged parcels altogether, so 90/288, or 31.25%, are defective within this model. The Penn State Bayes lesson explains the relationship behind this reversal. A high flagging rate among defective parcels does not automatically imply that almost every flagged parcel is defective.

Read the full two-way table

Hypothetical batch of 10,000 parcels; no observed inspection data
Actual statusFlaggedNot flaggedTotal
Defective9010100
Not defective1989,7029,900
All parcels2889,71210,000
Relevant conditional rate90/288 = 31.25%10/9,712 ≈ 0.103%Defect prevalence = 1%

The row totals describe actual status, while the column totals describe inspection output. Switching between them changes the question. Check that both sets of totals reconcile to 10,000 before calculating percentages. The final row contains derived rates with different denominators, so those percentages must not be added together.

Connect the counts to Bayes theorem

Write P(D)=0.01, P(F given D)=0.90 and P(F given not D)=0.02. The overall flag probability is 0.90×0.01 plus 0.02×0.99, giving 0.0288. Bayes theorem gives 0.90×0.01/0.0288=0.3125. Every term has an interpretation in the table. The calculation does not create new evidence: it combines assumptions already supplied. If the defect prevalence was guessed or estimated from an unrepresentative batch, the resulting conditional probability inherits that weakness even though the arithmetic is exact.

Understand the role of background prevalence

Keep the two inspection rates fixed but change the hypothetical defective share to 10%. The defective-and-flagged share becomes 0.09, while the non-defective-and-flagged share becomes 0.018. The revised fraction is 0.09/0.108, approximately 83.33%. This comparison shows why background proportions matter; it does not describe an improvement in the inspection itself. The Stanford probability reference presents Bayes rule and the probability identities used here. A reported “accuracy” figure without its population and definition cannot replace all the quantities required for an update.

Avoid double-counting repeated evidence

If a second inspection uses the same photograph, instrument or decision rule, its output may depend strongly on the first. Multiplying two error probabilities as though the inspections were conditionally independent can exaggerate the evidence. Specify what independence would mean given the parcel’s true status and why that assumption is plausible. Repeated copies of one observation are not independent confirmations. When the relationship between inspections is unknown, report that uncertainty instead of inserting an arbitrary multiplication step. The appropriate model should reflect how evidence was actually produced.

Audit the two directions of conditioning

The hypothetical parcel table permits two different questions: among defective parcels, what fraction are flagged, and among flagged parcels, what fraction are defective? The first uses one hundred as its denominator; the second uses two hundred eighty-eight. Write the conditioning group in words before reducing either fraction. This simple habit exposes a reversed conditional probability without requiring another formula. If the underlying prevalence changes, rebuild the joint counts or probability table. Retaining an old posterior after changing its base rate silently mixes two different hypothetical populations.

Bayes calculation checklist

  • Define the events and target population.
  • Name the conditional direction being asked.
  • Identify prior proportions and observation rates.
  • Build a frequency table when practical.
  • Check totals and nonzero denominators.
  • State assumptions about repeated evidence.
  • Distinguish invented inputs from measured data.

A useful written answer includes the numerator, denominator and plain-language interpretation. “About 31 of every 100 flagged parcels in this hypothetical model are defective” is more informative than an unexplained 31.25%. Retain additional digits during calculation and round only the presentation. If new information changes the background prevalence, update the model transparently rather than treating the old conditional probability as a permanent property of the inspection.

Frequently asked questions

Are P(A given B) and P(B given A) interchangeable?

No. They use different reference groups and generally have different values.

Does Bayes theorem repair unreliable inputs?

No. Correct algebra can combine inaccurate assumptions; the result still depends on the quality and relevance of those inputs.

Can repeated copies of the same evidence be multiplied as independent?

No. Conditional independence needs justification from the evidence-generating process, not merely a different file name or presentation.

Sources and verification