50% off: Unlimited data and AI learning.
State of Data and AI Literacy Report 2025

bbricks (version 0.1.1)

marginalLikelihood_bySufficientStatistics.CatDirichlet: Marginal likelihood of a "CatDirichlet" object, usnig sufficient statistics

Description

Generate the marginal likelihood of a set of observations of the following model structure: pi|alpha ~ Dirichlet(alpha) x|pi ~ Categorical(pi) the model structure and prior parameters are stored in a "CatDirichlet" object. Marginal likelihood is the likelihood of x|alpha

Usage

# S3 method for CatDirichlet
marginalLikelihood_bySufficientStatistics(obj, ss, LOG = TRUE, ...)

Arguments

obj

A "CatDirichlet" object.

ss

Sufficient statistics of x. In Categorical-Dirichlet case the sufficient statistic of sample x can be either x itself, of an "ssCat" object generated by the function sufficientStatistics.CatDirichlet().

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

@seealso CatDirichlet, marginalLikelihood.CatDirichlet

Examples

Run this code
# NOT RUN {
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)
# }

Run the code above in your browser using DataLab