jstat/jstat

Release 1.8.3

trevnorris committed Jun 4, 2019
1 parent eeb696a commit 1d53910df1d6e1ce3c7caa01120298dd78e58ede
Showing with 53 additions and 13 deletions.
1. +51 −11 dist/jstat.js
2. +1 −1 dist/jstat.min.js
3. +1 −1 package.json
 @@ -2436,6 +2436,34 @@ jStat.extend(jStat.uniform, { }); // Got this from http://www.math.ucla.edu/~tom/distributions/binomial.html function betinc(x, a, b, eps) { var a0 = 0; var b0 = 1; var a1 = 1; var b1 = 1; var m9 = 0; var a2 = 0; var c9; while (Math.abs((a1 - a2) / a1) > eps) { a2 = a1; c9 = -(a + m9) * (a + b + m9) * x / (a + 2 * m9) / (a + 2 * m9 + 1); a0 = a1 + c9 * a0; b0 = b1 + c9 * b0; m9 = m9 + 1; c9 = m9 * (b - m9) * x / (a + 2 * m9 - 1) / (a + 2 * m9); a1 = a0 + c9 * a1; b1 = b0 + c9 * b1; a0 = a0 / b1; b0 = b0 / b1; a1 = a1 / b1; b1 = 1; } return a1 / a; } // extend uniform function with static methods jStat.extend(jStat.binomial, { @@ -2446,18 +2474,30 @@ jStat.extend(jStat.binomial, { }, cdf: function cdf(x, n, p) { var binomarr = [], k = 0; if (x < 0) { var betacdf; var eps = 1e-10; if (x < 0) return 0; } if (x < n) { for (; k <= x; k++) { binomarr[ k ] = jStat.binomial.pdf(k, n, p); } return jStat.sum(binomarr); } return 1; if (x >= n) return 1; if (p < 0 || p > 1 || n <= 0) return NaN; x = Math.floor(x); var z = p; var a = x + 1; var b = n - x; var s = a + b; var bt = Math.exp(jStat.gammaln(s) - jStat.gammaln(b) - jStat.gammaln(a) + a * Math.log(z) + b * Math.log(1 - z)); if (z < (a + 1) / (s + 2)) betacdf = bt * betinc(z, a, b, eps); else betacdf = 1 - bt * betinc(1 - z, b, a, eps); return Math.round((1 - betacdf) * (1 / eps)) / (1 / eps); } });

Large diffs are not rendered by default.

 @@ -1,6 +1,6 @@ { "name": "jStat", "version": "1.8.2", "version": "1.8.3", "description": "Statistical Library for JavaScript", "homepage": "http://github.com/jstat/jstat", "main": "./dist/jstat.js",