UNPKG

@stdlib/stats

Version:

Standard library statistical functions.

66 lines (51 loc) 1.34 kB
{{alias}}( x, p ) Evaluates the logarithm of the cumulative distribution function (CDF) for a geometric distribution with success probability `p` at a value `x`. If provided `NaN` as any argument, the function returns `NaN`. If `p < 0` or `p > 1`, the function returns `NaN`. Parameters ---------- x: number Input value. p: number Success probability. Returns ------- out: number Evaluated logCDF. Examples -------- > var y = {{alias}}( 2.0, 0.5 ) ~-0.134 > y = {{alias}}( 2.0, 0.1 ) ~-1.306 > y = {{alias}}( -1.0, 4.0 ) -Infinity > y = {{alias}}( NaN, 0.5 ) NaN > y = {{alias}}( 0.0, NaN ) NaN // Invalid probability > y = {{alias}}( 2.0, 1.4 ) NaN {{alias}}.factory( p ) Returns a function for evaluating the logarithm of the cumulative distribution function (CDF) of a geometric distribution with success probability `p`. Parameters ---------- p: number Success probability. Returns ------- logcdf: Function Logarithm of cumulative distribution function (CDF). Examples -------- > var mylogcdf = {{alias}}.factory( 0.5 ); > var y = mylogcdf( 3.0 ) ~-0.065 > y = mylogcdf( 1.0 ) ~-0.288 See Also --------