Description Usage Arguments Value References See Also Examples
View source: R/Dirichlet_Process.r
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.
1 2 | ## S3 method for class 'DP'
sufficientStatistics(obj, x, ...)
|
obj |
A "DP" object. |
x |
Random samples of the "BasicBayesian" object. |
... |
Additional arguments to be passed to other inherited types. |
Return the sufficient statistics of the corresponding BasicBayesian type, see examples.
Teh, Yee W., et al. "Sharing clusters among related groups: Hierarchical Dirichlet processes." Advances in neural information processing systems. 2005.
DP
, sufficientStatistics_Weighted.DP
1 2 3 4 5 6 7 | 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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.