@stdlib/stats-base-dists-bradford-cdf
v0.1.1
Published
Bradford distribution cumulative distribution function (CDF).
Readme
Cumulative Distribution Function
Bradford distribution cumulative distribution function (CDF).
The cumulative distribution function (CDF) for a Bradford random variable is
where c > 0 is the shape parameter of the distribution.
Installation
npm install @stdlib/stats-base-dists-bradford-cdfUsage
var cdf = require( '@stdlib/stats-base-dists-bradford-cdf' );cdf( x, c )
Evaluates the cumulative distribution function (CDF) for a Bradford distribution with shape parameter c at a value x.
var y = cdf( 0.1, 0.1 );
// returns ~0.104
y = cdf( 0.5, 5.0 );
// returns ~0.699
y = cdf( 1.0, 10.0 );
// returns 1.0
y = cdf( -0.5, 1.0 );
// returns 0.0
y = cdf( 2.0, 1.0 );
// returns 1.0If provided NaN as any argument, the function returns NaN.
var y = cdf( NaN, 1.0 );
// returns NaN
y = cdf( 0.0, NaN );
// returns NaNIf provided a shape parameter c <= 0, the function returns NaN.
var y = cdf( 0.0, 0.0 );
// returns NaN
y = cdf( 0.5, -5.0 );
// returns NaNcdf.factory( c )
Returns a function for evaluating the CDF of a Bradford distribution with shape parameter c.
var myCDF = cdf.factory( 5.0 );
var y = myCDF( 0.5 );
// returns ~0.699
y = myCDF( 1.0 );
// returns 1.0Examples
var uniform = require( '@stdlib/random-array-uniform' );
var logEachMap = require( '@stdlib/console-log-each-map' );
var cdf = require( '@stdlib/stats-base-dists-bradford-cdf' );
var opts = {
'dtype': 'float64'
};
var x = uniform( 10, 0.0, 1.0, opts );
var c = uniform( 10, 0.1, 10.0, opts );
logEachMap( 'x: %0.4f, c: %0.4f, F(x;c): %0.4f', x, c, cdf );C APIs
Usage
#include "stdlib/stats/base/dists/bradford/cdf.h"stdlib_base_dists_bradford_cdf( x, c )
Evaluates the cumulative distribution function for a Bradford distribution.
double out = stdlib_base_dists_bradford_cdf( 0.5, 5.0 );
// returns ~0.699The function accepts the following arguments:
- x:
[in] doubleinput value. - c:
[in] doubleshape parameter.
double stdlib_base_dists_bradford_cdf( const double x, const double c );Examples
#include "stdlib/stats/base/dists/bradford/cdf.h"
#include <stdlib.h>
#include <stdio.h>
static double random_uniform( const double min, const double max ) {
double v = (double)rand() / ( (double)RAND_MAX + 1.0 );
return min + ( v*(max-min) );
}
int main( void ) {
double x;
double c;
double y;
int i;
for ( i = 0; i < 10; i++ ) {
x = random_uniform( 0.0, 1.0 );
c = random_uniform( 0.01, 10.0 );
y = stdlib_base_dists_bradford_cdf( x, c );
printf( "x: %lf, c: %lf, F(x;c): %lf\n", x, c, y );
}
}Notice
This package is part of stdlib, a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more.
For more information on the project, filing bug reports and feature requests, and guidance on how to develop stdlib, see the main project repository.
Community
License
See LICENSE.
Copyright
Copyright © 2016-2026. The Stdlib Authors.
