Learn R Programming

bbricks (version 0.1.4)

sufficientStatistics_Weighted.HDP: Weighted sufficient statistics of a "HDP" object

Description

For following model structure: $$G|gamma \sim DP(gamma,U)$$ $$pi_j|G,alpha \sim DP(alpha,G), j = 1:J$$ $$z|pi_j \sim Categorical(pi_j)$$ $$k|z,G \sim Categorical(G), \textrm{ if z is a sample from the base measure G}$$ $$theta_k|psi \sim H0(psi)$$ $$x|theta_k,k \sim F(theta_k)$$ where DP(gamma,U) is a Dirichlet Process on positive integers, gamma is the "concentration parameter", U is the "base measure" of this Dirichlet process, U is an uniform distribution on all positive integers. DP(alpha,G) is a Dirichlet Process on integers with concentration parameter alpha and base measure G. 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 "HDP" object is simply a combination of a "CatHDP" object (see ?CatHDP) and an object of any "BasicBayesian" type. In the case of HDP, z and k can only be positive integers. The sufficient statistics of a set of samples x in a "HDP" object is the same sufficient statistics of the "BasicBayesian" inside the "HDP", see examples.

Usage

# S3 method for HDP
sufficientStatistics_Weighted(obj, x, w, ...)

Arguments

obj

A "HDP" object.

x

Random samples of the "BasicBayesian" object.

w

numeric, sample weights.

...

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

HDP, sufficientStatistics.HDP

Examples

Run this code
# NOT RUN {
## a HDP with Gaussian NIW observations
obj1 <- HDP(gamma=list(gamma=1,alpha=1,j=2,
                       H0aF="GaussianNIW",
                       parH0=list(m=0,k=1,v=2,S=1)))
## a HDP with Categorical-Dirichlet observations
obj2 <- HDP(gamma=list(gamma=1,alpha=1,j=2,
            H0aF="CatDirichlet",
            parH0=list(alpha=1,uniqueLabels=letters[1:3])))
x1 <- rnorm(100)
x2 <- sample(letters[1:3],100,replace = TRUE)
w <- runif(100)
sufficientStatistics_Weighted(obj = obj1,x=x1,w=w,foreach = FALSE)
sufficientStatistics_Weighted(obj = obj2,x=x2,w=w,foreach = FALSE)
sufficientStatistics_Weighted(obj = obj1,x=x1,w=w,foreach = TRUE)
# }

Run the code above in your browser using DataLab