CatHDP2 {bbricks} R Documentation

## Create objects of type "CatHDP2".

### Description

Create an object of type "CatHDP2" that represents the Categorical-Hierarchical-Dirichlet-Process of two Dirichlet Process hierarchies, which is basically CatHDP with an additional layer of Dirichlet Process:

G |eta \sim DP(eta,U)

G_m|gamma \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_m

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

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. Categorical() is the Categorical distribution. See `dCategorical` for the definition of the Categorical distribution.
In the case of CatHDP2, u, z and k can only be positive integers.
This object will be used as a place for recording and accumulating information in the related inference/sampling functions such as posterior(), posteriorDiscard(), dPosteriorPredictive(), rPosteriorPredictive() and so on.

### Usage

```CatHDP2(
objCopy = NULL,
ENV = parent.frame(),
gamma = list(eta = 1, gamma = 1, alpha = 1, m = 3, j = c(2, 3, 4))
)
```

### Arguments

 `objCopy` an object of type "CatHDP2". If "objCopy" is not NULL, the function create a new "CatHDP2" object by copying the content from objCopy, otherwise this new object will be created by using "ENV" and "gamma". Default NULL. `ENV` environment, specify where the object will be created. `gamma` list, a named list of parameters, gamma=list(eta,gamma,alpha,m,j). Where gamma\$eta is a numeric value specifying the concentration parameter of DP(eta,U), gamma\$gamma is a numeric value specifying the concentration parameter of DP(gamma,G), gamma\$alpha is a numeric value specifying the concentration parameter of DP(alpha,G_m), gamma\$m is the number of groups M, gamma\$j is the number of subgroups in each group, must satisfy length(gamma\$j)=gamma\$m.

### Value

An object of class "CatHDP2".

### References

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

`posterior.CatHDP2`,`posteriorDiscard.CatHDP2` ...
```obj <- CatHDP2(gamma=list(eta=1,gamma=1,alpha=1,m=2,j=c(2,3)))