rPosterior.CatDirichlet: Generate ramdom samples from the posterior distribution of a...

Description Usage Arguments Value See Also Examples

View source: R/Categorical_Inference.r

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

1
2
## 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

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

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