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

This module contains algorithms for the Beta Proportion Distribution.
An alternate parameterization of the mir.stat.distribution.beta distribuion in terms of the mean of the distribution and the sum of its shape parameters (also known as the sample size of the Beta distribution).
License:
Authors:
John Michael Hall
pure nothrow @nogc @safe T betaProportionPDF(T)(const T x, const T mu, const T kappa)
if (isFloatingPoint!T);
Computes the beta proportion probability density function (PDF).
Parameters:
T x value to evaluate PDF
T mu shape parameter #1
T kappa shape parameter #2
Examples:
import mir.math.common: approxEqual;

assert(0.5.betaProportionPDF(0.5, 2) == 1);
assert(0.75.betaProportionPDF((1.0 / 3), 3).approxEqual(0.5));
assert(0.25.betaProportionPDF((1.0 / 9), 4.5).approxEqual(0.9228516));
pure nothrow @nogc @safe T betaProportionCDF(T)(const T x, const T mu, const T kappa)
if (isFloatingPoint!T);
Computes the beta proportion cumulatve distribution function (CDF).
Parameters:
T x value to evaluate CDF
T mu shape parameter #1
T kappa shape parameter #2
Examples:
import mir.math.common: approxEqual;

assert(0.5.betaProportionCDF(0.5, 2).approxEqual(0.5));
assert(0.75.betaProportionCDF((1.0 / 3), 3).approxEqual(0.9375));
assert(0.25.betaProportionCDF((1.0 / 9), 4.5).approxEqual(0.8588867));
pure nothrow @nogc @safe T betaProportionCCDF(T)(const T x, const T mu, const T kappa)
if (isFloatingPoint!T);
Computes the beta proportion complementary cumulative distribution function (CCDF).
Parameters:
T x value to evaluate CCDF
T mu shape parameter #1
T kappa shape parameter #2
Examples:
import mir.math.common: approxEqual;

assert(0.5.betaProportionCCDF(0.5, 2).approxEqual(0.5));
assert(0.75.betaProportionCCDF((1.0 / 3), 3).approxEqual(0.0625));
assert(0.25.betaProportionCCDF((1.0 / 9), 4.5).approxEqual(0.1411133));
pure nothrow @nogc @safe T betaProportionInvCDF(T)(const T p, const T mu, const T kappa)
if (isFloatingPoint!T);
Computes the beta proportion inverse cumulative distribution function (InvCDF).
Parameters:
T p value to evaluate InvCDF
T mu shape parameter #1
T kappa shape parameter #2
Examples:
import mir.math.common: approxEqual;

assert(0.5.betaProportionInvCDF(0.5, 2).approxEqual(0.5));
assert(0.9375.betaProportionInvCDF((1.0 / 3), 3).approxEqual(0.75));
assert(0.8588867.betaProportionInvCDF((1.0 / 9), 4.5).approxEqual(0.25));
pure nothrow @nogc @safe T betaProportionLPDF(T)(const T x, const T mu, const T kappa)
if (isFloatingPoint!T);
Computes the beta proportion log probability density function (LPDF).
Parameters:
T x value to evaluate LPDF
T mu shape parameter #1
T kappa shape parameter #2
Examples:
import mir.math.common: approxEqual, log;

assert(0.5.betaProportionLPDF(0.5, 2).approxEqual(log(betaProportionPDF(0.5, 0.5, 2))));
assert(0.75.betaProportionLPDF((1.0 / 3), 3).approxEqual(log(betaProportionPDF(0.75, (1.0 / 3), 3))));
assert(0.25.betaProportionLPDF((1.0 / 9), 4.5).approxEqual(log(betaProportionPDF(0.25, (1.0 / 9), 4.5))));