dDir: Density function for Dirichelt distribution

Description Usage Arguments Value See Also Examples

View source: R/Categorical_Inference.r

Description

Calculate the densities of a given set of Dirichlet samples. For a random vector x, the density function is defined as: 1/Beta(alpha) prod_i=1:p x_i^alpha_i -1 Where Beta() is the beta function. p is the dimension of x.

Usage

1
dDir(x, alpha, LOG = FALSE)

Arguments

x

matrix or numeric vector, if matrix every row of x is an observation, if numeric vector, it's the same as a matrix with only one row.

alpha

numeric, Dirichlet parameter.

LOG

logical, return the log density if set to "TRUE".

Value

A numeric vector of density values.

See Also

rDir

Examples

1
2
3
x <- rDir(5,c(1,2,3)) #generate 5 samples with parameters c(1,2,3)
dDir(x,c(1,2,3))
dDir(x,c(1,2,3),LOG=TRUE)

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