DirichletDistribution Class 
Namespace: Accord.Statistics.Distributions.Multivariate
[SerializableAttribute] public class DirichletDistribution : MultivariateContinuousDistribution
The DirichletDistribution type exposes the following members.
Name  Description  

DirichletDistribution(Double) 
Creates a new Dirichlet distribution.
 
DirichletDistribution(Int32, Double) 
Creates a new symmetric Dirichlet distribution.

Name  Description  

Covariance 
Gets the variancecovariance matrix for this distribution.
(Overrides MultivariateContinuousDistributionCovariance.)  
Dimension 
Gets the number of variables for this distribution.
(Inherited from MultivariateContinuousDistribution.)  
Mean 
Gets the mean for this distribution.
(Overrides MultivariateContinuousDistributionMean.)  
Median 
Gets the median for this distribution.
(Inherited from MultivariateContinuousDistribution.)  
Mode 
Gets the mode for this distribution.
(Inherited from MultivariateContinuousDistribution.)  
Variance 
Gets the variance for this distribution.
(Overrides MultivariateContinuousDistributionVariance.) 
Name  Description  

Clone 
Creates a new object that is a copy of the current instance.
(Overrides DistributionBaseClone.)  
ComplementaryDistributionFunction 
Gets the complementary cumulative distribution function
(ccdf) for this distribution evaluated at point x.
This function is also known as the Survival function.
(Inherited from MultivariateContinuousDistribution.)  
DistributionFunction 
Not supported.
(Overrides MultivariateContinuousDistributionDistributionFunction(Double).)  
Equals  Determines whether the specified object is equal to the current object. (Inherited from Object.)  
Finalize  Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)  
Fit(Double) 
Fits the underlying distribution to a given set of observations.
(Inherited from MultivariateContinuousDistribution.)  
Fit(Double, IFittingOptions) 
Fits the underlying distribution to a given set of observations.
(Inherited from MultivariateContinuousDistribution.)  
Fit(Double, Double) 
Fits the underlying distribution to a given set of observations.
(Inherited from MultivariateContinuousDistribution.)  
Fit(Double, Int32) 
Fits the underlying distribution to a given set of observations.
(Inherited from MultivariateContinuousDistribution.)  
Fit(Double, Double, IFittingOptions) 
Not supported.
(Overrides MultivariateContinuousDistributionFit(Double, Double, IFittingOptions).)  
Fit(Double, Int32, IFittingOptions) 
Fits the underlying distribution to a given set of observations.
(Inherited from MultivariateContinuousDistribution.)  
Generate 
Generates a random observation from the current distribution.
(Inherited from MultivariateContinuousDistribution.)  
Generate(Double) 
Generates a random observation from the current distribution.
(Inherited from MultivariateContinuousDistribution.)  
Generate(Int32) 
Generates a random vector of observations from the current distribution.
(Inherited from MultivariateContinuousDistribution.)  
Generate(Int32) 
Generates a random observation from the current distribution.
(Inherited from MultivariateContinuousDistribution.)  
Generate(Int32, Double) 
Generates a random vector of observations from the current distribution.
(Inherited from MultivariateContinuousDistribution.)  
Generate(Int32, Int32) 
Generates a random vector of observations from the current distribution.
(Inherited from MultivariateContinuousDistribution.)  
GetHashCode  Serves as the default hash function. (Inherited from Object.)  
GetType  Gets the Type of the current instance. (Inherited from Object.)  
LogProbabilityDensityFunction 
Gets the logprobability density function (pdf)
for this distribution evaluated at point x.
(Overrides MultivariateContinuousDistributionLogProbabilityDensityFunction(Double).)  
MemberwiseClone  Creates a shallow copy of the current Object. (Inherited from Object.)  
ProbabilityDensityFunction 
Gets the probability density function (pdf) for
this distribution evaluated at point x.
(Overrides MultivariateContinuousDistributionProbabilityDensityFunction(Double).)  
ToString 
Returns a String that represents this instance.
(Inherited from DistributionBase.)  
ToString(IFormatProvider) 
Returns a String that represents this instance.
(Inherited from DistributionBase.)  
ToString(String) 
Returns a String that represents this instance.
(Inherited from DistributionBase.)  
ToString(String, IFormatProvider) 
Returns a String that represents this instance.
(Overrides DistributionBaseToString(String, IFormatProvider).) 
Name  Description  

HasMethod 
Checks whether an object implements a method with the given name.
(Defined by ExtensionMethods.)  
IsEqual  Compares two objects for equality, performing an elementwise comparison if the elements are vectors or matrices. (Defined by Matrix.)  
ToT  Overloaded.
Converts an object into another type, irrespective of whether
the conversion can be done at compile time or not. This can be
used to convert generic types to numeric types during runtime.
(Defined by ExtensionMethods.)  
ToT  Overloaded.
Converts an object into another type, irrespective of whether
the conversion can be done at compile time or not. This can be
used to convert generic types to numeric types during runtime.
(Defined by Matrix.) 
The Dirichlet distribution, often denoted Dir(α), is a family of continuous multivariate probability distributions parameterized by a vector α of positive real numbers. 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 α_{i}−1 times.
References:
// Create a Dirichlet with the following concentrations var dirich = new DirichletDistribution(0.42, 0.57, 1.2); // Common measures double[] mean = dirich.Mean; // { 0.19, 0.26, 0.54 } double[] median = dirich.Median; // { 0.19, 0.26, 0.54 } double[] var = dirich.Variance; // { 0.048, 0.060, 0.077 } double[,] cov = dirich.Covariance; // see below // 0.0115297440926238 0.0156475098399895 0.0329421259789253 // cov = 0.0156475098399895 0.0212359062114143 0.0447071709713986 // 0.0329421259789253 0.0447071709713986 0.0941203599397865 // (the above matrix representation has been transcribed to text using) string str = cov.ToString(DefaultMatrixFormatProvider.InvariantCulture); // Probability mass functions double pdf1 = dirich.ProbabilityDensityFunction(new double[] { 2, 5 }); // 0.12121671541846207 double pdf2 = dirich.ProbabilityDensityFunction(new double[] { 4, 2 }); // 0.12024840322466089 double pdf3 = dirich.ProbabilityDensityFunction(new double[] { 3, 7 }); // 0.082907634905068528 double lpdf = dirich.LogProbabilityDensityFunction(new double[] { 3, 7 }); // 2.4900281233124044