# rDir: Simulation from a Dirichlet distribution In revdbayes: Ratio-of-Uniforms Sampling for Bayesian Extreme Value Analysis

## Description

Simulates from a Dirichlet distribution with concentration parameter vector α = (α_1, ..., α_K).

## Usage

 `1` ```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, ..., Y_K are independent, Y_i has a gamma(α_i, 1) distribution and S = Y_1 + ... + Y_k then (Y_1, ..., Y_K) / S has a Dirichlet(α_1, ..., α_K) 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. http://dx.doi.org/10.1002/0471722065

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

## Examples

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

### Example output

```             [,1]       [,2]       [,3]      [,4]
[1,] 0.001154270 0.17386448 0.44776727 0.3772140
[2,] 0.139449067 0.12865696 0.30079121 0.4311028
[3,] 0.016794316 0.19113540 0.21785300 0.5742173
[4,] 0.079250750 0.35360051 0.32388281 0.2432659
[5,] 0.045430744 0.42331930 0.18512902 0.3461209
[6,] 0.009062482 0.09295906 0.29454065 0.6034378
[7,] 0.087818303 0.21456794 0.38489562 0.3127181
[8,] 0.308944234 0.14177089 0.09855536 0.4507295
[9,] 0.037717291 0.38662809 0.30769402 0.2679606
[10,] 0.147806263 0.24129198 0.27406894 0.3368328
```

revdbayes documentation built on Feb. 13, 2018, 1:04 a.m.