dDir {bbricks}R Documentation

Density function for Dirichelt distribution

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

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

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)

[Package bbricks version 0.1.4 Index]