DirichletDistribution {rdecision} | R Documentation |
A parametrized Dirichlet distribution
Description
An R6 class representing a multivariate Dirichlet distribution.
Details
A multivariate Dirichlet distribution. See
https://en.wikipedia.org/wiki/Dirichlet_distribution for details.
Inherits from class Distribution
.
Super class
rdecision::Distribution
-> DirichletDistribution
Methods
Public methods
Inherited methods
Method new()
Create an object of class DirichletDistribution
.
Usage
DirichletDistribution$new(alpha)
Arguments
alpha
Parameters of the distribution; a vector of
K
numeric values each > 0, withK > 1
.
Returns
An object of class DirichletDistribution
.
Method distribution()
Accessor function for the name of the distribution.
Usage
DirichletDistribution$distribution()
Returns
Distribution name as character string.
Method mean()
Mean value of each dimension of the distribution.
Usage
DirichletDistribution$mean()
Returns
A numerical vector of length K.
Method mode()
Return the mode of the distribution.
Usage
DirichletDistribution$mode()
Details
Undefined if any alpha is \le 1
.
Returns
Mode as a vector of length K
.
Method quantile()
Quantiles of the univariate marginal distributions.
Usage
DirichletDistribution$quantile(probs)
Arguments
probs
Numeric vector of probabilities, each in range [0,1].
Details
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.
Returns
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).
Method varcov()
Variance-covariance matrix.
Usage
DirichletDistribution$varcov()
Returns
A positive definite symmetric matrix of size K
by
K
.
Method sample()
Draw and hold a random sample from the distribution.
Usage
DirichletDistribution$sample(expected = FALSE)
Arguments
expected
If TRUE, sets the next value retrieved by a call to
r()
to be the mean of the distribution.
Returns
Void; sample is retrieved with call to r()
.
Method clone()
The objects of this class are cloneable with this method.
Usage
DirichletDistribution$clone(deep = FALSE)
Arguments
deep
Whether to make a deep clone.
Author(s)
Andrew J. Sims andrew.sims@newcastle.ac.uk