Elston-Stewart algorithm (source code)

= Elston-Stewart algorithm
{c}

Pedigree peeling eliminates latent <genotypes> by moving sums inside products whenever the other factors do not depend on the eliminated genotype. For one parent genotype $g$ and one child genotype $h$, the likelihood becomes
$$
\sum_g P(g)P(X_p\mid g)\left[\sum_hP(h\mid g)P(X_c\mid h)\right].
$$
The inner bracket is the child's message to its parent. With two states each, it needs four multiplications and two additions; multiplying the two parent weights and messages needs four more multiplications and the final sum one addition. The unrearranged four terms instead use twelve multiplications. Larger pedigrees use the same variable-elimination identity, with additional handling of pedigree loops.