Skip to main content
Module

x/simplestatistics/src/probit.js

simple statistics for node & browser javascript
Go to Latest
File
import epsilon from "./epsilon.js";import inverseErrorFunction from "./inverse_error_function.js";
/** * The [Probit](http://en.wikipedia.org/wiki/Probit) * is the inverse of cumulativeStdNormalProbability(), * and is also known as the normal quantile function. * * It returns the number of standard deviations from the mean * where the p'th quantile of values can be found in a normal distribution. * So, for example, probit(0.5 + 0.6827/2) ≈ 1 because 68.27% of values are * normally found within 1 standard deviation above or below the mean. * * @param {number} p * @returns {number} probit */function probit(p) { if (p === 0) { p = epsilon; } else if (p >= 1) { p = 1 - epsilon; } return Math.sqrt(2) * inverseErrorFunction(2 * p - 1);}
export default probit;