Code Monkey home page Code Monkey logo

zscore-probability's Introduction

zscore-probability

The following functions calculate probability from a z-score and z-score from a probability.

Install

npm install --save zscore-probability

See test.js for a couple of examples.

About the code

Found on https://stackoverflow.com/a/36903699/464549

Original code comments:

The following JavaScript functions for calculating normal and
chi-square probabilities and critical values were adapted by
John Walker from C implementations
written by Gary Perlman of Wang Institute, Tyngsboro, MA
01879.  Both the original C code and this JavaScript edition
are in the public domain.  */

POZ  --  probability of normal z value

Adapted from a polynomial approximation in:
        Ibbetson D, Algorithm 209
        Collected Algorithms of the CACM 1963 p. 616
Note:
        This routine has six digit accuracy, so it is only useful for absolute
        z values <= 6.  For z values > to 6.0, poz() returns 0.0.

CRITZ  --  Compute critical normal z value to
           produce given p.  We just do a bisection
           search for a value within CHI_EPSILON,
           relying on the monotonicity of pochisq().

License

MIT © Dennis Iversen

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.