dPosterior.CatDirichlet {bbricks} R Documentation

Density function of the posterior distribution of a "CatDirichlet" object

Description

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).

Usage

```## S3 method for class 'CatDirichlet'
dPosterior(obj, pi, LOG = TRUE, ...)
```

Arguments

 `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.

Value

numeric vector, the posterior densities for each row of pi.

`CatDirichlet`, `rPosterior.CatDirichlet`
```obj <- CatDirichlet(gamma=list(alpha=runif(26),uniqueLabels = letters))