Studentized range distribution cumulative distribution function (CDF).
var cdf = require( '@stdlib/stats/base/dists/studentized-range/cdf' );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.01If 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 NaNIf 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 NaNReturns a function for evaluating the cdf of 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 mycdf = cdf.factory( 3.0, 2.0 );
var y = mycdf( 3.0 );
// returns ~0.712
y = mycdf( 1.0 );
// returns ~0.216var uniform = require( '@stdlib/random/array/uniform' );
var logEachMap = require( '@stdlib/console/log-each-map' );
var cdf = require( '@stdlib/stats/base/dists/studentized-range/cdf' );
var opts = {
'dtype': 'float64'
};
var q = uniform( 10, 0.0, 12.0, opts );
var r = uniform( 10, 2.0, 20.0, opts );
var v = uniform( 10, 2.0, 10.0, opts );
logEachMap( 'q: %0.4f, r: %0.4f, v: %0.4f, F(x;v): %0.4f', q, r, v, cdf );#include "stdlib/stats/base/dists/studentized-range/cdf.h"Evaluates the cumulative distribution function (CDF) for a studentized range distribution.
double out = stdlib_base_dists_studentized_range_cdf( 0.5, 3.0, 2.0, 1.0 );
// returns ~0.0644The function accepts the following arguments:
- q:
[in] doublequantile of the studentized range. - r:
[in] doublesample size for range (same for each group). - v:
[in] doubledegrees of freedom. - nranges:
[in] doublenumber of groups whose maximum range is considered.
double stdlib_base_dists_studentized_range_cdf( const double q, const double r, const double v, const double nranges );#include "stdlib/stats/base/dists/studentized-range/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 q;
double r;
double v;
double y;
int i;
for ( i = 0; i < 10; i++ ) {
q = random_uniform( 0.0, 12.0 );
r = random_uniform( 2.0, 20.0 );
v = random_uniform( 2.0, 10.0 );
y = stdlib_base_dists_studentized_range_cdf( q, r, v, 1.0 );
printf( "q: %lf, r: %lf, v: %lf, F(x;v): %lf\n", q, r, v, y );
}
}