rPosterior.CatDirichlet {bbricks}R Documentation

Generate ramdom samples from the posterior distribution of a "CatDirichlet" object

Description

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

pi|alpha \sim Dir(alpha)

x|pi \sim Categorical(pi)

Where Dir() is the Dirichlet distribution, Categorical() is the Categorical distribution. See ?dDir and dCategorical for the definitions of these distribution.
The model structure and prior parameters are stored in a "CatDirichlet" object.
Posterior distribution is Dir(pi|alpha).

Usage

## S3 method for class 'CatDirichlet'
rPosterior(obj, n = 1, ...)

Arguments

obj

A "CatDirichlet" object.

n

integer, the number of samples to be generated.

...

Additional arguments to be passed to other inherited types.

Value

A matrix, each row is a sample of pi.

See Also

CatDirichlet, dPosterior.CatDirichlet

Examples

obj <- CatDirichlet(gamma=list(alpha=rep(1,26),uniqueLabels = letters))
rPosterior(obj = obj,n=3)

[Package bbricks version 0.1.4 Index]