The OpenD Programming Language

dstats.distrib

Probability distribution CDFs, PDFs/PMFs, and a few inverse CDFs. * * Authors: David Simcha, Don Clugston

Members

Functions

betaCDF
double betaCDF(double x, double alpha, double beta)
betaCDFR
double betaCDFR(double x, double alpha, double beta)
betaPDF
double betaPDF(double x, double alpha, double beta)
binomialCDF
double binomialCDF(ulong k, ulong n, double p)

P(K <= k) where K is random variable.

binomialCDFR
double binomialCDFR(ulong k, ulong n, double p)

P(K >= k) where K is random variable.

binomialPMF
double binomialPMF(ulong k, ulong n, double p)
cauchyCDF
double cauchyCDF(double X, double X0, double gamma)
cauchyCDFR
double cauchyCDFR(double X, double X0, double gamma)
cauchyPDF
double cauchyPDF(double X, double X0, double gamma)
chiSquareCDF
double chiSquareCDF(double x, double v)

&chi;2 distribution function and its complement.

chiSquareCDFR
double chiSquareCDFR(double x, double v)
chiSquarePDF
double chiSquarePDF(double x, double v)
dirichletPDF
double dirichletPDF(X x, A alpha)

The Dirichlet probability density.

exponentialCDF
double exponentialCDF(double x, double lambda)
exponentialCDFR
double exponentialCDFR(double x, double lambda)
exponentialPDF
double exponentialPDF(double x, double lambda)
fisherCDF
double fisherCDF(double x, double df1, double df2)
fisherCDFR
double fisherCDFR(double x, double df1, double df2)

The Fisher distribution, its complement, and inverse.

gammaCDF
double gammaCDF(double x, double rate, double shape)
gammaCDFR
double gammaCDFR(double x, double rate, double shape)
gammaPDF
double gammaPDF(double x, double rate, double shape)
hypergeometricCDF
double hypergeometricCDF(long x, long n1, long n2, long n)

P(X <= x), where X is random variable. Uses either direct summation, * normal or binomial approximation depending on parameters.

hypergeometricCDFR
double hypergeometricCDFR(ulong x, ulong n1, ulong n2, ulong n)

P(X >= x), where X is random variable.

hypergeometricPMF
double hypergeometricPMF(long x, long n1, long n2, long n)
invBetaCDF
double invBetaCDF(double p, double alpha, double beta)
invBinomialCDF
uint invBinomialCDF(double pVal, uint n, double p)

Returns the value of k for the given p-value, n and p. If p-value does * not exactly map to a value of k, the value for which binomialCDF(k, n, p) * is closest to pVal is used.

invCauchyCDF
double invCauchyCDF(double p, double X0, double gamma)
invChiSquareCDFR
double invChiSquareCDFR(double v, double p)

Inverse of complemented &chi;2 distribution

invExponentialCDF
double invExponentialCDF(double p, double lambda)
invFisherCDFR
double invFisherCDFR(double df1, double df2, double p)

* Inverse of complemented Fisher distribution * * Finds the F density argument x such that the integral * from x to infinity of the F density is equal to the * given probability p. * * This is accomplished using the inverse beta integral * function and the relations * * z = betaIncompleteInverse( df2/2, df1/2, p ), * x = df2 (1-z) / (df1 z). * * Note that the following relations hold for the inverse of * the uncomplemented F distribution: * * z = betaIncompleteInverse( df1/2, df2/2, p ), * x = df2 z / (df1 (1-z)).

invGammaCDF
double invGammaCDF(double p, double rate, double shape)

This just calls invGammaCDFR w/ 1 - p b/c invGammaCDFR is more accurate, but this function is necessary for consistency.

invGammaCDFR
double invGammaCDFR(double p, double rate, double shape)
invLaplaceCDF
double invLaplaceCDF(double p, double mu, double b)
invNegBinomCDF
ulong invNegBinomCDF(double pVal, ulong n, double p)
invNormalCDF
double invNormalCDF(double p, double mean, double sd)

Inverse of Normal distribution function

invPoissonCDF
uint invPoissonCDF(double pVal, double lambda)

Returns the value of k for the given p-value and lambda. If p-val * doesn't exactly map to a value of k, the k for which poissonCDF(k, lambda) * is closest to pVal is used.

invStudentsTCDF
double invStudentsTCDF(double p, double df)

Inverse of Student's t distribution

kolmogorovDistrib
double kolmogorovDistrib(double x)

Kolmogorov distribution. Used in Kolmogorov-Smirnov testing.

laplaceCDF
double laplaceCDF(double X, double mu, double b)
laplaceCDFR
double laplaceCDFR(double X, double mu, double b)
laplacePDF
double laplacePDF(double x, double mu, double b)
logNormalCDF
double logNormalCDF(double x, double mu, double sigma)
logNormalCDFR
double logNormalCDFR(double x, double mu, double sigma)
logNormalPDF
double logNormalPDF(double x, double mu, double sigma)
negBinomCDF
double negBinomCDF(ulong k, ulong n, double p)

Negative binomial distribution.

negBinomCDFR
double negBinomCDFR(ulong k, ulong n, double p)

Probability that k or more failures precede the nth success.

negBinomPMF
double negBinomPMF(ulong k, ulong n, double p)
normalCDF
double normalCDF(double x, double mean, double stdev)

P(X < x) for normal distribution where X is random var.

normalCDFR
double normalCDFR(double x, double mean, double stdev)

P(X > x) for normal distribution where X is random var.

normalPDF
double normalPDF(double x, double mean, double sd)
paramFunctor
ParamFunctor!(distrib) paramFunctor(ParameterTypeTuple!(distrib)[1..$] parameters)

Takes a distribution function (CDF or PDF/PMF) as a template argument, and * parameters as function arguments in the order that they appear in the * function declaration and returns a functor that binds the supplied * parameters to the distribution function. Assumes the non-parameter * argument is the first argument to the distribution function. * * Examples: * --- * auto stdNormal = paramFunctor!(normalCDF)(0.0L, 1.0L); * --- * * stdNormal is now a functor for the normal(0, 1) distribution.

parametrize
double delegate(ParameterTypeTuple!(distrib)[0]) parametrize(ParameterTypeTuple!(distrib)[1..$] parameters)

Takes a distribution function (CDF or PDF/PMF) as a template argument, and * parameters as function arguments in the order that they appear in the * function declaration and returns a delegate that binds the supplied * parameters to the distribution function. Assumes the non-parameter * argument is the first argument to the distribution function. * * Examples: * --- * auto stdNormal = parametrize!(normalCDF)(0.0L, 1.0L); * --- * * stdNormal is now a delegate for the normal(0, 1) distribution.

poissonCDF
double poissonCDF(ulong k, double lambda)

P(K <= k) where K is r.v.

poissonCDFR
double poissonCDFR(ulong k, double lambda)

P(K >= k) where K is r.v.

poissonPMF
double poissonPMF(ulong k, double lambda)
studentsTCDF
double studentsTCDF(double t, double df)
studentsTCDFR
double studentsTCDFR(double t, double df)
studentsTPDF
double studentsTPDF(double t, double df)
uniformCDF
double uniformCDF(double X, double lower, double upper)
uniformCDFR
double uniformCDFR(double X, double lower, double upper)
uniformPDF
double uniformPDF(double X, double lower, double upper)
weibullCDF
double weibullCDF(double x, double shape, double scale)
weibullCDFR
double weibullCDFR(double x, double shape, double scale)
weibullPDF
double weibullPDF(double x, double shape, double scale)

Structs

ParamFunctor
struct ParamFunctor(alias distrib)

Meta