time-to-botec/js/node_modules/@stdlib/stats/base/dists/rayleigh/mgf
NunoSempere b6addc7f05 feat: add the node modules
Necessary in order to clearly see the squiggle hotwiring.
2022-12-03 12:44:49 +00:00
..
docs feat: add the node modules 2022-12-03 12:44:49 +00:00
lib feat: add the node modules 2022-12-03 12:44:49 +00:00
package.json feat: add the node modules 2022-12-03 12:44:49 +00:00
README.md feat: add the node modules 2022-12-03 12:44:49 +00:00

Moment-Generating Function

Rayleigh distribution moment-generating function (MGF).

The moment-generating function for a Rayleigh random variable is

Moment-generating function (MGF) for a Rayleigh distribution.

where sigma > 0 is the scale parameter.

Usage

var mgf = require( '@stdlib/stats/base/dists/rayleigh/mgf' );

mgf( t, sigma )

Evaluates the moment-generating function for a Rayleigh distribution with scale parameter sigma.

var y = mgf( 1.0, 3.0 );
// returns ~678.508

y = mgf( 1.0, 2.0 );
// returns ~38.65

y = mgf( -1.0, 4.0 );
// returns ~-0.947

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

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

y = mgf( 0.0, NaN );
// returns NaN

If provided sigma < 0, the function returns NaN.

var y = mgf( 0.5, -1.0 );
// returns NaN

mgf.factory( sigma )

Returns a function for evaluating the moment-generating function of a Rayleigh distribution with parameter sigma (scale parameter).

var myMGF = mgf.factory( 0.5 );
var y = myMGF( 1.0 );
// returns ~2.715

y = myMGF( 0.5 );
// returns ~1.888

Examples

var randu = require( '@stdlib/random/base/randu' );
var mgf = require( '@stdlib/stats/base/dists/rayleigh/mgf' );

var sigma;
var t;
var y;
var i;

for ( i = 0; i < 10; i++ ) {
    t = randu();
    sigma = randu() * 5.0;
    y = mgf( t, sigma );
    console.log( 't: %d, σ: %d, M_X(t;σ): %d', t.toFixed( 4 ), sigma.toFixed( 4 ), y.toFixed( 4 ) );
}