rdirichlet {MCMCpack}R Documentation

Generate Random Draws from the Dirichlet Distribution

Description

Generate random deviates from the Dirichlet distribution.

Usage

rdirichlet(n, alpha)

Arguments

n Number of random vectors to generate.
alpha Vector of shape parameters, or matrix of shape parameters corresponding to draw.

Details

The Dirichlet distribution is the multidimensional generalization of the beta distribution.

Value

rdirichlet returns a matrix with n rows, each containing a single Dirichlet random deviate.

Author(s)

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.

See Also

Beta, ddirichlet

Examples

  x <- rdirichlet(20, c(1,1,1) )

[Package Contents]