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

Normal Distribution
Authors:
Stephen L. Moshier, ported to D by Don Clugston and David Nadlinger. Adopted to Mir by Ilya Yaroshenko. This module contains algorithms for the Normal Distribution.
License:
Authors:
John Michael Hall
public import mir.math.func.normal : normalPDF, normalCDF, normalInvCDF;
pure nothrow @nogc @safe T normalCCDF(T)(const T x, const T mean, const T stdDev)
if (isFloatingPoint!T);

pure nothrow @nogc @safe T normalCCDF(T)(const T a)
if (isFloatingPoint!T);
Computes the normal complementary cumulative distribution function (CCDF)
Parameters:
T x value to evaluate CCDF
T mean mean
T stdDev standard deviation
Examples:
import mir.math.common: approxEqual;

assert(0.5.normalCCDF.approxEqual(1 - normalCDF(0.5)));
assert(0.5.normalCCDF(0, 1.5).approxEqual(1 - normalCDF(0.5, 0, 1.5)));
assert(1.5.normalCCDF(1, 3).approxEqual(1 - normalCDF(1.5, 1, 3)));
pure nothrow @nogc @safe T normalLPDF(T)(const T x, const T mean, const T stdDev)
if (isFloatingPoint!T);

pure nothrow @nogc @safe T normalLPDF(T)(const T x)
if (isFloatingPoint!T);
Computes the normal log probability density function (LPDF)
Parameters:
T x value to evaluate LPDF
T mean mean
T stdDev standard deviation
Examples:
import mir.math.common: approxEqual, log;
assert(0.5.normalLPDF.approxEqual(log(normalPDF(0.5))));
assert(0.5.normalLPDF(0, 1.5).approxEqual(log(normalPDF(0.5, 0, 1.5))));
assert(1.5.normalLPDF(1, 3).approxEqual(log(normalPDF(1.5, 1, 3))));