Stick Breaking Process and Dirichlet Process Priors
The stick-breaking process illustrated here provides a prior distribution known as the Dirichlet Process Prior (DPP). The lavender rectangle below represents an unbroken stick. Press the “b” key to break the stick at a random point. Pressing “b” again breaks the stick randomly again, but only in the rightmost section. This process could technically continue forever, as there will always be some interval representing the rightmost section, but once you have no detectable remainder, press the “t” key to throw darts at the stick. This represents one draw from the DPP. The expected number of occupied segments is shown below as “E” and the observed number of occupied segments is shown as “O”.
As a phylogenetic example, the darts might represent sites and the segments substitution rate categories. The expected number of categories is determined by the parameter alpha (the value of which you can change; see the key at the bottom of the page): higher alpha means more categories.
- b key breaks off fraction from the remainder (lavender) using a draw from Beta(1,alpha)
- p key mimics pressing the b key until the remainder is tiny (0.001)
- r key resets everything
- t key throws darts and computes the O statistic
- shift-up/shift-down arrow keys increase/decrease alpha (but smallest value is 0.1)
- shift-right/shift-left arrow keys increase/decrease the number of darts (within the range 10-100)
- E is the expected number of colored rectangles hit by at least one of the n darts
- O is the observed number of colored rectangles hit by at least one dart