## Types in MathNet.Numerics.Distributions

Type BetaBinomial

Namespace MathNet.Numerics.Distributions

Interfaces IDiscreteDistribution

Discrete Univariate Beta-Binomial distribution. The beta-binomial distribution is a family of discrete probability distributions on a finite support of non-negative integers arising when the probability of success in each of a fixed or known number of Bernoulli trials is either unknown or random. The beta-binomial distribution is the binomial distribution in which the probability of success at each of n trials is not fixed but randomly drawn from a beta distribution. It is frequently used in Bayesian statistics, empirical Bayes methods and classical statistics to capture overdispersion in binomial type distributed data..

### Public Constructors

#### BetaBinomial(int n, double a, double b, Random randomSource)

Initializes a new instance of the BetaBinomial class.
##### Parameters
###### `int` n

The number of Bernoulli trials n - n is a positive integer

###### `double` a

Shape parameter alpha of the Beta distribution. Range: a > 0.

###### `double` b

Shape parameter beta of the Beta distribution. Range: b > 0.

###### `Random` randomSource

The random number generator which is used to draw random samples.

#### BetaBinomial(int n, double a, double b)

Initializes a new instance of the BetaBinomial class.
##### Parameters
###### `int` n

The number of Bernoulli trials n - n is a positive integer

###### `double` a

Shape parameter alpha of the Beta distribution. Range: a > 0.

###### `double` b

Shape parameter beta of the Beta distribution. Range: b > 0.

### Public Static Functions

#### doubleCDF(int n, double a, double b, int x)

Computes the cumulative distribution (CDF) of the distribution at x, i.e. P(X ≤ x).
##### Parameters
###### `int` n

The number of Bernoulli trials n - n is a positive integer

###### `double` a

Shape parameter alpha of the Beta distribution. Range: a > 0.

###### `double` b

Shape parameter beta of the Beta distribution. Range: b > 0.

###### `int` x

The location at which to compute the cumulative distribution function.

##### Return
###### `double`

the cumulative distribution at location x.

#### boolIsValidParameterSet(int n, double a, double b)

Tests whether the provided values are valid parameters for this distribution.
##### Parameters
###### `int` n

The number of Bernoulli trials n - n is a positive integer

###### `double` a

Shape parameter alpha of the Beta distribution. Range: a > 0.

###### `double` b

Shape parameter beta of the Beta distribution. Range: b > 0.

#### boolIsValidParameterSet(int n, double a, double b, int k)

Tests whether the provided values are valid parameters for this distribution.
##### Parameters
###### `int` n

The number of Bernoulli trials n - n is a positive integer

###### `double` a

Shape parameter alpha of the Beta distribution. Range: a > 0.

###### `double` b

Shape parameter beta of the Beta distribution. Range: b > 0.

###### `int` k

The location in the domain where we want to evaluate the probability mass function.

#### doublePMF(int n, double a, double b, int k)

Computes the probability mass (PMF) at k, i.e. P(X = k).
##### Parameters
###### `int` n

The number of Bernoulli trials n - n is a positive integer

###### `double` a

Shape parameter alpha of the Beta distribution. Range: a > 0.

###### `double` b

Shape parameter beta of the Beta distribution. Range: b > 0.

###### `int` k

The location in the domain where we want to evaluate the probability mass function.

##### Return
###### `double`

the probability mass at location k.

#### doublePMFLn(int n, double a, double b, int k)

Computes the log probability mass (lnPMF) at k, i.e. ln(P(X = k)).
##### Parameters
###### `int` n

The number of Bernoulli trials n - n is a positive integer

###### `double` a

Shape parameter alpha of the Beta distribution. Range: a > 0.

###### `double` b

Shape parameter beta of the Beta distribution. Range: b > 0.

###### `int` k

The location in the domain where we want to evaluate the probability mass function.

##### Return
###### `double`

the log probability mass at location k.

### Public Methods

#### doubleCumulativeDistribution(double x)

Computes the cumulative distribution (CDF) of the distribution at x, i.e. P(X ≤ x).
##### Parameters
###### `double` x

The location at which to compute the cumulative distribution function.

##### Return
###### `double`

the cumulative distribution at location x

#### doubleProbability(int k)

Computes the probability mass (PMF) at k, i.e. P(X = k).
##### Parameters
###### `int` k

The location in the domain where we want to evaluate the probability mass function.

##### Return
###### `double`

the probability mass at location k.

#### doubleProbabilityLn(int k)

Computes the log probability mass (lnPMF) at k, i.e. ln(P(X = k)).
##### Parameters
###### `int` k

The location in the domain where we want to evaluate the log probability mass function.

##### Return
###### `double`

the log probability mass at location k.

#### intSample()

Samples a `BetaBinomial` distributed random variable.
##### Return
###### `int`

a sample from the distribution.

#### intSample(Random rnd, int n, double a, double b)

Samples a `BetaBinomial` distributed random variable.
##### Parameters
###### `Random` rnd

The random number generator to use.

###### `int` n

The number of trials (n). Range: n ≥ 0.

###### `double` a

The α shape parameter of the Beta distribution. Range: α ≥ 0.

###### `double` b

The β shape parameter of the Beta distribution. Range: β ≥ 0.

##### Return
###### `int`

a sample from the distribution.

#### voidSamples(Int32[] values)

Fills an array with samples generated from the distribution.

#### IEnumerable<int>Samples(int n, double a, double b)

Samples an array of `BetaBinomial` distributed random variables.
##### Parameters
###### `int` n

The number of trials (n). Range: n ≥ 0.

###### `double` a

The α shape parameter of the Beta distribution. Range: α ≥ 0.

###### `double` b

The β shape parameter of the Beta distribution. Range: β ≥ 0.

##### Return
###### `IEnumerable<int>`

a sequence of samples from the distribution.

#### voidSamples(Random rnd, Int32[] values, int n, double a, double b)

Fills an array with samples generated from the distribution.
##### Parameters
###### `Random` rnd

The random number generator to use.

###### `Int32[]` values

The array to fill with the samples.

###### `int` n

The number of trials (n). Range: n ≥ 0.

###### `double` a

The α shape parameter of the Beta distribution. Range: α ≥ 0.

###### `double` b

The β shape parameter of the Beta distribution. Range: β ≥ 0.

#### IEnumerable<int>Samples()

Samples an array of `BetaBinomial` distributed random variables.
##### Return
###### `IEnumerable<int>`

a sequence of samples from the distribution.

#### voidSamples(Int32[] values, int n, double a, double b)

Fills an array with samples generated from the distribution.
##### Parameters
###### `Int32[]` values

The array to fill with the samples.

###### `int` n

The number of trials (n). Range: n ≥ 0.

###### `double` a

The α shape parameter of the Beta distribution. Range: α ≥ 0.

###### `double` b

The β shape parameter of the Beta distribution. Range: β ≥ 0.

#### stringToString()

Returns a String that represents this instance.
##### Return
###### `string`

A String that represents this instance.

### Public Properties

#### intMaximum get;

Gets the largest element in the domain of the distributions which can be represented by an integer.

#### doubleMean get;

Gets the mean of the distribution.

#### intMinimum get;

Gets the smallest element in the domain of the distributions which can be represented by an integer.

#### doubleSkewness get;

Gets the skewness of the distribution.

#### doubleStdDev get;

Gets the standard deviation of the distribution.

#### doubleVariance get;

Gets the variance of the distribution.