Learn R Programming

bmixture (version 1.7)

rdirichlet: Random generation for the Dirichlet distribution

Description

Random generation from the Dirichlet distribution.

Usage

rdirichlet( n = 10, alpha = c( 1, 1 ) )

Arguments

n

number of observations.

alpha

vector of shape parameters.

Value

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

Examples

Run this code
# NOT RUN {
  draws = rdirichlet( n = 500, alpha = c( 1, 1, 1 ) )
  
  boxplot( draws )
# }

Run the code above in your browser using DataLab