Cumulative Distribution Function

Planck (discrete exponential) distribution cumulative distribution function.

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 cdf = require( '@stdlib/stats/base/dists/planck/cdf' );

cdf( x, lambda )

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

var y = cdf( 2.0, 0.5 );
// returns ~0.7769

y = cdf( 2.0, 1.5 );
// returns ~0.9889

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

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

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

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

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

cdf.factory( lambda )

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

var mycdf = cdf.factory( 1.5 );
var y = mycdf( 3.0 );
// returns ~0.9975

y = mycdf( 1.0 );
// returns ~0.9502

Examples

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

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 = cdf( x[ i ], lambda[ i ] );
    console.log( 'x: %d, λ: %d, F(x;λ): %d', x[ i ].toFixed( 4 ), lambda[ i ].toFixed( 4 ), y.toFixed( 4 ) );
}
Did you find this page helpful?