Learn R Programming

bbricks (version 0.1.1)

dPosteriorPredictive.CatDP: Posterior predictive density function of a "CatDP" object

Description

Generate the the density value of the posterior predictive distribution of the following structure: pi|alpha ~ DP(alpha,U) x|pi ~ 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. 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 is the distribution of x|alpha.

Usage

# S3 method for CatDP
dPosteriorPredictive(obj, x, LOG = TRUE, ...)

Arguments

obj

A "CatDP" object.

x

integer, the elements of the vector must all greater than 0, the samples of a Categorical distribution.

LOG

Return the log density if set to "TRUE".

...

Additional arguments to be passed to other inherited types.

Value

A numeric vector, the posterior predictive density.

References

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

See Also

@seealso CatDP, dPosteriorPredictive.CatDP, marginalLikelihood.CatDP

Examples

Run this code
# NOT RUN {
x <- sample(1L:10L,size = 40,replace = TRUE)
obj <- CatDP()
ss <- sufficientStatistics(obj=obj,x=x)
posterior(obj = obj,ss = ss)
dPosteriorPredictive(obj = obj,x=1L:11L,LOG = FALSE)
# }

Run the code above in your browser using DataLab