Bayes' theorem as a tree

A person is tested for a disease. Change the prevalence, the sensitivity and the specificity. The tree, the branch thickness and the result follow immediately.

Prior: how common is the disease?
Likelihood: positive test if diseased
Negative test if healthy (false positive rate = 1 − specificity)
Examples:
P(Dpos | Tpos), posterior
Diseased, given a positive test
P(Tpos), evidence
Share of all people with a positive test
P(Dpos | Tneg)
Diseased, given a negative test
Probability tree for a diagnostic test Branches from the population to disease present or absent, then to positive or negative test results, with probabilities that update with the sliders. Person testedfor a disease Disease present(Dpos) Disease absent(Dneg) Dpos and Tpostrue positive (TP) Dpos and Tnegfalse negative Dneg and Tposfalse positive (FP) Dneg and Tnegtrue negative

Reading the tree: the first split is the prior (prevalence), the second split holds the likelihoods (sensitivity and 1 − specificity). The two highlighted leaves are the people with a positive test. The posterior is the share of true positives among them. Thicker branches mean higher probability.