marginalLikelihood.CatDirichlet {bbricks}R Documentation

Marginal likelihood of a "CatDirichlet" object

Description

Generate the marginal likelihood of the following model 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.
Marginal likelihood is the likelihood of x|alpha.

Usage

## S3 method for class 'CatDirichlet'
marginalLikelihood(obj, x, LOG = TRUE, ...)

Arguments

obj

A "CatDirichlet" object.

x

numeric/integer/character vector, observed Categorical samples.

LOG

Return the log density if set to "TRUE".

...

Additional arguments to be passed to other inherited types.

Value

numeric, the marginal likelihood.

References

Murphy, Kevin P. Machine learning: a probabilistic perspective. MIT press, 2012.

See Also

CatDirichlet, marginalLikelihood_bySufficientStatistics.CatDirichlet

Examples

obj <- CatDirichlet(gamma=list(alpha=runif(26,1,2),uniqueLabels = letters))
x <- sample(letters,size = 20,replace = TRUE)
marginalLikelihood(obj=obj,x=x,LOG = TRUE) #marginal likelihood
ss <- sufficientStatistics(obj = obj,x=x)
marginalLikelihood_bySufficientStatistics(obj=obj,ss = ss,LOG = TRUE)

[Package bbricks version 0.1.4 Index]