FREE LESSON · Probability & statistics · 1 OF 6
Conditional probability and Bayes reasoning
Conditional probability and Bayes reasoning: Update beliefs using base rates, likelihoods, and an explicit sample space.
Prerequisites: Fractions, sets, counting, and elementary algebra.
Learning objectives
- Compute conditional probabilities with the correct denominator.
- Apply total probability and Bayes rule.
- Distinguish independence from mutually exclusive events.
Conditioning changes the reference population
A probability model specifies possible outcomes and assigns probabilities consistently. For events A and B with P(B)>0, conditional probability is P(A given B)=P(A AND B)/P(B). The denominator restricts attention to outcomes where B occurs. Reversing the condition generally changes the question: the fraction of failed jobs that trigger an alert need not equal the fraction of alerts that indicate a failed job.
Suppose 2% of jobs fail. A monitor alerts on 90% of failed jobs and on 5% of successful jobs. In a hypothetical population of 10,000 jobs matching those rates, 200 fail and 9,800 succeed. We expect 180 alerts from failures and 490 alerts from successes. Among 670 alerts, only 180 correspond to failures, so the probability of failure given an alert is 180/670, about 26.9%.
The monitor's 90% detection rate did not become a 90% probability that an alerted job failed. False alerts accumulate from the much larger successful population. This is why base rates matter. The counts are a convenient representation of the assumed probabilities, not a promise that an actual sample of 10,000 produces exactly these totals.
Derive the update
Let F mean failure and A mean alert. Total probability gives P(A)=P(A given F)P(F)+P(A given NOT F)P(NOT F). Bayes rule follows by writing the same intersection two ways: P(F given A)=P(A given F)P(F)/P(A). Here the numerator is 0.90.02=0.018 and the denominator is 0.018+0.050.98=0.067.
These calculations depend on the supplied rates applying to the target population. If deployment changes the job mix, both the base failure rate and conditional alert rates may change. A numerically correct update can still describe the wrong environment.
Independence is a separate assumption
Events A and B are independent when P(A AND B)=P(A)P(B). For nonzero P(B), this means observing B does not change A's probability. Mutually exclusive events cannot occur together; if both have positive probability, they are not independent. Also, two alert systems may share a sensor or failure mode. Multiplying their detection rates as though they were independent can greatly overstate the evidence from agreement. State the independence assumption, justify it from the process when possible, and examine how conclusions change when it is weakened.
Practice problem
A different monitor sees a failure base rate of 10%, detects 80% of failures, and alerts on 20% of successes. Use a 1,000-job table to compute the probability of failure after an alert and after no alert. Explain why the two posterior probabilities must differ. Then suppose two monitors use the same underlying log line and always produce identical alerts. Explain why receiving both alerts does not justify multiplying the evidence as if two independent measurements had occurred.
Worked solution
Of 1,000 representative jobs, 100 fail and 900 succeed. Expected alerts include 80 failures and 180 successes, so failure given alert is 80/260=4/13, about 30.8%. No-alert jobs include 20 failures and 720 successes, giving 20/740=1/37, about 2.7%. Alerting is more likely under failure than success, so an alert increases the failure probability while no alert decreases it under this model. Identical monitors contribute the same event twice: the joint alert event equals the single alert event. Treating their outputs as independent would invent extra information. These are expected-count calculations under fixed rates; sampling variation and population shifts would require additional uncertainty analysis.
Check your understanding
A monitor has a high detection rate. Why can most alerts still be false?
- A rare failure base rate can let false alerts from many successful jobs dominate.
- Conditional probabilities are always symmetric.
- Detection rate determines the posterior by itself.
Explanation
The posterior depends on the base rate and false-alert rate as well as detection.
Two positive-probability events are mutually exclusive. Are they independent?
- Yes, because they never interact.
- No, their intersection has probability zero while the product of their probabilities is positive.
- Only if their names are different.
Explanation
Independence requires the intersection probability to equal the product, which fails here.
Primary reading
- Statistics 110: Probability: Harvard University
- Introduction to Probability and Statistics: MIT OpenCourseWare