| dPosterior.CatDirichlet | R Documentation |
Generate the the density value of 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 density is the density function of Dir(pi|alpha).
## S3 method for class 'CatDirichlet' dPosterior(obj, pi, LOG = TRUE, ...)
obj |
A "CatDirichlet" object. |
pi |
matrix or a numeric vector. When pi is a matrix, each row is an observation. When pi is a vector, it will be treated as only one observation. |
LOG |
Return the log density if set to "TRUE". |
... |
Additional arguments to be passed to other inherited types. |
numeric vector, the posterior densities for each row of pi.
CatDirichlet, rPosterior.CatDirichlet
obj <- CatDirichlet(gamma=list(alpha=runif(26),uniqueLabels = letters)) dPosterior(obj = obj,pi = runif(26)) dPosterior(obj = obj,pi = matrix(runif(26*10),nrow = 10))