SciencesPo (version 1.3.8)

ddirichlet: Dirichlet distribution

Description

Density function and random number generation for the Dirichlet distribution

Usage

ddirichlet(x, alpha, log = FALSE, sum = FALSE)

Arguments

x
a matrix containing observations.
alpha
the Dirichlet distribution's parameters. Can be a vector (one set of parameters for all observations) or a matrix (a different set of parameters for each observation), see Details.
log
if TRUE, logarithmic densities are returned.
sum
if TRUE, the (log-)likelihood is returned.

Value

  • the ddirichlet returns a vector of densities (if sum = FALSE) or the (log-)likelihood (if sum = TRUE) for the given data and alphas.

encoding

UTF-8

Examples

Run this code
mat <- cbind(1:10, 5, 10:1);
mat;
x <- rdirichlet(10, mat);
ddirichlet(x, mat);

Run the code above in your browser using DataLab