Package Exports
- @stdlib/stats-base-dists-rayleigh-mgf
- @stdlib/stats-base-dists-rayleigh-mgf/lib/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@stdlib/stats-base-dists-rayleigh-mgf) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Moment-Generating Function
Rayleigh distribution moment-generating function (MGF).
The moment-generating function for a Rayleigh random variable is
where sigma > 0 is the scale parameter.
Installation
npm install @stdlib/stats-base-dists-rayleigh-mgfUsage
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.947If provided NaN as any argument, the function returns NaN.
var y = mgf( NaN, 1.0 );
// returns NaN
y = mgf( 0.0, NaN );
// returns NaNIf provided sigma < 0, the function returns NaN.
var y = mgf( 0.5, -1.0 );
// returns NaNmgf.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.888Examples
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 ) );
}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
License
See LICENSE.
Copyright
Copyright © 2016-2022. The Stdlib Authors.