Skip to contents

Dirichlet distribution

Usage

rdirichlet(n, alpha)

Arguments

n

total number of draws

alpha

vector controlling the concentration of simplex

Value

Numeric matrix with n rows and length(alpha) columns; each row is a draw from the simplex.

Details

Implementation of random sampling from a Dirichlet distribution

Examples

rdirichlet(3, alpha = c(1, 1, 1))
#>            [,1]      [,2]       [,3]
#> [1,] 0.74432111 0.2436906 0.01198830
#> [2,] 0.07010564 0.7149558 0.21493855
#> [3,] 0.86624762 0.1052139 0.02853847