Logarithm of Cumulative Distribution Function

Evaluate the logarithm of the cumulative distribution function Planck (discrete exponential) distribution.

The cumulative distribution function for a Planck random variable is

upper F left-parenthesis x semicolon lamda right-parenthesis equals 1 minus e Superscript negative lamda dot left-parenthesis left floor x right floor plus 1 right-parenthesis

where λ is the shape parameter and x denotes the count of events in a quantized system.

Usage

var logcdf = require( '@stdlib/stats/base/dists/planck/logcdf' );

logcdf( x, lambda )

Evaluates the logarithm of the cumulative distribution function for a Planck (discrete exponential) distribution with shape parameter lambda.

var y = logcdf( 2.0, 0.5 );
// returns ~-0.2525

y = logcdf( 2.0, 1.5 );
// returns ~-0.0112

If provided NaN as any argument, the function returns NaN.

var y = logcdf( NaN, 0.5 );
// returns NaN

y = logcdf( 0.0, NaN );
// returns NaN

If provided a shape parameter lambda which is nonpositive, the function returns NaN.

var y = logcdf( 2.0, -1.0 );
// returns NaN

logcdf.factory( lambda )

Returns a function for evaluating the logarithm of the cumulative distribution function of a Planck (discrete exponential) distribution with shape parameter lambda.

var mylogcdf = logcdf.factory( 1.5 );
var y = mylogcdf( 3.0 );
// returns ~-0.0025

y = mylogcdf( 1.0 );
// returns ~-0.0511

Notes

  • In virtually all cases, using the logpmf or logcdf functions is preferable to manually computing the logarithm of the pmf or cdf, respectively, since the latter is prone to overflow and underflow.

Examples

var discreteUniform = require( '@stdlib/random/array/discrete-uniform' );
var uniform = require( '@stdlib/random/array/uniform' );
var logcdf = require( '@stdlib/stats/base/dists/planck/logcdf' );

var x = discreteUniform( 10, 0, 5 );
var lambda = uniform( 10, 0.1, 5.0 );

var y;
var i;
for ( i = 0; i < lambda.length; i++ ) {
    y = logcdf( x[ i ], lambda[ i ] );
    console.log( 'x: %d, λ: %d, ln(F(x;λ)): %d', x[ i ].toFixed( 4 ), lambda[ i ].toFixed( 4 ), y.toFixed( 4 ) );
}
Did you find this page helpful?