rdirichlet: Dirichlet generator

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/rdirichlet.R

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)


mcsm documentation built on May 19, 2017, 11:40 p.m.
Search within the mcsm package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs in the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.