Interactive demo · Statistical Methods for Modern Biology · Chapter 4

EM for a mixture of two normals, step by step

The data are modelled as f(x) = λφA(x) + (1 − λ)φB(x) with unknown labels. The E step computes, for every observation, the posterior probability w(x, A) that it came from component A (bottom panel). The M step re-estimates λ, the two means and the two standard deviations as weighted averages with these weights. Each full iteration can only raise the log-likelihood (right panel), which is the monotonicity result proved in the notes.

Data

Start

Steps

Scoreboard

Try these

The quartile start puts the two means at the lower and upper quartiles of the data, λ = 1/2 and both standard deviations at the overall standard deviation; it is the start used by the course's R code, so the converged numbers can be compared with R (shown in the scoreboard). "Random weights" draws a membership weight for every observation from a seeded uniform generator and begins with an M step, as in Exercise 4.1. The algorithm stops when the log-likelihood changes by at most 10−12.

In the lecture notes