Extreme Optimization™: Complexity made simple.

Math and Statistics
Libraries for .NET

  • Home
  • Features
    • Math Library
    • Vector and Matrix Library
    • Statistics Library
    • Performance
    • Usability
  • Documentation
    • Introduction
    • Math Library User's Guide
    • Vector and Matrix Library User's Guide
    • Data Analysis Library User's Guide
    • Statistics Library User's Guide
    • Reference
  • Resources
    • Downloads
    • QuickStart Samples
    • Sample Applications
    • Frequently Asked Questions
    • Technical Support
  • Order
  • Company
    • About us
    • Testimonials
    • Customers
    • Press Releases
    • Careers
    • Partners
    • Contact us
Introduction
Deployment Guide
Nuget packages
Configuration
Using Parallelism
Expand Mathematics Library User's GuideMathematics Library User's Guide
Expand Vector and Matrix Library User's GuideVector and Matrix Library User's Guide
Expand Data Analysis Library User's GuideData Analysis Library User's Guide
Expand Statistics Library User's GuideStatistics Library User's Guide
Expand Data Access Library User's GuideData Access Library User's Guide
Expand ReferenceReference

Skip Navigation LinksHome»Documentation»Statistics Library User's Guide»Multivariate Distributions»The Dirichlet Distribution

The Dirichlet Distribution

Extreme Optimization Numerical Libraries for .NET Professional

The Dirichlet distribution is a generalization of the The Beta Distribution to the multivariate case. The Dirichlet distribution is often used in Bayesian analysis.

A Dirichlet distribution of order K is defined on the K-dimensional hyperplane with Condition on the variates of a Dirichlet distribution.. It has K shape parameters, usually denoted by the Greek letter α. Its probability density function (PDF) is:

Probability density of the Dirichlet distribution.

When K = 2, the Dirichlet distribution reduces to the Beta distribution. The Dirichlet distribution is implemented by the DirichletDistribution class. It has three constructors. The first constructor takes a VectorT that contains the shape parameters.

C#
VB
C++
F#
Copy
var alpha = Vector.Create(3.0, 7.0, 5.0);
var dirichlet1 = new DirichletDistribution(alpha);
Dim alpha = Vector.Create(3.0, 7.0, 5.0)
Dim dirichlet1 = New DirichletDistribution(alpha)

No code example is currently available or this language may not be supported.

let alpha = Vector.Create(3.0, 7.0, 5.0)
let dirichlet1 = DirichletDistribution(alpha)

The two remaining constructors estimate the distribution parameters from a set of variables. One constructor takes a VectorT array. The other takes a MatrixT whose columns contain the variables.

The GetParameters method returns a copy of the parameters α. The GetMeans method returns a VectorT that contains the mean of the distribution. The GetVarianceCovarianceMatrix method returns a SymmetricMatrixT that contains the variance-covariance matrix of the distribution.

There are two options to generate random samples from the distribution. One is to use the Sample method. Sample takes a SystemRandom and returns a vector with a single sample from the distribution. There are also FillSample and FillSamples methods, which copy the sample(s) into the vector or matrix that is supplied as an additional parameter. The example below shows how to generate random samples using each of these techniques:

C#
VB
C++
F#
Copy
MersenneTwister random = new MersenneTwister();
var sample = dirichlet1.Sample(random);
var samples = dirichlet1.Sample(random, 10000);
dirichlet1.FillSample(random, sample);
dirichlet1.FillSamples(random, samples);
Dim Random = New MersenneTwister()
Dim sample = dirichlet1.Sample(Random)
Dim samples = dirichlet1.Sample(Random, 10000)
dirichlet1.FillSample(Random, sample)
dirichlet1.FillSamples(Random, samples)

No code example is currently available or this language may not be supported.

let random = MersenneTwister()
let sample = dirichlet1.Sample(random)
let samples = dirichlet1.Sample(random, 10000)
dirichlet1.FillSample(random, sample)
dirichlet1.FillSamples(random, samples)

Copyright (c) 2004-2023 ExoAnalytics Inc.

Send comments on this topic to support@extremeoptimization.com

Copyright © 2004-2023, Extreme Optimization. All rights reserved.
Extreme Optimization, Complexity made simple, M#, and M Sharp are trademarks of ExoAnalytics Inc.
Microsoft, Visual C#, Visual Basic, Visual Studio, Visual Studio.NET, and the Optimized for Visual Studio logo
are registered trademarks of Microsoft Corporation.