hyperdirichlet (version 1.5-1)

gd: The Dirichlet and generalized Dirichlet distribution

Description

Specify a Dirichlet or generalized Dirichlet distribution as a special case of the hyperdirichlet distribution

Usage

dirichlet(params, powers, pnames)
is.dirichlet(x)
dirichlet_params(x)
dirichlet_params(x) <- value
gd(a, b, b0 = 0, pnames = NULL)

Arguments

params,powers
Numeric vectors (supply exactly one) specifying the parameters or the powers respectively of the Dirichlet distribution
x
Object of class hyperdirichlet
value
Numeric vector
a,b
Numeric vectors of the same length specifying the parameters of the generalized Dirichlet distribution
b0
Arbitrary constant for the generalized Dirichlet distribution
pnames
Character vector for name of the hyperdirichlet object

Value

Functions dirichlet() and gd() return a hyperdirichlet object; function is.dirichlet() returns a logical; and function dirichlet_params() returns a numeric vector.

Details

Function dirichlet() returns the hyperdirichlet distribution corresponding to the classical Dirichlet distribution. If the vector params|powers is a named vector, then the hyperdirichlet object inherits the names (but the names are ignored if argument pnames is supplied).

Function is.dirichlet(x) returns TRUE or FALSE according to whether the hyperdirichlet object x is a Dirichlet distribution.

Function dirichlet_params() returns the Dirichlet parameters of a hyperdirichlet object.

Function gd() returns the hyperdirichlet distribution corresponding to the generalized Dirichlet distribution of Connor and Mosimann.

For convenience, the generalized Dirichlet distribution is described here. Connor and Mosimann 1969 give the PDF as $$ \left[\prod_{i=1}^{k-1}B\left(a_i,b_i\right)\right]^{-1}\, p_k^{b_{k-1}-1}\, \prod_{i=1}^{k-1}\left[p_i^{a_i-1}\left(\sum_{j=i}^k p_j\right)^{b_{i-1}-\left(a_i+b_i\right)}\right]. $$ where \(\sum_{i=1}^k p_i=1\) and \(b_0\) is arbitrary. If \(b_{i-1}=a_i+b_i\) for \(i=2,\ldots, k-1\) then the PDF reduces to a standard Dirichlet distribution with \(\alpha_i=a_i\) for \(i=1,\ldots,k-1\) and \(\alpha_k=b_{k-1}\).

Wong 1998 gives the algebraically equivalent form $$ \prod_{i=1}^k\frac{1}{B\left(\alpha_i,\beta_i\right)} x_i^{\alpha_i-1} \left(1-x_1-\cdots-x_i\right)^{\gamma_i} $$ for \(x_1+x_2+\cdots+x_k\leq 1\) and \(x_j\geq 0\) for \(j=1,2,\ldots,k\) and \(\gamma_j=\beta_j-\beta_{j+1}\) for \(j=1,2,\ldots,k-1\) and \(\gamma_k=\beta_k-1\).

Here, \(B(x,y)=\Gamma(x)\Gamma(y)/\Gamma(x+y)\) is the beta function.

References

  • R. J. Connor and J. E. Mosimann 1969. Concepts of independence for proportions with a generalization of the Dirichlet distribution. Journal of the American Statistical Association, volume 64, number 325, pp194-206
  • T-T Wong 1998. Generalized Dirichlet distribution in Bayesian analysis. Applied Mathematics and Computation, volume 97, pp165-181

See Also

justpairs

Examples

Run this code

a <- dirichlet(1:4 , pnames=letters[1:4])
is.dirichlet(a)  # should be TRUE
dirichlet(dirichlet_params(a)) # should be 'a'

gd(1:5,5:1)

Run the code above in your browser using DataLab