rdirichlet {rBeta2009} | R Documentation |
The Dirichlet Random Vector Generating Function
Description
The function to generate random vectors from the Dirichlet distribution.
Usage
rdirichlet(n, shape)
Arguments
n |
Number of Dirichlet random vectors to generate. If |
shape |
Vector with |
Details
The Dirichlet distribution is the multidimensional generalization of the beta distribution.
A k
-variate Dirichlet random vector (x_1,\ldots,x_k)
has
the joint probability density function
\frac{\Gamma(\alpha_1+\dots+\alpha_{k+1})}{\Gamma(\alpha_1)\dots\Gamma(\alpha_{k+1})}
x_1^{\alpha_1-1}\dots x_k^{\alpha_k-1}\left(1-\sum_{i=1}^k x_i\right)^{\alpha_{k+1}-1},
where x_i \ge 0
for all i = 1, \ldots, k
,
\sum_{i=1}^k x_i \leq 1
, and
\alpha_1, \ldots, \alpha_{k+1}
are positive shape
parameters.
rdirichlet
generates the Dirichlet random vector by utilizing the transformation
method based on beta variates and three guidelines introduced by Hung et al. (2011).
The three guidelines include: how to choose the fastest beta generation algorithm, how to
best re-order the shape parameters, and how to reduce the amount of arithmetic operations.
Value
rdirichlet()
returns a matrix with n
rows, each containing a single Dirichlet
random vector.
Author(s)
Ching-Wei Cheng <aks43725@gmail.com>,
Ying-Chao Hung <hungy@nccu.edu.tw>,
Narayanaswamy Balakrishnan <bala@univmail.cis.mcmaster.ca>
Source
rdirichlet
uses a C translation of
Y. C. Hung and N. Balakrishnan and C. W. Cheng (2011), Evaluation of algorithms for generating Dirichlet random vectors, Journal of Statistical Computation and Simulation, 81, 445–459.
References
Y. C. Hung and N. Balakrishnan and C. W. Cheng (2011), Evaluation of algorithms for generating Dirichlet random vectors, Journal of Statistical Computation and Simulation, 81, 445–459.
See Also
rdirichlet
in package MCMCpack.
rdirichlet
in package gtools.
Examples
library(rBeta2009)
rdirichlet(10, c(1.5, 0.7, 5.2, 3.4))