rDir {revdbayes}R Documentation

Simulation from a Dirichlet distribution

Description

Simulates from a Dirichlet distribution with concentration parameter vector α\alpha = (α1\alpha_1, ..., αK\alpha_K).

Usage

rDir(n = 1, alpha = c(1, 1))

Arguments

n

A numeric scalar. The size of sample required.

alpha

A numeric vector. Dirichlet concentration parameter.

Details

The simulation is based on the property that if Y1,,YKY_1, \ldots, Y_K are independent, YiY_i has a gamma(αi\alpha_i, 1) distribution and S=Y1++YkS = Y_1 + \cdots + Y_k then (Y1,,YK)/S(Y_1, \ldots, Y_K) / S has a Dirichlet(α1\alpha_1, ..., αK\alpha_K) distribution.

See https://en.wikipedia.org/wiki/Dirichlet_distribution#Gamma_distribution

Value

An n by length(alpha) numeric matrix.

References

Kotz, S., Balakrishnan, N. and Johnson, N. L. (2000) Continuous Multivariate Distributions, vol. 1, Models and Applications, 2nd edn, ch. 49. New York: Wiley. doi:10.1002/0471722065

See Also

rprior_prob for prior simulation of GEV parameters - prior on probability scale.

Examples

rDir(n = 10, alpha = 1:4)

[Package revdbayes version 1.5.4 Index]