MultinomialDistribution Class |
Namespace: Accord.Statistics.Distributions.Multivariate
[SerializableAttribute] public class MultinomialDistribution : MultivariateDiscreteDistribution, IFittableDistribution<double[], IFittingOptions>, IFittable<double[], IFittingOptions>, IFittable<double[]>, IFittableDistribution<double[]>, IDistribution<double[]>, IDistribution, ICloneable
The MultinomialDistribution type exposes the following members.
Name | Description | |
---|---|---|
MultinomialDistribution |
Initializes a new instance of the MultinomialDistribution class.
|
Name | Description | |
---|---|---|
Covariance |
Gets the variance-covariance matrix for this distribution.
(Overrides MultivariateDiscreteDistributionCovariance.) | |
Dimension |
Gets the number of variables for this distribution.
(Inherited from MultivariateDiscreteDistribution.) | |
Mean |
Gets the mean for this distribution.
(Overrides MultivariateDiscreteDistributionMean.) | |
Median |
Gets the median for this distribution.
(Inherited from MultivariateDiscreteDistribution.) | |
Mode |
Gets the mode for this distribution.
(Inherited from MultivariateDiscreteDistribution.) | |
NumberOfTrials |
Gets the number of Bernoulli trials N.
| |
Probabilities |
Gets the event probabilities associated with the trials.
| |
Support |
Gets the support interval for this distribution.
(Overrides MultivariateDiscreteDistributionSupport.) | |
Variance |
Gets the variance vector for this distribution.
(Overrides MultivariateDiscreteDistributionVariance.) |
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 MultivariateDiscreteDistribution.) | |
DistributionFunction |
Gets the cumulative distribution function (cdf) for
this distribution evaluated at point x.
(Inherited from MultivariateDiscreteDistribution.) | |
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 MultivariateDiscreteDistribution.) | |
Fit(Double, IFittingOptions) |
Fits the underlying distribution to a given set of observations.
(Inherited from MultivariateDiscreteDistribution.) | |
Fit(Double, Double) |
Fits the underlying distribution to a given set of observations.
(Inherited from MultivariateDiscreteDistribution.) | |
Fit(Double, Int32) |
Fits the underlying distribution to a given set of observations.
(Inherited from MultivariateDiscreteDistribution.) | |
Fit(Double, Double, IFittingOptions) |
Fits the underlying distribution to a given set of observations.
(Overrides MultivariateDiscreteDistributionFit(Double, Double, IFittingOptions).) | |
Fit(Double, Int32, IFittingOptions) |
Fits the underlying distribution to a given set of observations.
(Inherited from MultivariateDiscreteDistribution.) | |
Generate |
Generates a random observation from the current distribution.
(Inherited from MultivariateDiscreteDistribution.) | |
Generate(Double) |
Generates a random observation from the current distribution.
(Inherited from MultivariateDiscreteDistribution.) | |
Generate(Int32) |
Generates a random vector of observations from the current distribution.
(Inherited from MultivariateDiscreteDistribution.) | |
Generate(Int32) |
Generates a random observation from the current distribution.
(Inherited from MultivariateDiscreteDistribution.) | |
Generate(Random) |
Generates a random observation from the current distribution.
(Inherited from MultivariateDiscreteDistribution.) | |
Generate(Double, Random) |
Generates a random observation from the current distribution.
(Inherited from MultivariateDiscreteDistribution.) | |
Generate(Int32, Double) |
Generates a random vector of observations from the current distribution.
(Inherited from MultivariateDiscreteDistribution.) | |
Generate(Int32, Int32) |
Generates a random vector of observations from the current distribution.
(Inherited from MultivariateDiscreteDistribution.) | |
Generate(Int32, Random) |
Generates a random vector of observations from the current distribution.
(Inherited from MultivariateDiscreteDistribution.) | |
Generate(Int32, Random) |
Generates a random observation from the current distribution.
(Inherited from MultivariateDiscreteDistribution.) | |
Generate(Int32, Double, Random) |
Generates a random vector of observations from the current distribution.
(Inherited from MultivariateDiscreteDistribution.) | |
Generate(Int32, Int32, Random) |
Generates a random vector of observations from the current distribution.
(Inherited from MultivariateDiscreteDistribution.) | |
GetHashCode | Serves as the default hash function. (Inherited from Object.) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
InnerComplementaryDistributionFunction |
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 MultivariateDiscreteDistribution.) | |
InnerDistributionFunction |
Not supported.
(Overrides MultivariateDiscreteDistributionInnerDistributionFunction(Int32).) | |
InnerInverseDistributionFunction |
Not supported.
(Inherited from MultivariateDiscreteDistribution.) | |
InnerLogProbabilityMassFunction |
Gets the log-probability mass function (pmf) for
this distribution evaluated at point x.
(Overrides MultivariateDiscreteDistributionInnerLogProbabilityMassFunction(Int32).) | |
InnerProbabilityMassFunction |
Gets the probability mass function (pmf) for
this distribution evaluated at point x.
(Overrides MultivariateDiscreteDistributionInnerProbabilityMassFunction(Int32).) | |
InverseDistributionFunction |
Not supported.
(Inherited from MultivariateDiscreteDistribution.) | |
LogProbabilityMassFunction |
Gets the log-probability mass function (pmf) for
this distribution evaluated at point x.
(Inherited from MultivariateDiscreteDistribution.) | |
MarginalDistributionFunction(Int32) |
Gets the marginal distribution of a given variable.
(Inherited from MultivariateDiscreteDistribution.) | |
MarginalDistributionFunction(Int32, Int32) |
Gets the marginal distribution of a given variable evaluated at a given value.
(Inherited from MultivariateDiscreteDistribution.) | |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
ProbabilityMassFunction |
Gets the probability mass function (pmf) for
this distribution evaluated at point x.
(Inherited from MultivariateDiscreteDistribution.) | |
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.) | |
To(Type) | 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 ExtensionMethods.) |
The multinomial distribution is a generalization of the binomial distribution. The binomial distribution is the probability distribution of the number of "successes" in n independent Bernoulli trials, with the same probability of "success" on each trial.
In a multinomial distribution, the analog of the Bernoulli distribution is the categorical distribution, where each trial results in exactly one of some fixed finite number k of possible outcomes, with probabilities p1, ..., pk and there are n independent trials.
References:
// distribution parameters int numberOfTrials = 5; double[] probabilities = { 0.25, 0.75 }; // Create a new Multinomial distribution with 5 trials for 2 symbols var dist = new MultinomialDistribution(numberOfTrials, probabilities); int dimensions = dist.Dimension; // 2 double[] mean = dist.Mean; // { 1.25, 3.75 } double[] median = dist.Median; // { 1.25, 3.75 } double[] var = dist.Variance; // { -0.9375, -0.9375 } double pdf1 = dist.ProbabilityMassFunction(new[] { 2, 3 }); // 0.26367187499999994 double pdf2 = dist.ProbabilityMassFunction(new[] { 1, 4 }); // 0.3955078125 double pdf3 = dist.ProbabilityMassFunction(new[] { 5, 0 }); // 0.0009765625 double lpdf = dist.LogProbabilityMassFunction(new[] { 1, 4 }); // -0.9275847384929139 // output is "Multinomial(x; n = 5, p = { 0.25, 0.75 })" string str = dist.ToString(CultureInfo.InvariantCulture);