0.2.1 • Published 2 months ago

@stdlib/stats-base-dists-studentized-range-cdf v0.2.1

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
2 months ago

Cumulative Distribution Function

NPM version Build Status Coverage Status

Studentized range distribution cumulative distribution function (CDF).

Installation

npm install @stdlib/stats-base-dists-studentized-range-cdf

Usage

var cdf = require( '@stdlib/stats-base-dists-studentized-range-cdf' );

cdf( x, r, v[, nranges=1] )

Evaluates the cumulative distribution function (CDF) for a studentized range distribution with sample size r and v degrees of freedom. Optionally, the number of groups whose maximum range is considered can be specified via the nranges parameter.

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

y = cdf( 12.1, 17.0, 2.0 );
// returns ~0.913

y = cdf( 0.5, 3.0, 2.0, 2 );
// returns ~0.01

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

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

y = cdf( 1.5, NaN, 2.0 );
// returns NaN

If provided v < 2 or r < 2, the function returns NaN.

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

y = cdf( 2.0, 3.0, 1.5 );
// returns NaN

cdf.factory( r, v[, nranges=1] )

Returns a function for evaluating the cdf of a studentized range distribution with sample size r and v degrees of freedom. Optionally. Optionally, the number of groups whose maximum range is considered can be specified via the nranges parameter.

var mycdf = cdf.factory( 3.0, 2.0 );
var y = mycdf( 3.0 );
// returns ~0.712

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

Examples

var randu = require( '@stdlib/random-base-randu' );
var cdf = require( '@stdlib/stats-base-dists-studentized-range-cdf' );

var v;
var q;
var r;
var y;
var i;

for ( i = 0; i < 10; i++ ) {
    q = randu() * 12.0;
    r = ( randu() * 20.0 ) + 2.0;
    v = ( randu() * 10.0 ) + 2.0;
    y = cdf( q, r, v );
    console.log( 'q: %d, r: %d, v: %d, F(x;v): %d', q.toFixed( 4 ), r.toFixed( 4 ), v.toFixed( 4 ), y.toFixed( 4 ) );
}

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

Chat


License

See LICENSE.

Copyright

Copyright © 2016-2024. The Stdlib Authors.