Bayes can be read as a geometric operation on the tree: the transformation that takes the tree ”BB knowing AA” to the tree ”AA knowing BB”.

In brief — A three-step algorithm

Given the “direct” tree with first level {Ai}\{A_i\} and second {B,B}\{B,\overline{B}\} under each AiA_i, with the branches weighted as P(Ai)P(A_i) (first) and P(BAi)P(B\mid A_i), P(BAi)P(\overline{B}\mid A_i) (second):

  1. Joint probabilities on the paths: for each leaf, P(AiB)=P(Ai)P(BAi)P(A_i\cap B) = P(A_i)\cdot P(B\mid A_i) (product along the path).
  2. Marginalisation: sum over the paths that end in BB: P(B)=iP(AiB)P(B) = \sum_i P(A_i\cap B).
  3. Inverted branch: P(AiB)=P(AiB)P(B)P(A_i\mid B) = \dfrac{P(A_i\cap B)}{P(B)}.

Building the “inverted” tree with first level {B,B}\{B,\overline{B}\} and second {Ai}\{A_i\}, the branches at the first level are P(B),P(B)P(B), P(\overline{B}) and those at the second level are the P(AiB),P(AiB)P(A_i\mid B), P(A_i\mid \overline{B}) just computed.

Example — Direct tree vs inverted tree, rare disease

We take up the example again: P(M)=0,001P(M)=0,001, P(T+M)=0,99P(T^+\mid M)=0,99, P(T+M)=0,02P(T^+\mid \overline{M})=0,02.

Direct tree (first level: disease; second: test):

Direct tree: first the disease, then the test outcome conditioned on the disease.

Step 1 — joint probabilities: P(MT+)=0,00099, P(MT+)=0,01998, P(MT)=0,00001, P(MT)=0,97902.P(M\cap T^+)=0,00099,\ P(\overline{M}\cap T^+)=0,01998,\ P(M\cap T^-)=0,00001,\ P(\overline{M}\cap T^-)=0,97902. Step 2 — marginalisation: P(T+)=0,00099+0,01998=0,02097,P(T)=1P(T+)=0,97903.P(T^+)=0,00099+0,01998=0,02097,\qquad P(T^-)=1-P(T^+)=0,97903. Step 3 — inverted branches: P(MT+)=0,000990,020970,047,P(MT+)0,953,P(M\mid T^+)=\tfrac{0,00099}{0,02097}\approx 0,047,\quad P(\overline{M}\mid T^+)\approx 0,953, P(MT)=0,000010,97903105,P(MT)1105.P(M\mid T^-)=\tfrac{0,00001}{0,97903}\approx 10^{-5},\quad P(\overline{M}\mid T^-)\approx 1-10^{-5}.

Inverted tree (first level: test; second: disease):

Inverted tree: first the test outcome, then the disease conditioned on the test. Same leaves, opposite conditioning.

The inverted tree contains exactly the same information as the direct one (the leaves have the same joint probabilities P(AiBj)P(A_i\cap B_j)), but reads the data with the opposite conditioning: now the question “given the test, what is the prob. of the disease” is immediate. It is the visual version of Bayes.

Topics: Probability
Concepts: Tree diagram · Tree inversion · Conditional probability · Bayes’ theorem
Methods: Bayes · Bayes tree inversion · Total prob
Skills: Calculating probability · Modelling