rDir: Simulation from a Dirichlet distribution

View source: R/rprior.R

rDirR Documentation

Simulation from a Dirichlet distribution

Description

Simulates from a Dirichlet distribution with concentration parameter vector \alpha = (\alpha_1, ..., \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 Y_1, \ldots, Y_K are independent, Y_i has a gamma(\alpha_i, 1) distribution and S = Y_1 + \cdots + Y_k then (Y_1, \ldots, Y_K) / S has a Dirichlet(\alpha_1, ..., \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. \Sexpr[results=rd]{tools:::Rd_expr_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)

revdbayes documentation built on Sept. 10, 2023, 1:07 a.m.