rdirichlet {MCMCpack} | R Documentation |
Generate random deviates from the Dirichlet distribution.
rdirichlet(n, alpha)
n |
Number of random vectors to generate. |
alpha |
Vector of shape parameters, or matrix of shape parameters corresponding to draw. |
The Dirichlet distribution is the multidimensional generalization of the beta distribution.
rdirichlet
returns a matrix with n
rows, each containing
a single Dirichlet random deviate.
Code is taken from Greg's Miscellaneous Functions (gregmisc). His code was based on code posted by Ben Bolker to R-News on Fri Dec 15 2000.
x <- rdirichlet(20, c(1,1,1) )