sufficientStatistics.CatDP: Sufficient statistics of a "CatDP" object

Description Usage Arguments Value References See Also Examples

View source: R/Dirichlet_Process.r

Description

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:

Usage

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

Arguments

obj

A "CatDP" object.

x

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

foreach

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

...

Additional arguments to be passed to other inherited types.

Value

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

References

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

Examples

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

bbricks documentation built on July 8, 2020, 7:29 p.m.