Namespaces

Types in MathNet.Numerics.Distributions

Type Bernoulli

Namespace MathNet.Numerics.Distributions

Interfaces IDiscreteDistribution

Discrete Univariate Bernoulli distribution. The Bernoulli distribution is a distribution over bits. The parameter p specifies the probability that a 1 is generated..

Constructors

Static Functions

Methods

Properties

Public Constructors

Bernoulli(double p, Random randomSource)

Initializes a new instance of the Bernoulli class.
Parameters
double p

The probability (p) of generating one. Range: 0 ≤ p ≤ 1.

Random randomSource

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

Bernoulli(double p)

Initializes a new instance of the Bernoulli class.
Parameters
double p

The probability (p) of generating one. Range: 0 ≤ p ≤ 1.

Public Static Functions

double CDF(double p, double x)

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

The probability (p) of generating one. Range: 0 ≤ p ≤ 1.

double x

The location at which to compute the cumulative distribution function.

Return
double

the cumulative distribution at location x.

bool IsValidParameterSet(double p)

Tests whether the provided values are valid parameters for this distribution.
Parameters
double p

The probability (p) of generating one. Range: 0 ≤ p ≤ 1.

double PMF(double p, int k)

Computes the probability mass (PMF) at k, i.e. P(X = k).
Parameters
double p

The probability (p) of generating one. Range: 0 ≤ p ≤ 1.

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(double p, int k)

Computes the log probability mass (lnPMF) at k, i.e. ln(P(X = k)).
Parameters
double p

The probability (p) of generating one. Range: 0 ≤ p ≤ 1.

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(Random rnd, double p)

Samples a Bernoulli distributed random variable.
Parameters
Random rnd

The random number generator to use.

double p

The probability (p) of generating one. Range: 0 ≤ p ≤ 1.

Return
int

A sample from the Bernoulli distribution.

int Sample(double p)

Samples a Bernoulli distributed random variable.
Parameters
double p

The probability (p) of generating one. Range: 0 ≤ p ≤ 1.

Return
int

A sample from the Bernoulli distribution.

void Samples(Int32[] values, double p)

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

The array to fill with the samples.

double p

The probability (p) of generating one. Range: 0 ≤ p ≤ 1.

Return
void

a sequence of samples from the distribution.

void Samples(Random rnd, Int32[] values, double p)

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.

double p

The probability (p) of generating one. Range: 0 ≤ p ≤ 1.

Return
void

a sequence of samples from the distribution.

IEnumerable<int> Samples(Random rnd, double p)

Samples a sequence of Bernoulli distributed random variables.
Parameters
Random rnd

The random number generator to use.

double p

The probability (p) of generating one. Range: 0 ≤ p ≤ 1.

Return
IEnumerable<int>

a sequence of samples from the distribution.

IEnumerable<int> Samples(double p)

Samples a sequence of Bernoulli distributed random variables.
Parameters
double p

The probability (p) of generating one. Range: 0 ≤ p ≤ 1.

Return
IEnumerable<int>

a sequence of samples from the distribution.

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 Bernoulli distributed random variable.
Return
int

A sample from the Bernoulli distribution.

IEnumerable<int> Samples()

Samples an array of Bernoulli distributed random variables.
Return
IEnumerable<int>

a sequence of samples from the distribution.

void Samples(Int32[] values)

Fills an array with samples generated from the distribution.

string ToString()

A string representation of the distribution.
Return
string

a string representation of the distribution.

Public Properties

double Entropy get;

Gets the entropy of the distribution.

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.

double Median get;

Gets the median of the distribution.

int Minimum get;

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

int Mode get;

Gets the mode of the distribution.

Int32[] Modes get;

Gets all modes of the distribution.

double P get;

Gets the probability of generating a one. Range: 0 ≤ p ≤ 1.

Random RandomSource get; set;

Gets or sets the random number generator which is used to draw random samples.

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.