An R6 class representing a multivariate Dirichlet distribution.
Andrew J. Sims andrew.sims@newcastle.ac.uk
rdecision::Distribution
-> DirichletDistribution
new()
Create an object of class DirichletDistribution
.
DirichletDistribution$new(alpha)
alpha
Parameters of the distribution; a vector of K
numeric
values each > 0, with \(K > 1\).
An object of class DirichletDistribution
.
distribution()
Accessor function for the name of the distribution.
DirichletDistribution$distribution()
Distribution name as character string.
A numerical vector of length K.
Undefined if any alpha is \(\le 1\).
Mode as a vector of length K
.
quantile()
Quantiles of the univariate marginal distributions.
DirichletDistribution$quantile(probs)
probs
Numeric vector of probabilities, each in range [0,1].
The univariate marginal distributions of a Dirichlet distribution are Beta distributions. This function returns the quantiles of each marginal. Note that these are not the true quantiles of the multivariate Dirichlet.
A matrix of numeric values with the number of rows equal to the
length of probs
, the number of columns equal to the order; rows
are labelled with quantiles and columns with the dimension (1, 2, etc).
varcov()
Variance-covariance matrix.
DirichletDistribution$varcov()
A positive definite symmetric matrix of size K
by
K
.
sample()
Draw and hold a random sample from the distribution.
DirichletDistribution$sample(expected = FALSE)
expected
If TRUE, sets the next value retrieved by a call to
r()
to be the mean of the distribution.
Void; sample is retrieved with call to r()
.
clone()
The objects of this class are cloneable with this method.
DirichletDistribution$clone(deep = FALSE)
deep
Whether to make a deep clone.
A multivariate Dirichlet distribution. See
https://en.wikipedia.org/wiki/Dirichlet_distribution for details.
Inherits from class Distribution
.