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

Description Usage Arguments Value References See Also Examples

View source: R/Dirichlet_Process.r

Description

For following model structure:

G |eta \sim DP(eta,U)

G_m|gamma,G \sim DP(gamma,G), m = 1:M

pi_{mj}|G_m,alpha \sim DP(alpha,G_m), j = 1:J_m

z|pi_{mj} \sim Categorical(pi_{mj})

k|z,G_m \sim Categorical(G_m),\textrm{ if z is a sample from the base measure }G_{mj}

u|k,G \sim Categorical(G),\textrm{ if k is a sample from the base measure G}

theta_u|psi \sim H0(psi)

x|theta_u,u \sim F(theta_u)

where DP(eta,U) is a Dirichlet Process on positive integers, eta is the "concentration parameter", U is the "base measure" of this Dirichlet process, U is an uniform distribution on all positive integers. DP(gamma,G) is a Dirichlet Process on integers with concentration parameter gamma and base measure G. DP(alpha,G_m) is a Dirichlet Process on integers with concentration parameter alpha and base measure G_m. 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 "HDP2" object is simply a combination of a "CatHDP2" object (see ?CatHDP2) and an object of any "BasicBayesian" type.
In the case of HDP2, u, z and k can only be positive integers.
The sufficient statistics of a set of samples x in a "HDP2" object is the same sufficient statistics of the "BasicBayesian" inside the "HDP2", see examples.

Usage

1
2
## S3 method for class 'HDP2'
sufficientStatistics(obj, x, ...)

Arguments

obj

A "HDP2" object.

x

Random samples of the "BasicBayesian" object.

...

further arguments passed to the corresponding sufficientStatistics method of the "BasicBayesian" object.

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

HDP2, sufficientStatistics_Weighted.HDP2

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## a HDP2 with Gaussian NIW observations
obj1 <- HDP2(gamma=list(gamma=1,alpha=1,j=2,m=2,
                        H0aF="GaussianNIW",
                        parH0=list(m=0,k=1,v=2,S=1)))
## a HDP2 with Categorical-Dirichlet observations
obj2 <- HDP2(gamma=list(gamma=1,alpha=1,j=2,m=2,
                        H0aF="CatDirichlet",
                        parH0=list(alpha=1,uniqueLabels=letters[1:3])))
x1 <- rnorm(100)
x2 <- sample(letters[1:3],100,replace = TRUE)
sufficientStatistics(obj = obj1,x=x1,foreach = FALSE)
sufficientStatistics(obj = obj2,x=x2,foreach = FALSE)
sufficientStatistics(obj = obj1,x=x1,foreach = TRUE)

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