BinomialDistribution Class 
Namespace: Accord.Statistics.Distributions.Univariate
[SerializableAttribute] public class BinomialDistribution : UnivariateDiscreteDistribution, IFittableDistribution<double>, IFittable<double>, IDistribution<double>, IDistribution, ICloneable, IFittableDistribution<int>, IFittable<int>, IDistribution<int>
The BinomialDistribution type exposes the following members.
Name  Description  

BinomialDistribution 
Constructs a new binomial distribution.
 
BinomialDistribution(Int32) 
Constructs a new binomial distribution.
 
BinomialDistribution(Int32, Double) 
Constructs a new binomial distribution.

Name  Description  

Entropy 
Gets the entropy for this distribution.
(Overrides UnivariateDiscreteDistributionEntropy.)  
Mean 
Gets the mean for this distribution.
(Overrides UnivariateDiscreteDistributionMean.)  
Median 
Gets the median for this distribution.
(Inherited from UnivariateDiscreteDistribution.)  
Mode 
Gets the mode for this distribution.
(Overrides UnivariateDiscreteDistributionMode.)  
NumberOfTrials 
Gets the number of trials n for the distribution.
 
ProbabilityOfSuccess 
Gets the success probability p for the distribution.
 
Quartiles 
Gets the Quartiles for this distribution.
(Inherited from UnivariateDiscreteDistribution.)  
StandardDeviation 
Gets the Standard Deviation (the square root of
the variance) for the current distribution.
(Inherited from UnivariateDiscreteDistribution.)  
Support 
Gets the support interval for this distribution.
(Overrides UnivariateDiscreteDistributionSupport.)  
Variance 
Gets the variance for this distribution.
(Overrides UnivariateDiscreteDistributionVariance.) 
Name  Description  

BaseInverseDistributionFunction 
Gets the inverse of the cumulative distribution function (icdf) for
this distribution evaluated at probability p using a numerical
approximation based on binary search.
(Inherited from UnivariateDiscreteDistribution.)  
Clone 
Creates a new object that is a copy of the current instance.
(Overrides DistributionBaseClone.)  
ComplementaryDistributionFunction(Int32) 
Gets P(X > k) the complementary cumulative distribution function
(ccdf) for this distribution evaluated at point k.
This function is also known as the Survival function.
(Inherited from UnivariateDiscreteDistribution.)  
ComplementaryDistributionFunction(Int32, Boolean) 
Gets the complementary cumulative distribution function
(ccdf) for this distribution evaluated at point k.
This function is also known as the Survival function.
(Inherited from UnivariateDiscreteDistribution.)  
CumulativeHazardFunction 
Gets the cumulative hazard function for this
distribution evaluated at point x.
(Inherited from UnivariateDiscreteDistribution.)  
DistributionFunction(Int32) 
Gets the cumulative distribution function (cdf) for
this distribution evaluated at point k.
(Overrides UnivariateDiscreteDistributionDistributionFunction(Int32).)  
DistributionFunction(Int32, Boolean) 
Gets P(X ≤ k) or P(X < k), the cumulative distribution function
(cdf) for this distribution evaluated at point k, depending
on the value of the inclusive parameter.
(Inherited from UnivariateDiscreteDistribution.)  
DistributionFunction(Int32, Int32) 
Gets the cumulative distribution function (cdf) for this
distribution in the semiclosed interval (a; b] given as
P(a < X ≤ b).
(Inherited from UnivariateDiscreteDistribution.)  
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 UnivariateDiscreteDistribution.)  
Fit(Int32) 
Fits the underlying distribution to a given set of observations.
(Inherited from UnivariateDiscreteDistribution.)  
Fit(Int32, Double) 
Fits the underlying distribution to a given set of observations.
 
Fit(Double, IFittingOptions) 
Fits the underlying distribution to a given set of observations.
(Inherited from UnivariateDiscreteDistribution.)  
Fit(Double, Double) 
Fits the underlying distribution to a given set of observations.
(Inherited from UnivariateDiscreteDistribution.)  
Fit(Double, Int32) 
Fits the underlying distribution to a given set of observations.
(Inherited from UnivariateDiscreteDistribution.)  
Fit(Int32, IFittingOptions) 
Fits the underlying distribution to a given set of observations.
(Inherited from UnivariateDiscreteDistribution.)  
Fit(Double, Double, IFittingOptions) 
Fits the underlying distribution to a given set of observations.
(Overrides UnivariateDiscreteDistributionFit(Double, Double, IFittingOptions).)  
Fit(Int32, Double, IFittingOptions) 
Fits the underlying distribution to a given set of observations.
(Overrides UnivariateDiscreteDistributionFit(Int32, Double, IFittingOptions).)  
Fit(Double, Int32, IFittingOptions) 
Fits the underlying distribution to a given set of observations.
(Inherited from UnivariateDiscreteDistribution.)  
Fit(Int32, Int32, IFittingOptions) 
Fits the underlying distribution to a given set of observations.
(Inherited from UnivariateDiscreteDistribution.)  
Generate 
Generates a random observation from the current distribution.
(Inherited from UnivariateDiscreteDistribution.)  
Generate(Int32) 
Generates a random vector of observations from the current distribution.
(Inherited from UnivariateDiscreteDistribution.)  
Generate(Int32, Double) 
Generates a random vector of observations from the current distribution.
(Inherited from UnivariateDiscreteDistribution.)  
Generate(Int32, Int32) 
Generates a random vector of observations from the current distribution.
(Inherited from UnivariateDiscreteDistribution.)  
GetHashCode  Serves as the default hash function. (Inherited from Object.)  
GetRange 
Gets the distribution range within a given percentile.
(Inherited from UnivariateDiscreteDistribution.)  
GetType  Gets the Type of the current instance. (Inherited from Object.)  
HazardFunction 
Gets the hazard function, also known as the failure rate or
the conditional failure density function for this distribution
evaluated at point x.
(Inherited from UnivariateDiscreteDistribution.)  
InverseDistributionFunction 
Gets the inverse of the cumulative distribution function (icdf) for
this distribution evaluated at probability p. This function
is also known as the Quantile function.
(Overrides UnivariateDiscreteDistributionInverseDistributionFunction(Double).)  
LogCumulativeHazardFunction 
Gets the logcumulative hazard function for this
distribution evaluated at point x.
(Inherited from UnivariateDiscreteDistribution.)  
LogProbabilityMassFunction 
Gets the logprobability mass function (pmf) for
this distribution evaluated at point x.
(Overrides UnivariateDiscreteDistributionLogProbabilityMassFunction(Int32).)  
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.
(Overrides UnivariateDiscreteDistributionProbabilityMassFunction(Int32).)  
QuantileDensityFunction 
Gets the first derivative of the
inverse distribution function (icdf) for this distribution evaluated
at probability p.
(Inherited from UnivariateDiscreteDistribution.)  
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 binomial distribution is the discrete probability distribution of the number of successes in a sequence of >n independent yes/no experiments, each of which yields success with probability p. Such a success/failure experiment is also called a Bernoulli experiment or Bernoulli trial; when n = 1, the binomial distribution is a Bernoulli distribution.
References:
// Creates a distribution with n = 16 and success probability 0.12 var bin = new BinomialDistribution(trials: 16, probability: 0.12); // Common measures double mean = bin.Mean; // 1.92 double median = bin.Median; // 2 double var = bin.Variance; // 1.6896 double mode = bin.Mode; // 2 // Probability mass functions double pdf = bin.ProbabilityMassFunction(k: 1); // 0.28218979948821621 double lpdf = bin.LogProbabilityMassFunction(k: 0); // 2.0453339441581582 // Cumulative distribution functions double cdf = bin.DistributionFunction(k: 0); // 0.12933699143209909 double ccdf = bin.ComplementaryDistributionFunction(k: 0); // 0.87066300856790091 // Quantile functions int icdf0 = bin.InverseDistributionFunction(p: 0.37); // 1 int icdf1 = bin.InverseDistributionFunction(p: 0.50); // 2 int icdf2 = bin.InverseDistributionFunction(p: 0.99); // 5 int icdf3 = bin.InverseDistributionFunction(p: 0.999); // 7 // Hazard (failure rate) functions double hf = bin.HazardFunction(x: 0); // 1.3809523809523814 double chf = bin.CumulativeHazardFunction(x: 0); // 0.86750056770472328 // String representation string str = bin.ToString(CultureInfo.InvariantCulture); // "Binomial(x; n = 16, p = 0.12)"