dirichlet(params, powers, pnames)
is.dirichlet(x)
dirichlet_params(x)
dirichlet_params(x) <- value
gd(a, b, b0 = 0, pnames = NULL)
dirichlet()
and gd()
return a hyperdirichlet
object; function is.dirichlet()
returns a logical; and function
dirichlet_params()
returns a numeric vector.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.
justpairs
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