sufficientStatistics.CatDP {bbricks}R Documentation

Sufficient statistics of a "CatDP" object


For following model structure:

pi|alpha \sim DP(alpha,U)

x|pi \sim Categorical(pi)

where DP(alpha,U) is a Dirichlet Process on positive integers, alpha is the "concentration parameter" of the Dirichlet Process, U is the "base measure" of this Dirichlet process, it is an uniform distribution on all positive integers.Categorical() is the Categorical distribution. See dCategorical for the definition of the Categorical distribution.
In the case of CatDP, x can only be positive integers.
The model structure and prior parameters are stored in a "CatDP" object.
The sufficient statistics of a set of samples x is:


## S3 method for class 'CatDP'
sufficientStatistics(obj, x, foreach = FALSE, ...)



A "CatDP" object.


integer, the elements of the vector must all greater than 0, the samples of a Categorical distribution.


logical, specifying whether to return the sufficient statistics for each observation. Default FALSE.


Additional arguments to be passed to other inherited types.


An object of class "ssCatDP", the sufficient statistics of a set of categorical samples. Or an integer vector same as x if foreach=TRUE.


Teh, Yee W., et al. "Sharing clusters among related groups: Hierarchical Dirichlet processes." Advances in neural information processing systems. 2005.

See Also

CatDP, sufficientStatistics_Weighted.CatDP


x <- sample(1L:10L,size = 4,replace = TRUE)
obj <- CatDP()
## an object of class "ssCatDP", which contains the counts of each unique integer
## will return x itself
sufficientStatistics(obj=obj,x=x,foreach = TRUE)

[Package bbricks version 0.1.4 Index]