Quantile Function

Weibull distribution quantile function.

The quantile function for a Weibull random variable is

for 0 <= p < 1, where lambda > 0 is the shape parameter and k > 0 is the scale parameter.

Usage

var quantile = require( '@stdlib/stats/base/dists/weibull/quantile' );

quantile( p, k, lambda )

Evaluates the quantile function for a Weibull distribution with shape parameter k and scale parameter lambda.

var y = quantile( 0.5, 1.0, 1.0 );
// returns ~0.693

y = quantile( 0.2, 2.0, 4.0 );
// returns ~1.89

If provided a probability p outside the interval [0,1], the function returns NaN.

var y = quantile( 1.9, 1.0, 1.0 );
// returns NaN

y = quantile( -0.1, 1.0, 1.0 );
// returns NaN

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

var y = quantile( NaN, 1.0, 1.0 );
// returns NaN

y = quantile( 0.0, NaN, 1.0 );
// returns NaN

y = quantile( 0.0, 1.0, NaN );
// returns NaN

If provided k <= 0, the function returns NaN.

var y = quantile( 0.4, -1.0, 1.0 );
// returns NaN

y = quantile( 0.4, 0.0, 1.0 );
// returns NaN

If provided lambda <= 0, the function returns NaN.

var y = quantile( 0.4, 1.0, -1.0 );
// returns NaN

y = quantile( 0.4, 1.0, 0.0 );
// returns NaN

quantile.factory( k, lambda )

Returns a function for evaluating the quantile function of a Weibull distribution with shape parameter k and scale parameter lambda.

var myquantile = quantile.factory( 2.0, 10.0 );

var y = myquantile( 0.2 );
// returns ~4.724

y = myquantile( 0.8 );
// returns ~12.686

Examples

var randu = require( '@stdlib/random/base/randu' );
var quantile = require( '@stdlib/stats/base/dists/weibull/quantile' );

var lambda;
var k;
var p;
var y;
var i;

for ( i = 0; i < 10; i++ ) {
    p = randu();
    lambda = randu() * 10.0;
    k = randu() * 10.0;
    y = quantile( p, k, lambda );
    console.log( 'p: %d, k: %d, λ: %d, Q(p;k,λ): %d', p, k, lambda, y );
}
Did you find this page helpful?