rPosteriorPredictive.HDP {bbricks} R Documentation

## Generate random samples from the posterior predictive distribution of a "HDP" object

### Description

Generate random samples from the posterior predictive distribution of the following 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 model structure and prior parameters are stored in a "HDP" object.
This function will generate random samples from the distribution z,k|gamma,alpha,psi,x.

### Usage

```## S3 method for class 'HDP'
rPosteriorPredictive(obj, n = 1, x, j, ...)
```

### Arguments

 `obj` A "HDP" object. `n` integer, number of samples. `x` Random samples of the "BasicBayesian" object. `j` integer, group label. `...` Additional arguments to be passed to other inherited types.

### Value

integer, the categorical samples.

### References

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

`HDP`, `dPosteriorPredictive.HDP`