Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

ChineseRestaurantProcess

The Chinese Restaurant Process Distribution


Description

Density and random generation for the Chinese Restaurant Process distribution.

Usage

dCRP(x, conc = 1, size, log = 0)

rCRP(n, conc = 1, size)

Arguments

x

vector of values.

conc

scalar concentration parameter.

size

integer-valued length of x (required).

log

logical; if TRUE, probability density is returned on the log scale.

n

number of observations (only n = 1 is handled currently).

Details

The Chinese restaurant process distribution is a distribution on the space of partitions of the positive integers. The distribution with concentration parameter α equal to conc has probability function

f(x_i \mid x_1, …, x_{i-1})=\frac{1}{i-1+α}∑_{j=1}^{i-1}δ_{x_j}+ \frac{α}{i-1+α}δ_{x^{new}},

where x^{new} is a new integer not in x_1, …, x_{i-1}.

If conc is not specified, it assumes the default value of 1. The conc parameter has to be larger than zero. Otherwise, NaN are returned.

Value

dCRP gives the density, and rCRP gives random generation.

Author(s)

Claudia Wehrhahn

References

Blackwell, D., and MacQueen, J. B. (1973). Ferguson distributions via P\'olya urn schemes. The Annals of Statistics, 1: 353-355.

Aldous, D. J. (1985). Exchangeability and related topics. In \'Ecole d'\'Et\'e de Probabilit\'es de Saint-Flour XIII - 1983 (pp. 1-198). Springer, Berlin, Heidelberg.

Pitman, J. (1996). Some developments of the Blackwell-MacQueen urn scheme. IMS Lecture Notes-Monograph Series, 30: 245-267.

Examples

x <- rCRP(n=1, conc = 1, size=10)
dCRP(x, conc = 1, size=10)

nimble

MCMC, Particle Filtering, and Programmable Hierarchical Modeling

v0.11.0
BSD_3_clause + file LICENSE | GPL (>= 2)
Authors
Perry de Valpine [aut], Christopher Paciorek [aut, cre], Daniel Turek [aut], Nick Michaud [aut], Cliff Anderson-Bergman [aut], Fritz Obermeyer [aut], Claudia Wehrhahn Cortes [aut] (Bayesian nonparametrics system), Abel Rodrìguez [aut] (Bayesian nonparametrics system), Duncan Temple Lang [aut] (packaging configuration), Sally Paganin [aut] (reversible jump MCMC), Jagadish Babu [ctb] (code for the compilation system for an early version of NIMBLE), Lauren Ponisio [ctb] (contributions to the cross-validation code), Peter Sujan [ctb] (multivariate t distribution code)
Initial release
2021-04-16

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.