Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
exports.GAMMA.INV = function(probability, alpha, beta) {
if (arguments.length !== 3) {
return Error(ERROR_NA);
}
if (probability < 0 || probability > 1 || alpha <= 0 || beta <= 0) {
return Error(ERROR_NUM);
}
if ((typeof probability !== 'number') || (typeof alpha !== 'number') || (typeof beta !== 'number')) {
return Error(ERROR_VALUE);
}
return jStat.gamma.inv(probability, alpha, beta);
};
exports.GAMMA.DIST = function(value, alpha, beta, cumulative) {
cumulative = parseBool(cumulative)
if (arguments.length !== 4) {
return Error(ERROR_NA);
}
if (value < 0 || alpha <= 0 || beta <= 0) {
return Error(ERROR_VALUE);
}
if ((typeof value !== 'number') || (typeof alpha !== 'number') || (typeof beta !== 'number')) {
return Error(ERROR_VALUE);
}
return cumulative ? jStat.gamma.cdf(value, alpha, beta, true) : jStat.gamma.pdf(value, alpha, beta, false);
};