Learn R Programming

MCMCpack (version 0.4-5)

rdirichlet: 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.

Value

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

Details

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

See Also

Beta, ddirichlet

Examples

Run this code
x <- rdirichlet(20, c(1,1,1) )

Run the code above in your browser using DataLab