Dirichlet generator

Share:

Description

This is a random generator for Dirichlet D(a1,...,ad) distributions, based on the normalisation of Gamma gamma(ai) random variables.

Usage

1
rdirichlet(n, shape)

Arguments

n

Number of generations requested

shape

Vector of ai's

Value

A (n,length(shape)) matrix, with one simulated vector per row.

Author(s)

Christian P. Robert and George Casella

References

Used in Chapter 7 EnteR Monte Carlo Statistical Methods

See Also

rgamma

Examples

1
2
3
4
A=rdirichlet(10^3,rep(.5,5))
hist(A[,1],fre=FALSE,col="grey",nclass=123,xlim=c(0,1),
main="",xlab=expression(p[1]))
curve(dbeta(x,.5,4*.5),add=TRUE,col="sienna",lwd=2)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.