distributions.io

0.0.1 • Public • Published

Distributions

NPM version Build Status Coverage Dependencies

Collection of probability distributions.

This modules provides functions to evaluate the CDF, PDF / PMF and quantile functions for a wide range of discrete and continuous probability distributions. In addition, it implements random number generators, moment-generating functions and facilities to retrieve distribution properties such as the moments of the respective distribution.

Installation

$ npm install distributions.io

Usage

var dist = require( 'distributions.io' );

Common Interface

Distributions


Examples

var dist = require( 'distributions.io' ),
    out;
 
// Generate 30 standard normal random variates:
out = dist.norm.random( 30 );
 
// Evaluate the PDF of a exponential distribution with lambda=2 at 0:
out = dist.exp.pdf( 0, {lambda: 2} );
 
// Retrieve the excess kurtosis of a Poisson random variable with lambda = 3:
out = dist.poisson.ekurtosis( 3 );
 
// Evaluate the CDF of a standard normal for an array of values:
out = dist.norm.cdf( [-3,-2,-1,0,1,2,3] );

To run the example code from the top-level application directory,

$ node ./examples/index.js

Tests

Unit

Unit tests use the Mocha test framework with Chai assertions. To run the tests, execute the following command in the top-level application directory:

$ make test

All new feature development should have corresponding unit tests to validate correct functionality.

Test Coverage

This repository uses Istanbul as its code coverage tool. To generate a test coverage report, execute the following command in the top-level application directory:

$ make test-cov

Istanbul creates a ./reports/coverage directory. To access an HTML version of the report,

$ make view-cov

License

MIT license.

Copyright

Copyright © 2015. The Distributions.io Authors.

Readme

Keywords

none

Package Sidebar

Install

npm i distributions.io

Weekly Downloads

2

Version

0.0.1

License

MIT

Last publish

Collaborators

  • kgryte
  • planeshifter