Formula: P(z_i | z_{-i}) proportional to n_k^{-i} f(y_i | theta_k), and to (alpha/m) f(y_i | theta_aux) for each of m auxiliary draws
Details
Neal's algorithm 8: the cluster parameters are kept explicit rather than integrated out, and m fresh draws from the base measure stand in for the infinitely many empty tables. That makes the sampler valid for non-conjugate base measures, unlike the collapsed algorithm 3; here the conjugate normal case is used so the two can be compared.
Examples
V <- c(1, 2, 3, 4, 5, 6, 7, 8)
Crpgib(V)
#> $estimate
#> [1] 3
#>
#> $z
#> [1] 1 1 1 2 0 0 0 0
#>
#> $counts
#> [1] 4 3 1
#>
#> $theta
#> [1] 6.811173 2.500116 3.922563
#>
#> $n_clusters
#> [1] 3
#>
#> $loglik
#> [1] -11.42334
#>
#> $n
#> [1] 8
#>
#> $method
#> [1] "CRP Gibbs sampler, Neal algorithm 8"
#>
#> attr(,"class")
#> [1] "morie_rich_result" "list"
