dirichlet: The Dirichlet Distribution

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

Description

Density function and random generation from the Dirichlet distribution.

Usage

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

Arguments

x

A vector containing a single deviate or matrix containing one random deviate per row.

n

Number of random vectors to generate.

alpha

Vector of shape parameters, or matrix of shape parameters corresponding to the number of draw.

Details

The Dirichlet distribution is the multidimensional generalization of the beta distribution.

Value

ddirichlet gives the density. rdirichlet returns a matrix with n rows, each containing a single Dirichlet random deviate.

Author(s)

Code is taken from Greg's Miscellaneous Functions (gregmisc). His code was based on code posted by Ben Bolker to R-News on 15 Dec 2000.

See Also

Beta

Examples

1
2
  density <- ddirichlet(c(.1,.2,.7), c(1,1,1))
  draws <- rdirichlet(20, c(1,1,1) )

MCMCpack documentation built on May 19, 2017, 3:36 p.m.

Search within the MCMCpack 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.