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:

The namespace contains the following functions for calculating distribution properties:

The namespace contains a constructor function for creating a Laplace distribution object.

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
Did you find this page helpful?