Generate n random vectors distributed according to a Dirichlet distribution. Each row of the returned matrix is a random vector that sums to 1.
rdirichlet(n, alpha)
n | The number of random vectors to generate |
---|---|
alpha | A vector of parameters |
copied from package MCMCpack
to avoid a dependency. That code
was taken from Greg's Miscellaneous Functions (gregmisc). His code was based
on code posted by Ben Bolker to R-News on 15 Dec 2000.
The function returns a matrix with n rows and length(alpha)
columns