sufficientStatistics.DP {bbricks}R Documentation

Sufficient statistics of a "DP" object

Description

For following model structure:

pi|alpha \sim DP(alpha,U)

z|pi \sim Categorical(pi)

theta_z|psi \sim H0(psi)

x|theta_z,z \sim F(theta_z)

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. The choice of F() and H0() can be described by an arbitrary "BasicBayesian" object such as "GaussianGaussian","GaussianInvWishart","GaussianNIW", "GaussianNIG", "CatDirichlet", and "CatDP". See ?BasicBayesian for definition of "BasicBayesian" objects, and see for example ?GaussianGaussian for specific "BasicBayesian" instances. As a summary, An "DP" object is simply a combination of a "CatDP" object (see ?CatDP) and an object of any "BasicBayesian" type.
The sufficient statistics of a set of samples x in a "DP" object is the same sufficient statistics of the "BasicBayesian" inside the "DP", see examples.

Usage

## S3 method for class 'DP'
sufficientStatistics(obj, x, ...)

Arguments

obj

A "DP" object.

x

Random samples of the "BasicBayesian" object.

...

Additional arguments to be passed to other inherited types.

Value

Return the sufficient statistics of the corresponding BasicBayesian type, see examples.

References

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

See Also

DP, sufficientStatistics_Weighted.DP

Examples

obj1 <- DP(gamma=list(alpha=1,H0aF="GaussianNIW",parH0=list(m=1,k=1,v=1,S=1)))
obj2 <- DP(gamma=list(alpha=1,H0aF="CatDirichlet",parH0=list(alpha=1,uniqueLabels=letters)))
x1 <- rnorm(100)
x2 <- sample(letters,100,replace = TRUE)
sufficientStatistics(obj = obj1,x=x1)
sufficientStatistics(obj = obj2,x=x2)
sufficientStatistics(obj = obj1,x=x1,foreach = TRUE)

[Package bbricks version 0.1.4 Index]