rPosteriorPredictive.CatDP: Generate random samples from the posterior predictive...

Description Usage Arguments Value References See Also Examples

View source: R/Dirichlet_Process.r

Description

Generate random samples from the posterior predictive distribution of the following structure:

pi|alpha \sim DP(alpha,U)

x|pi \sim Categorical(pi)

where DP(alpha,U) is a Dirichlet Process on positive integers, alpha is the "concentration parameter" of the Dirichlet Process, U is the "base measure" of this Dirichlet process, it is an uniform distribution on all positive integers.Categorical() is the Categorical distribution. See dCategorical for the definition of the Categorical distribution.
In the case of CatDP, x can only be positive integers.
The model structure and prior parameters are stored in a "CatDP" object.
Posterior predictive distribution is the distribution of x|alpha.

Usage

1
2
## S3 method for class 'CatDP'
rPosteriorPredictive(obj, n = 1L, ...)

Arguments

obj

A "CatDP" object.

n

integer, number of samples.

...

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.

See Also

CatDP, dPosteriorPredictive.CatDP

Examples

1
2
3
4
5
x <- sample(1L:10L,size = 40,replace = TRUE)
obj <- CatDP()
ss <- sufficientStatistics(obj=obj,x=x)
posterior(obj = obj,ss = ss)
rPosteriorPredictive(obj = obj,n=200L)

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