BinomialDistribution Constructor

Definition

Namespace: Numerics.NET.Statistics.Distributions
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 9.0.0

Overload List

BinomialDistribution(Int32) Constructs a new BinomialDistribution with the specified number of trials. The probability of success is set to 0.5.
BinomialDistribution(Vector<Double>) Estimates the parameters of the distribution of a variable assuming it follows a binomial distribution.
BinomialDistribution(Int32, Vector<Double>) Estimates the parameters of the distribution of a variable assuming it follows a binomial distribution.
BinomialDistribution(Int32, Double) Constructs a new BinomialDistribution with the specified number of trials and probability of success.

BinomialDistribution(Int32)

Constructs a new BinomialDistribution with the specified number of trials. The probability of success is set to 0.5.
C#
public BinomialDistribution(
	int numberOfTrials
)

Parameters

numberOfTrials  Int32
The number of trials.

Remarks

The number of trials must be greater than or equal to 0. The probability of success is taken to be 0.5.

The resulting distribution is that of the number of heads or tails in a series of numberOfTrials coin tosses.

Exceptions

ArgumentOutOfRangeException

numberOfTrials is less than zero.

BinomialDistribution(Vector<Double>)

Estimates the parameters of the distribution of a variable assuming it follows a binomial distribution.
C#
public BinomialDistribution(
	Vector<double> variable
)

Parameters

variable  Vector<Double>
A vector.

Return Value

The BinomialDistribution that best matches the distribution of variable.

Remarks

Use this constructor to create a BinomialDistribution whose parameter is estimated from variable.

Exceptions

ArgumentNullException

variable is null.

ArgumentException

The mean of variable is less than zero. Samples from a binomial distribution cannot be negative.

BinomialDistribution(Int32, Vector<Double>)

Estimates the parameters of the distribution of a variable assuming it follows a binomial distribution.
C#
public BinomialDistribution(
	int numberOfTrials,
	Vector<double> variable
)

Parameters

numberOfTrials  Int32
The number of trials.
variable  Vector<Double>
A vector.

Return Value

The BinomialDistribution that best matches the distribution of variable.

Remarks

Use this constructor to create a BinomialDistribution whose parameter is estimated from variable.

Exceptions

ArgumentNullException

variable is null.

ArgumentOutOfRangeException

numberOfTrials is less than zero.

ArgumentException

The mean of variable is less than zero. Samples from a binomial distribution cannot be negative.

BinomialDistribution(Int32, Double)

Constructs a new BinomialDistribution with the specified number of trials and probability of success.
C#
public BinomialDistribution(
	int numberOfTrials,
	double probabilityOfSuccess
)

Parameters

numberOfTrials  Int32
The number of trials.
probabilityOfSuccess  Double
The probability of a trial resulting in success.

Remarks

The number of trials must be greater than or equal to 0. The probability of success must be between 0 and 1.

Exceptions

ArgumentOutOfRangeException

numberOfTrials is less than or equal to zero.

-or-

probabilityOfSuccess is less than zero or greater than 1.

See Also