Laplace
Laplace distribution.
Usage
var laplace = require( '@stdlib/stats/base/dists/laplace' );
laplace
Laplace distribution.
var dist = laplace;
// returns {...}
The namespace contains the following distribution functions:
cdf( x, mu, b )
: Laplace distribution cumulative distribution function.logcdf( x, mu, b )
: Laplace distribution logarithm of cumulative distribution function.logpdf( x, mu, b )
: Laplace distribution logarithm of probability density function (PDF).mgf( t, mu, b )
: Laplace distribution moment-generating function (MGF).pdf( x, mu, b )
: Laplace distribution probability density function (PDF).quantile( p, mu, b )
: Laplace distribution quantile function.
The namespace contains the following functions for calculating distribution properties:
entropy( mu, b )
: Laplace distribution differential entropy.kurtosis( mu, b )
: Laplace distribution excess kurtosis.mean( mu, b )
: Laplace distribution expected value.median( mu, b )
: Laplace distribution median.mode( mu, b )
: Laplace distribution mode.skewness( mu, b )
: Laplace distribution skewness.stdev( mu, b )
: Laplace distribution standard deviation.variance( mu, b )
: Laplace distribution variance.
The namespace contains a constructor function for creating a Laplace distribution object.
Laplace( [mu, b] )
: Laplace distribution constructor.
var Laplace = require( '@stdlib/stats/base/dists/laplace' ).Laplace;
var dist = new Laplace( 2.0, 4.0 );
var y = dist.cdf( 0.5 );
// returns ~0.344
Examples
var laplace = require( '@stdlib/stats/base/dists/laplace' );
var dist = new laplace.Laplace( 4.0, 2.0 );
console.log( dist.mu );
// => 4.0
console.log( dist.b );
// => 2.0
dist.mu = 6.0;
dist.b = 3.0;
console.log( dist.mu );
// => 6.0
console.log( dist.b );
// => 3.0
console.log( dist.kurtosis );
// => 3.0
console.log( dist.median );
// => 6.0
console.log( dist.variance );
// => 18.0
var mu = 4.0;
var b = 2.0;
console.log( laplace.pdf( 2.0, mu, b ) );
// => ~0.092
console.log( laplace.cdf( 2.0, mu, b ) );
// => ~0.184
console.log( laplace.quantile( 0.5, mu, b ) );
// => 4.0
mu = 6.0;
b = 3.0;
console.log( laplace.entropy( mu, b ) );
// => ~ 2.7918
console.log( laplace.mean( mu, b ) );
// => 6.0
console.log( laplace.median( mu, b ) );
// => 6.0
console.log( laplace.mode( mu, b ) );
// => 6.0
console.log( laplace.variance( mu, b ) );
// => 18.0
console.log( laplace.skewness( mu, b ) );
// => 0.0
var myquantile = laplace.quantile.factory( 10.0, 2.0 );
console.log( myquantile( 0.2 ) );
// => ~8.167
console.log( myquantile( 0.8 ) );
// => ~11.833
var mylogpdf = laplace.logpdf.factory( 10.0, 2.0 );
console.log( mylogpdf( 10.0) );
// => ~-1.386
console.log( mylogpdf( 5.0 ) );
// => ~-3.886