intro practice · coding problem

Apply Bayes' rule

A test has 99% sensitivity and 95% specificity. Disease prevalence is 1%. A patient tests positive. Using Bayes' rule, compute P(disease | positive) to 2 decimal places.

The mechanism

Probability is a bookkeeping system for uncertainty. Conditional probability restricts the sample space; Bayes flips cause and effect — from 'how likely is the evidence given the hypothesis' to 'how likely is the hypothesis given the evidence'.

Study Probability Fundamentals

Expected evidence

≈ 0.17 (17%). Most positives are false alarms when the base rate is low.

Try this drill in the practice workspace →

Hints when you need them
  • P(D|+) = P(+|D)·P(D) / P(+).
  • P(+) = P(+|D)·P(D) + P(+|¬D)·P(¬D).

Watch for these mistakes

  • Treating independent events as mutually exclusive
  • Confusing P(A|B) with P(B|A) (the prosecutor's fallacy)
  • Adding probabilities of overlapping events without inclusion-exclusion

Check the sources

Practice the same mechanism

Browse all practice briefs