Report a bug
If you spot a problem with this page, click here to create a GitHub issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using a local clone.

mir.stat.distribution.exponential

This module contains algorithms for the Exponential Distribution.
License:
Authors:
John Michael Hall
pure nothrow @nogc @safe T exponentialPDF(T)(const T x, const T lambda)
if (isFloatingPoint!T);
Computes the exponential probability density function (PDF).
Parameters:
T x value to evaluate PDF
T lambda number of events in an interval
Examples:
import mir.math.common: approxEqual;

assert(0.5.exponentialPDF(2.0).approxEqual(0.7357589));
assert(0.75.exponentialPDF(2.0).approxEqual(0.4462603));
assert(0.25.exponentialPDF(0.5).approxEqual(0.4412485));
pure nothrow @nogc @safe T exponentialCDF(T)(const T x, const T lambda)
if (isFloatingPoint!T);
Computes the exponential cumulative distribution function (CDF).
Parameters:
T x value to evaluate CDF
T lambda number of events in an interval
Examples:
import mir.math.common: approxEqual;

assert(0.5.exponentialCDF(2.0).approxEqual(0.6321206));
assert(0.75.exponentialCDF(2.0).approxEqual(0.7768698));
assert(0.25.exponentialCDF(0.5).approxEqual(0.1175031));
pure nothrow @nogc @safe T exponentialCCDF(T)(const T x, const T lambda)
if (isFloatingPoint!T);
Computes the exponential complementary cumulative distribution function (CCDF).
Parameters:
T x value to evaluate CCDF
T lambda number of events in an interval
Examples:
import mir.math.common: approxEqual;

assert(0.5.exponentialCCDF(2.0).approxEqual(1 - exponentialCDF(0.5, 2.0)));
assert(0.75.exponentialCCDF(2.0).approxEqual(1 - exponentialCDF(0.75, 2.0)));
assert(0.25.exponentialCCDF(0.5).approxEqual(1 - exponentialCDF(0.25, 0.5)));
pure nothrow @nogc @safe T exponentialInvCDF(T)(const T p, const T lambda)
if (isFloatingPoint!T);
Computes the exponential inverse cumulative distribution function (InvCDF).
Parameters:
T p value to evaluate InvCDF
T lambda number of events in an interval
Examples:
import mir.math.common: approxEqual;

assert(0.6321206.exponentialInvCDF(2.0).approxEqual(0.5));
assert(0.7768698.exponentialInvCDF(2.0).approxEqual(0.75));
assert(0.1175031.exponentialInvCDF(0.5).approxEqual(0.25));
pure nothrow @nogc @safe T exponentialLPDF(T)(const T x, const T lambda)
if (isFloatingPoint!T);
Computes the exponential log probability density function (LPDF).
Parameters:
T x value to evaluate LPDF
T lambda number of events in an interval
Examples:
import mir.math.common: approxEqual, log;

assert(0.5.exponentialLPDF(2.0).approxEqual(log(exponentialPDF(0.5, 2.0))));
assert(0.75.exponentialLPDF(2.0).approxEqual(log(exponentialPDF(0.75, 2.0))));
assert(0.25.exponentialLPDF(0.5).approxEqual(log(exponentialPDF(0.25, 0.5))));