The Venn diagram with the absolute counts: in the intersection the 10 patients with drug and headache, outside the ovals the 7 without drug and healthy.
Step 3 — Table → Tree. We compute the conditionals for each row of A:
P(B∣A)=3510=72≈0,286,P(B∣A)=2215≈0,682.
So among those who take the drug only 28% have a headache, among those who do not take it 68%: the drug is protective (negative correlation between A and B).
The tree conditioned on A: on the branches the conditionals, on the leaves in red the products (the joint probabilities).
Check of the total probability (sum over the paths):P(B)=5735⋅72+5722⋅2215=5710+5715=5725 ✓, in agreement with the marginal of the table.
Seventh conversion: tree → inverted tree. We want the tree conditioned on B (B→A instead of A→B). We proceed with the three steps seen for the inversion of the tree:
The inverted tree has first level B,B with weights 25/57 and 32/57, second level A,A with 2/5 and 25/32 (and the complements).
Reading. Given that the patient had a headache, the probability that they had taken the drug is P(A∣B)=2/5=40%: the majority of those who have a headache did not take the drug (negative correlation, as expected).