Learn R Programming

MSBVAR (version 0.9-2)

rdirichlet: Random draws from and density for Dirichlet distribution

Description

Generate draws from a random Dirichlet distribution or compute its density.

Usage

rdirichlet(n, alpha) ddirichlet(x, alpha)

Arguments

n
Number of draws
alpha
Scale matrix, $h x h$
x
value to compute density

Value

x
An $n x h$ matrix of the draws

Details

Draws $n$ values for an $h x h$ Dirichlet random variable or computes the density.

References

MCMCpack and gregmisc

Examples

Run this code
rdirichlet(2, matrix(rep(1, 4), 2, 2))

Run the code above in your browser using DataLab