norm-dist

normal distribution pdf, cdf, quantile


Keywords
normal, distribution, gaussian, probability, cdf, pdf, quantile, truncated, Z
License
MIT
Install
npm install norm-dist@3.1.0

Documentation

norm-dist

small standalone normal distribution pdf, cdf icdf (quantile) and truncated average

• Example • Why • API • License

Example

import {icdf, cdf} from 'norm-dist'
import pdf from 'norm-dist/pdf.js' //same as normDist.pdf
var quartile = icdf(0.25)
    probability = pdf(quartile),
    cummulative = cdf(quartile) // => 0.25
    interQuartileAverage = cdf(-quartile, quartile) // => 0

Why

This are usually incorporated into large monolitic libraries. Many times, only this is needed.

API

  • .pdf(number) => number z to probability
  • .cdf(number) => number z to cummulative probability
  • .intE(z0, z1) => number average of a truncated interval
  • .icdf(number=Math.random()) => number probability to z, 0 <= p <= 1 using the Acklam approximation
  • .Z(number=Math.random()) => number probability to z, 0 <= p <= 1 using the faster Voutier approximation for random variables

All 4 functions are also available directly in standalone files(require('normDist').intE === require('normDist/intE'))

License

Released under the MIT License