dist.Dirichlet: Dirichlet Distribution

Description Usage Arguments Details Value See Also Examples

Description

This is the density function and random generation from the Dirichlet distribution.

Usage

1
2
ddirichlet(x, alpha, log=FALSE)
rdirichlet(n, alpha)

Arguments

x

This is a vector containing a single deviate or matrix containing one random deviate per row. Each vector, or matrix row, must sum to 1.

n

This is the number of random deviates to generate.

alpha

This is a vector or matrix of shape parameters.

log

Logical. If log=TRUE, then the logarithm of the density is returned.

Details

The Dirichlet distribution is the multivariate generalization of the univariate beta distribution. Its probability density function returns the belief that the probabilities of k rival events are theta[j] given that each event has been observed alpha[j] - 1 times.

The Dirichlet distribution is commonly used as a prior distribution in Bayesian inference. The Dirichlet distribution is the conjugate prior distribution for the parameters of the categorical and multinomial distributions.

A very common special case is the symmetric Dirichlet distribution, where all of the elements in parameter vector alpha have the same value. Symmetric Dirichlet distributions are often used as vague or weakly informative Dirichlet prior distributions, so that one component is not favored over another. The single value that is entered into all elements of alpha is called the concentration parameter.

Value

ddirichlet gives the density and rdirichlet generates random deviates.

See Also

dbeta, dcat, dmvpolya, dmultinom, and TransitionMatrix.

Examples

1
2
3
library(LaplacesDemon)
x <- ddirichlet(c(.1,.3,.6), c(1,1,1))
x <- rdirichlet(10, c(1,1,1))

LaplacesDemonR/LaplacesDemon documentation built on Dec. 19, 2017, 6:08 p.m.