Draws compositional rows from a Dirichlet with the given concentration
vector, via the gamma-normalisation construction.
Arguments
- n
Integer. The number of compositions (rows) to draw.
- alpha
Numeric vector of positive concentration parameters. Its
length sets the number of simplex components \(K\).
Value
A numeric n by K matrix whose rows sum to one.
Examples
set.seed(1)
X <- flexyBayes:::rdirichlet(5L, alpha = c(2, 5, 3))
rowSums(X)
#> [1] 1 1 1 1 1