dCRP {sams} | R Documentation |
Compute Probability Mass of a Partition Under the Two Parameter Chinese Restaurant Process (CRP)
Description
Compute Probability Mass of a Partition Under the Two Parameter Chinese Restaurant Process (CRP)
Usage
dCRP(partition, mass = 1, discount = 0, log = FALSE)
Arguments
partition |
A numeric vector of cluster labels, or a matrix whose rows are numeric vectors of cluster labels |
mass |
A numeric value indicating the mass parameter in the CRP, which
must be greater than the |
discount |
A numeric value on the interval [0,1), indicating the discount parameter of the two parameter CRP |
log |
A logical value indicating whether results should be returned on the log scale |
Value
A numeric vector of probabilities, or log probabilities if log
= TRUE
.
Examples
partitions <- matrix(c(0,0,0,0,0,
0,0,0,0,1,
0,0,0,1,2,
0,0,1,2,3,
0,1,2,3,4), ncol = 5, nrow = 5, byrow = TRUE)
# discount = 0 shows higher probability for lower quantity of components
dCRP(partitions, mass = 1, discount = 0, log = FALSE)
# discount = 0.5 shows higher probability for higher quantity of components
dCRP(partitions, mass = 1, discount = 0.5, log = FALSE)
[Package sams version 0.4.3 Index]