Realizations from a stick breaking representation of a Dirichlet process
This is a quick post looking at realizations of a Dirichlet process via the stick-breaking construction. The Dirichlet process is defined by two parameters: a positive, scalar concentration parameter (alpha) and a base measure (P0).
The stick-breaking construction provides a realization of a Dirichlet process by
- Sampling locations from the base measure.
- Calculating probabilities for each location via breaking a stick of unit length using random Be(1,a) draws.
Given v~Be(1,a), a function to calculate location probabilities is given here.
A visualization of the stick-breaking process is given here for the first five probabilities. (Anybody know how to make this figure not have so much white space? I tried par(fin=c(5,1)) but that didn’t work.)
Notice that the probabilities (widths of the intervals) is not strictly decreasing, although the probabilities are stochastically decreasing.
Now, we look at random realizations from this DP which involve random draws from the base measure (rP0) and particle weights given by the stick-breaking process. A function to perform this is given below with a function to plot the results. Note that the stick-breaking construction requires an infinite number of locations and weights, but this is truncated in the function below to H components. One rationale for doing so is that the remaining probably is extremely small.
The function below can be used to visualize realizations from the DP. For simplicity, I have used a standard normal as the base measure. Feel free to run this a few times to get a sense for what the realizations look like.
When the concentration parameter is relatively small, a realization from the DP does not look very much like the base measure. Increasing the concentration parameter will result in samples that appear much more like the base measure once they are binnned. Here we use a weighted histogram to bin the samples. The result looks much more like the base measure.
blog comments powered by Disqus