Skip to contents

Formula: P(z_i = k) = n_k / (i - 1 + alpha) for an occupied table k, and alpha / (i - 1 + alpha) for a new one

Usage

Crp(n, alpha = 1, u = NULL, seed = 1)

Arguments

n

See Usage.

alpha

See Usage.

u

See Usage.

seed

See Usage.

Value

List with table (assignment per customer), counts, n_tables, expected_tables, alpha, n.

References

Aldous (1985), Exchangeability and related topics, Ecole d'Ete de Probabilites de Saint-Flour XIII; Pitman (2006), Combinatorial Stochastic Processes. Neither is held locally; the seating rule and the E[K] = sum_i alpha/(alpha + i - 1) identity are the standard published forms.

Examples

Crp(n = 5L)
#> $table
#> [1] 0 0 0 1 2
#> 
#> $counts
#> [1] 3 1 1
#> 
#> $n_tables
#> [1] 3
#> 
#> $expected_tables
#> [1] 2.283333
#> 
#> $alpha
#> [1] 1
#> 
#> $n
#> [1] 5
#> 
#> $method
#> [1] "Chinese restaurant process"
#> 
#> attr(,"class")
#> [1] "morie_rich_result" "list"