Class DirichletDistribution
- java.lang.Object
-
- dev.nm.stat.distribution.multivariate.DirichletDistribution
-
- All Implemented Interfaces:
MultivariateProbabilityDistribution
public class DirichletDistribution extends Object implements MultivariateProbabilityDistribution
The Dirichlet distribution (after Peter Gustav Lejeune Dirichlet), often denoted Dir(a), is a family of continuous multivariate probability distributions parametrized by a vector a of positive reals. It is the multivariate generalization of the beta distribution. Dirichlet distributions are very often used as prior distributions in Bayesian statistics, and in fact the Dirichlet distribution is the conjugate prior of the categorical distribution and multinomial distribution. That is, its probability density function returns the belief that the probabilities of K rival events are x_i given that each event has been observed a_{i-1} times. The R equivalent function isddirichletin packagegtools.- See Also:
- Wikipedia: Probability density function
-
-
Constructor Summary
Constructors Constructor Description DirichletDistribution(double[] a)Constructs an instance of Dirichlet distribution.DirichletDistribution(double[] a, double epsilon)Constructs an instance of Dirichlet distribution.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description doublecdf(Vector x)Gets the cumulative probability F(x) = Pr(X ≤ x).Matrixcovariance()Gets the covariance matrix of this distribution.doubledensity(Vector x)The density function, which, if exists, is the derivative of F.doubleentropy()Gets the entropy of this distribution.Vectormean()Gets the mean of this distribution.Vectormode()Gets the mode of this distribution.doublemoment(Vector t)The moment generating function is the expected value of etX.
-
-
-
Constructor Detail
-
DirichletDistribution
public DirichletDistribution(double[] a, double epsilon)Constructs an instance of Dirichlet distribution.- Parameters:
a- the parametersepsilon- a precision parameter: when a number |x| ≤ ε, it is considered 0
-
DirichletDistribution
public DirichletDistribution(double[] a)
Constructs an instance of Dirichlet distribution.- Parameters:
a- the parameters
-
-
Method Detail
-
density
public double density(Vector x)
Description copied from interface:MultivariateProbabilityDistributionThe density function, which, if exists, is the derivative of F. It describes the density of probability at each point in the sample space.f(x) = dF(X) / dx
This may not always exist. For the discrete cases, this is the probability mass function. It gives the probability that a discrete random variable is exactly equal to some value.- Specified by:
densityin interfaceMultivariateProbabilityDistribution- Parameters:
x- x- Returns:
- f(x)
-
cdf
public double cdf(Vector x)
Description copied from interface:MultivariateProbabilityDistributionGets the cumulative probability F(x) = Pr(X ≤ x).- Specified by:
cdfin interfaceMultivariateProbabilityDistribution- Parameters:
x- x- Returns:
- F(x) = Pr(X ≤ x)
-
mean
public Vector mean()
Description copied from interface:MultivariateProbabilityDistributionGets the mean of this distribution.- Specified by:
meanin interfaceMultivariateProbabilityDistribution- Returns:
- the mean
-
mode
public Vector mode()
Description copied from interface:MultivariateProbabilityDistributionGets the mode of this distribution.- Specified by:
modein interfaceMultivariateProbabilityDistribution- Returns:
- the mean
-
covariance
public Matrix covariance()
Description copied from interface:MultivariateProbabilityDistributionGets the covariance matrix of this distribution.- Specified by:
covariancein interfaceMultivariateProbabilityDistribution- Returns:
- the covariance
-
entropy
public double entropy()
Description copied from interface:MultivariateProbabilityDistributionGets the entropy of this distribution.- Specified by:
entropyin interfaceMultivariateProbabilityDistribution- Returns:
- the entropy
- See Also:
- Wikipedia: Entropy (information theory)
-
moment
public double moment(Vector t)
Description copied from interface:MultivariateProbabilityDistributionThe moment generating function is the expected value of etX. That is,E(etX)
This may not always exist.- Specified by:
momentin interfaceMultivariateProbabilityDistribution- Parameters:
t- t- Returns:
- E(exp(tX))
- See Also:
- Wikipedia: Moment-generating function
-
-