Practice: Conditional Probability, Total Probability and Bayes' Rule

Direct application

Among 100 students:

PassedFailed
Studied4515
Did not study1030

What is P ( passed ∣ studied ) ?

Enter the value. It is checked against the answer and the precision this task asks for.

2 hints available, least help first.

Hint 1: Retrieval cue

Conditioning on 'studied' means only the students in that row are still in play.

Hint 2: Concept cue

How many students are in the 'studied' row altogether, and how many of those passed?

Interpretation

A condition affects 2% of a population. A test detects it in 90% of those who have it, and gives a false positive for 10% of those who do not.

Someone tests positive. Roughly how likely are they to have the condition?

2 hints available, least help first.

Hint 1: Retrieval cue

Take 1000 people and count how many land in each of the four categories.

Hint 2: Concept cue

Of everyone who tests positive, what fraction actually has the condition? Compare the true positives with the false ones.

Classification · Error diagnosis

A screening programme reports: "Of the people who have the condition, 80% are correctly flagged by our test."

A newspaper summarises this as: "If you are flagged, there is an 80% chance you have the condition."

Which statement correctly identifies the difference between the two claims?

2 hints available, least help first.

Hint 1: Retrieval cue

For each claim, ask: which group of people is the percentage taken out of?

Hint 2: Concept cue

Write each claim as P ( ⋅ ∣ ⋅ ) and compare what sits after the bar.

Construction · Direct application · Explanation

(a) From this table of 100 students, studied/passed 45, studied/failed 15, did not study/passed 10, did not study/failed 30, compute P ( passed ∣ studied ) and P ( studied ∣ passed ) . Say which denominator each uses and why the two differ.

(b) Decide whether studying and passing are independent, and verify your answer by the law of total probability.

(c) A disease affects 1% of a population; a test has 99% sensitivity and 95% specificity. Compute P ( disease ∣ + ) by natural frequencies and again by Bayes' rule, and explain why the answer is so far from 99%.

(d) Recompute the posterior in (c) for a population where the disease affects 50%, and say what that implies about reporting a posterior.

Write your answer, then compare it with the worked solution.

3 hints available, least help first.

Hint 1: Retrieval cue

In (a), ask what set each question restricts attention to before dividing anything.

Hint 2: Concept cue

In (c), count a concrete population of 10,000 rather than reaching for the formula.

Hint 3: Strategy cue

In (d), change only the base rate and keep both likelihoods fixed.

Compare with the worked solution

Comparing does not record a result. Judging your own written answer cannot show that you can do this without help.

(a) The table, both directions. Row totals: studied 45 + 15 = 60 , did not 10 + 30 = 40 . Column totals: passed 45 + 10 = 55 , failed 15 + 30 = 45 . Grand total 100 ✓.

Conditioning on studying discards the other row and renormalises within the 60 that remain:

P ( passed ∣ studied ) = 45 60 = 0.75 .

Conditioning the other way divides by the column of 55 instead:

P ( studied ∣ passed ) = 45 55 ≈ 0.818182 .

Same numerator 45, different denominators 60 and 55. The first divides by a row total, the second by a column total, and that is the whole of the asymmetry: conditioning on an event means dividing by that event's probability, so changing which event is conditioned on changes the denominator. Dividing by the grand total of 100 instead would give the joint probability 0.45 , which is a third quantity again.

(b) Independence. It would require P ( studied ∩ passed ) = P ( studied ) P ( passed ) :

0.60 × 0.55 = 0.33 against the actual 45 100 = 0.45 .

Not equal, so they are dependent ✓. The conditionals say the same thing more vividly: P ( passed ∣ studied ) = 0.75 against P ( passed ∣ did not ) = 10 40 = 0.25 , a threefold difference, where independence would have required both to equal the marginal 0.55.

Check by total probability: studying and not studying partition the students, so

0.75 ( 0.60 ) + 0.25 ( 0.40 ) = 0.45 + 0.10 = 0.55 = P ( passed )   ✓

matching the column total exactly.

(c) The positive test. Base rate first: P ( D ) = 0.01 . Likelihoods: P ( + ∣ D ) = 0.99 , P ( + ∣ not  D ) = 1 − 0.95 = 0.05 . The question asks for P ( D ∣ + ) , the reverse of the 99% given.

By natural frequencies, over 10,000 people:

Test +Test −Total
Disease991100
No disease4959,4059,900
Total5949,40610,000

1% of 10,000 is 100 diseased, and 99% of them test positive: 99. Of the 9,900 healthy, 5% test positive anyway: 495. Conditioning on a positive result restricts to the 594 in that column:

P ( D ∣ + ) = 99 99 + 495 = 99 594 = 1 6 ≈ 0.166667 .

By Bayes' rule. The denominator comes from total probability:

P ( + ) = ( 0.99 ) ( 0.01 ) + ( 0.05 ) ( 0.99 ) = 0.0099 + 0.0495 = 0.0594 = 297 5000 ,
P ( D ∣ + ) = 0.0099 0.0594 = 1 6   ✓

Same answer exactly, since they are the same computation, with the table making the denominator visible as a count.

Why so far from 99%. Two reasons, both structural. First, 99% was the wrong conditional: P ( + ∣ D ) divides by the 100 diseased, P ( D ∣ + ) by the 594 positives. Second, the base rate dominates: there are 99 times more healthy people, so a mere 5% false-positive rate among them yields 495 false alarms against 99 true ones, five to one. The test was not useless: it raised the probability from 1% to about 17%, a seventeenfold increase.

(d) The same test, a different population. With a 50% base rate the likelihoods are unchanged but the weights are not:

P ( D ∣ + ) = ( 0.99 ) ( 0.5 ) ( 0.99 ) ( 0.5 ) + ( 0.05 ) ( 0.5 ) = 0.495 0.520 ≈ 0.951923 ,

about 95% rather than 17%. Identical test, identical sensitivity and specificity, different population, and the posterior moves by a factor of more than five.

So a posterior is not a property of the test. It is a property of the test and the population it was applied to, which is why it must be reported with the base rate it assumes. A screening figure quoted in a symptomatic clinic, or the reverse, is not a conservative approximation; it is a different number answering a different question.

A complete answer does each of these:

  • computes conditional
  • tracks conditioning direction
  • applies bayes
Practice data

Your practice record is stored in this browser only. Clearing it removes every answer and every scheduled review, and cannot be undone.

Results update as you type. Use the up and down arrow keys to move between results, Enter to open one, and Escape to close.

Type to search.

Settings

Appearance

Interface density

Your record

Your progress is stored in this browser and nowhere else: an identifier, the answers you have given, the mastery states and review schedule derived from them, and the lesson you last opened. Clearing it makes you a new learner on this device. It cannot be undone, and it will not affect your appearance or density settings.

Focus timer

Focus--minutes remaining

Phase

Kept in this browser only, and used to label the session in your own history.

Today

Nothing recorded yet. Finish a focus session and it will appear here.

Settings

Focus sessions between long breaks.

Sessions you are aiming for in a day.

Notifications

Your history

Sessions are stored in this browser and nowhere else. They are not evidence and never reach your mastery record.