code: function regualizedBeta(x, a, b) {
  	if(x < 0 || x > 1) {
      throw new RangeError('First argument must be between 0 and 1.');
  	}
  
    // Special cases, there can make trouble otherwise
    else if (a === 1 && b === 1) return x;
    else if (x === 0) return 0;
    else if (x === 1) return 1;
    else if (a === 0) return 1;
    else if (b === 0) return 0;
  
    else {
      var bt =
        Math.exp(gammaCollection.logGamma(a + b) -
        gammaCollection.logGamma(a) -
        gammaCollection.logGamma(b) +
        a * Math.log(x) +
        b * log1p(-x));
  
      // Use continued fraction directly.
      if (x < (a + 1) / (a + b + 2)) return bt * betacf(x, a, b) / a;
      // else use continued fraction after making the symmetry transformation.
      else return 1 - bt * betacf(1 - x, b, a) / b;
    }
  }
docs: Returns the incomplete beta function I_x(a,b)