How to use the jstat.gamma function in jstat

To help you get started, we’ve selected a few jstat examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github zhilu-nanjing / financial-cell / src / calc / expression_fn / lib / statistical.js View on Github external
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);
};
github zhilu-nanjing / financial-cell / src / calc / expression_fn / lib / statistical.js View on Github external
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);
};