A Gaussian mixture, drawn as a DAG
Measure the heights of everyone in a room full of children and their parents, and the histogram has two bumps. No single bell curve fits that. A mixture does: it says each point comes from one of two groups, each group is a bell curve of its own, and a weight says how many points each group contributes. Five numbers describe the whole thing: a centre μ and a spread σ for each group, and the weight w of the first.
Below, those numbers and the three densities they make sit on a <t-sketch>
board, with the arrows of how they depend on each other drawn in by hand. Drag the numbers;
pan and zoom the board.
The workbench: the same board in edit mode. Move the cards, draw, then press Export in the palette and paste the result over the board below.
Group 1 is centred at μ₁ =
Group 2 is centred at μ₂ =
A share w =
As published: view mode. The numbers and charts work, the ink stays put.
Group 1 is centred at μ₁ =
Group 2 is centred at μ₂ =
A share w =
Things to try
- Read the arrows backwards. The mixture has two arrows from the groups and one from the weight, and nothing else. Every change you make reaches it along one of those three.
- Merge the bumps. Drag μ₂ towards μ₁. Somewhere around two spreads apart the dip between the bumps disappears, and the mixture looks like one wide bell curve even though it isn't.
- Starve a group. Put w at 95%. Group 2 is still there in its own chart, but in the mixture it's a ripple on the shoulder of group 1.
- Make one group narrow. With σ₂ at 0.2, group 2 is a spike. A narrow group with a small weight can still be the tallest thing in the mixture.
How it's built
- The cards are children of the board. Each
<p>and<figure>inside the<t-sketch>is a card, placed withdata-x,data-yanddata-widthin board coordinates. They're ordinary vangle elements:<t-num>s for the five numbers and<t-obsplot>s for the densities, reading three<t-let>s outside the board. - The DAG is ink. The arrows were drawn on the board in edit mode,
with the cards moved into place. Export in the palette copied the HTML of a view-only
board: the cards where they ended up, and the strokes as JSON in a
<script type="application/json">. That's what this page pastes in. - View mode (
mode="view") leaves the cards live and the ink still: dragging a number drags the number, and dragging the paper pans.