For following model structure:
?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.
# S3 method for HDP
sufficientStatistics_Weighted(obj, x, w, ...)
A "HDP" object.
Random samples of the "BasicBayesian" object.
numeric, sample weights.
further arguments passed to the corresponding sufficientStatistics method of the "BasicBayesian" object.
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.
# 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