# ChineseRestaurantProcess: The Chinese Restaurant Process Distribution In nimble: MCMC, Particle Filtering, and Programmable Hierarchical Modeling

 ChineseRestaurantProcess R Documentation

## 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.

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 documentation built on March 18, 2022, 8:03 p.m.