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.uniform_discrete
This module contains algorithms for the Discrete Uniform Distribution.
License:
Authors:
John Michael Hall
- pure nothrow @nogc @safe double
uniformDiscretePMF
(const size_tx
, const size_tlower
= 0, const size_tupper
= 1); - Computes the discrete uniform probability mass function (PMF).Parameters:
size_t x
value to evaluate PMF size_t lower
lower bound size_t upper
upper bound See Also:Examples:import mir.test: shouldApprox; 1.uniformDiscretePMF.shouldApprox == 0.5; 2.uniformDiscretePMF(1, 3).shouldApprox == 1.0 / 3;
- pure nothrow @nogc @safe double
uniformDiscreteCDF
(const size_tx
, const size_tlower
= 0, const size_tupper
= 1); - Computes the discrete uniform cumulative distribution function (CDF).Parameters:
size_t x
value to evaluate CDF size_t lower
lower bound size_t upper
upper bound See Also:Examples:import mir.test: shouldApprox; 0.uniformDiscreteCDF.shouldApprox == 0.5; 1.uniformDiscreteCDF.shouldApprox == 1.0; 1.uniformDiscreteCDF(1, 3).shouldApprox == 1.0 / 3; 2.uniformDiscreteCDF(1, 3).shouldApprox == 2.0 / 3; 3.uniformDiscreteCDF(1, 3).shouldApprox == 1.0;
- pure nothrow @nogc @safe double
uniformDiscreteCCDF
(const size_tx
, const size_tlower
= 0, const size_tupper
= 1); - Computes the discrete uniform complementary cumulative distribution function (CCDF).Parameters:
size_t x
value to evaluate CCDF size_t lower
lower bound size_t upper
upper bound See Also:Examples:import mir.test: shouldApprox; 0.uniformDiscreteCCDF.shouldApprox == 0.5; 1.uniformDiscreteCCDF.shouldApprox == 0.0; 1.uniformDiscreteCCDF(1, 3).shouldApprox == 2.0 / 3; 2.uniformDiscreteCCDF(1, 3).shouldApprox == 1.0 / 3; 3.uniformDiscreteCCDF(1, 3).shouldApprox == 0.0;
- pure nothrow @nogc @safe size_t
uniformDiscreteInvCDF
(T)(const Tp
, const size_tlower
= 0, const size_tupper
= 1)
if (isFloatingPoint!T); - Computes the discrete uniform inverse cumulative distribution function (InvCDF)Parameters:
T p
value to evaluate InvCDF size_t lower
lower bound size_t upper
upper bound See Also:Examples:.import mir.test: should; 0.0.uniformDiscreteInvCDF.should == 0; 0.5.uniformDiscreteInvCDF.should == 0; 1.0.uniformDiscreteInvCDF.should == 1; 0.0.uniformDiscreteInvCDF(1, 3).should == 1; 0.2.uniformDiscreteInvCDF(1, 3).should == 1; (1.0 / 3).uniformDiscreteInvCDF(1, 3).should == 1; 0.5.uniformDiscreteInvCDF(1, 3).should == 1; (2.0 / 3).uniformDiscreteInvCDF(1, 3).should == 2; 1.0.uniformDiscreteInvCDF(1, 3).should == 3;
- pure nothrow @nogc @safe double
uniformDiscreteLPMF
(const size_tx
, const size_tlower
= 0, const size_tupper
= 1); - Computes the discrete uniform log probability distribution function (LPDF)Parameters:
size_t x
value to evaluate LPDF size_t lower
lower bound size_t upper
upper bound See Also:Examples:import mir.math.common: log; import mir.test: shouldApprox; 1.uniformDiscreteLPMF.shouldApprox == -log(2.0); 2.uniformDiscreteLPMF(1, 3).shouldApprox == -log(3.0);
Copyright © 2016-2023 by Ilya Yaroshenko | Page generated by
Ddoc on Wed Oct 18 12:23:06 2023