Namespaces

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..

Constructors

Static Functions

Methods

Properties

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

double CDF(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.

bool IsValidParameterSet(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.

bool IsValidParameterSet(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.

double PMF(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.

double PMFLn(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

double CumulativeDistribution(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

bool Equals(object obj)

int GetHashCode()

Type GetType()

double Probability(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.

double ProbabilityLn(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.

int Sample()

Samples a BetaBinomial distributed random variable.
Return
int

a sample from the distribution.

int Sample(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.

void Samples(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.

void Samples(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.

void Samples(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.

string ToString()

Returns a String that represents this instance.
Return
string

A String that represents this instance.

Public Properties

double A get;

double B get;

int Maximum get;

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

double Mean get;

Gets the mean of the distribution.

int Minimum get;

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

int N get;

Random RandomSource get; set;

double Skewness get;

Gets the skewness of the distribution.

double StdDev get;

Gets the standard deviation of the distribution.

double Variance get;

Gets the variance of the distribution.