@stdlib/stats
Version:
Standard library statistical functions.
76 lines (59 loc) • 1.53 kB
Plain Text
{{alias}}( x, a, b )
Evaluates the natural logarithm of the probability mass function (PMF) for a
discrete uniform distribution with minimum support `a` and maximum support
`b` at a value `x`.
If `a > b`, the function returns `NaN`.
If `a` or `b` is not an integer value, the function returns `NaN`.
Parameters
----------
x: number
Input value.
a: integer
Minimum support.
b: integer
Maximum support.
Returns
-------
out: number
Evaluated logPMF.
Examples
--------
> var y = {{alias}}( 2.0, 0, 4 )
~-1.609
> y = {{alias}}( 5.0, 0, 4 )
-Infinity
> y = {{alias}}( 3.0, -4, 4 )
~-2.197
> y = {{alias}}( NaN, 0, 1 )
NaN
> y = {{alias}}( 0.0, NaN, 1 )
NaN
> y = {{alias}}( 0.0, 0, NaN )
NaN
> y = {{alias}}( 2.0, 3, 1 )
NaN
> y = {{alias}}( 2.0, 1, 2.4 )
NaN
{{alias}}.factory( a, b )
Returns a function for evaluating the natural logarithm of the probability
mass function (PMF) of a discrete uniform distribution with minimum support
`a` and maximum support `b`.
Parameters
----------
a: integer
Minimum support.
b: integer
Maximum support.
Returns
-------
logpmf: Function
Logarithm of probability mass function (PMF).
Examples
--------
> var myLogPMF = {{alias}}.factory( 6, 7 );
> var y = myLogPMF( 7.0 )
~-0.693
> y = myLogPMF( 5.0 )
-Infinity
See Also
--------