CatDirichlet: Create objects of type "CatDirichlet".

Description Usage Arguments Value References See Also Examples

View source: R/Categorical_Inference.r

Description

Create an object of type "CatDirichlet", which represents the Categorical (Multinomial) and Dirichlet conjugate 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 created object will be used as a place for recording and accumulating information in the related inference/sampling functions such as posterior(), posteriorDiscard(), MAP(), marginalLikelihood(), dPosteriorPredictive(), rPosteriorPredictive() and so on. A categorical distribution is defined on a set of unique labels, usually these labels are integers, they can also be characters and factors.

Usage

1
2
3
4
5
CatDirichlet(
  objCopy = NULL,
  ENV = parent.frame(),
  gamma = list(alpha = 1, uniqueLabels = 1L)
)

Arguments

objCopy

an object of type "CatDirichlet". If "objCopy" is not NULL, the function create a new "CatDirichlet" object by copying the content from objCopy, otherwise this new object will be created by using "ENV" and "gamma". Default NULL.

ENV

environment, specify where the object will be created.

gamma

list, a named list of parameters, gamma=list(alpha,uniqueLabels). Where gamma$alpha is a numeric vector specifying the parameters of the Dirichlet distribution, gamma$uniqueLabels is a integer/character vector specifying the unique category labels of the Categorical distribution.

Value

An object of class "CatDirichlet".

References

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

See Also

posterior.CatDirichlet,posteriorDiscard.CatDirichlet,MAP.CatDirichlet,MPE.CatDirichlet,marginalLikelihood.CatDirichlet,rPosteriorPredictive.CatDirichlet,dPosteriorPredictive.CatDirichlet ...

Examples

1
2
obj <- CatDirichlet(gamma=list(alpha=c(1,2,1),uniqueLabels = letters[1:3]))
obj #print the content

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