Skip to contents

Quintana's predictive view is that a DP mixture is a rule for deciding, one observation at a time, whether the next value belongs with something already seen or starts a new group. Reading the Polya urn as an objective rather than as a sampler gives a partition directly, without a Markov chain. Observation i joins the cluster maximizing log n_c + log N(y_i | mu_c_post, s2_c_pred) over existing clusters, against log alpha + log N(y_i | m0, tau0^2 + sigma^2) for a new one, where with base prior N(m0, tau0^2) and known within-cluster variance sigma^2 a cluster holding n_c values summing to S_c has posterior precision 1/tau0^2 + n_c/sigma^2 and the predictive adds sigma^2.

Usage

Npbcl(y, alpha = 1, sigma = 1, m0 = NULL, tau0 = 10)

Arguments

y

Observations.

alpha

DP concentration, positive.

sigma

Within-cluster standard deviation, positive.

m0

Base-measure mean; the sample mean if NULL.

tau0

Base-measure standard deviation, positive.

Value

List with labels, estimate, n_clusters, sizes, means, log_score, alpha, n.

Details

Determinism: no sampling. The allocation depends on the order of y, which is a property of the greedy rule; log_score lets a caller compare orderings.

References

Quintana, F. A. (2006). A predictive view of Bayesian clustering. Journal of Statistical Planning and Inference, 136(8), 2407-2429. doi:10.1016/j.jspi.2004.09.015

Examples

V <- c(1, 2, 3, 4, 5, 6, 7, 8)
Npbcl(V)
#> $labels
#> [1] 0 0 0 0 0 0 1 1
#> 
#> $estimate
#> [1] 2
#> 
#> $n_clusters
#> [1] 2
#> 
#> $sizes
#> [1] 6 2
#> 
#> $means
#> [1] 3.501664 7.485075
#> 
#> $log_score
#> [1] -17.46473
#> 
#> $alpha
#> [1] 1
#> 
#> $n
#> [1] 8
#> 
#> $method
#> [1] "DP-mixture MAP partition (Quintana 2006)"
#> 
#> attr(,"class")
#> [1] "morie_rich_result" "list"