Quantile Function
Studentized range distribution quantile function.
Usage
var quantile = require( '@stdlib/stats/base/dists/studentized-range/quantile' );
quantile( p, r, v[, nranges=1] )
Evaluates the quantile function for 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 y = quantile( 0.5, 3.0, 2.0 );
// returns ~0.0644
y = quantile( 0.9, 17.0, 2.0 );
// returns ~0.913
y = quantile( 0.5, 3.0, 2.0, 2 );
// returns ~0.01
If provided a probability p
outside the interval [0,1]
, the function returns NaN
.
var y = quantile( 1.9, 3.0, 2.0 );
// returns NaN
y = quantile( -0.1, 3.0, 2.0 );
// returns NaN
If provided NaN
as any argument, the function returns NaN
.
var y = quantile( NaN, 2.0, 2.0 );
// returns NaN
y = quantile( 0.0, NaN, 2.0 );
// returns NaN
If provided v < 2
or r < 2
, the function returns NaN
.
var y = quantile( 0.4, -1.0, 3.0 );
// returns NaN
y = quantile( 0.4, 3.0, 1.5 );
// returns NaN
quantile.factory( r, v[, nranges=1] )
Returns a function for evaluating the quantile function of an 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 myquantile = quantile.factory( 4.0 );
var y = myquantile( 0.2 );
// returns ~-0.941
y = myquantile( 0.9 );
// returns ~1.533
Examples
var randu = require( '@stdlib/random/base/randu' );
var quantile = require( '@stdlib/stats/base/dists/studentized-range/quantile' );
var v;
var r;
var p;
var y;
var i;
for ( i = 0; i < 10; i++ ) {
p = randu();
r = ( randu() * 20.0 ) + 2.0;
v = ( randu() * 20.0 ) + 2.0;
y = quantile( p, r, v );
console.log( 'p: %d, r: %d, v: %d, Q(p;r,v): %d', p.toFixed( 4 ), r.toFixed( 4 ), v.toFixed( 4 ), y.toFixed( 4 ) );
}