The function to generate random vectors from the Dirichlet distribution.
1  rdirichlet(n, shape)

n 
Number of Dirichlet random vectors to generate. If 
shape 
Vector with 
The Dirichlet distribution is the multidimensional generalization of the beta distribution.
A kvariate Dirichlet random vector (x[1],…,x[k]) has the joint probability density function
Γ(α[1]+…+α[k+1])(Γ(α[1])…Γ(α[k+1])) x[1]^(α[1]1)… x_k^(α[k]1)(1∑_{i=1}^k x[i])^(α[k+1]1),
where x[i] ≥ 0 for all i = 1, …, k, ∑_{i=1}^k x[i] ≤ 1, and α[1], …, α[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 reorder the shape parameters, and how to reduce the amount of arithmetic operations.
rdirichlet()
returns a matrix with n
rows, each containing a single Dirichlet
random vector.
ChingWei Cheng <aks43725@gmail.com>,
YingChao Hung <hungy@nccu.edu.tw>,
Narayanaswamy Balakrishnan <bala@univmail.cis.mcmaster.ca>
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.
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.
rdirichlet
in package MCMCpack.
rdirichlet
in package gtools.
1 2  library(rBeta2009)
rdirichlet(10, c(1.5, 0.7, 5.2, 3.4))

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
All documentation is copyright its authors; we didn't write any of that.