Skip to contents

Sethuraman's construction makes the draw explicit. The result is DISCRETE with probability one however continuous the base measure is – which is what makes the DP a clustering prior: repeated draws collide, and each distinct value is a cluster. Alpha controls fragmentation; the expected number of distinct values among n draws grows like alpha * log n, so it grows with the data rather than being fixed in advance.

Usage

morie_esl_dirichlet_proc(
  alpha = 1,
  G0 = NULL,
  n_atoms = 50L,
  size = NULL,
  seed = 0L
)

Arguments

alpha

Concentration, positive.

G0

Base-measure sampler G0(n); defaults to standard normal.

n_atoms

Truncation level.

size

If given, also draw this many observations from G.

seed

Seed.

Value

List with weights, atoms, truncation_mass, and when size is given samples, labels, n_clusters, expected_clusters.

Details

Truncating at n_atoms leaves part of the stick unbroken; that residual is reported as truncation_mass and warned about when it is not negligible.

References

Sethuraman, J. (1994). A constructive definition of Dirichlet priors. Statistica Sinica 4, 639-650.

Examples

r <- morie_esl_dirichlet_proc(alpha = 2, n_atoms = 200L, seed = 1L)
abs(sum(r$weights) + r$truncation_mass - 1) < 1e-12
#> [1] TRUE