Socket
Socket
Sign inDemoInstall

simple-statistics

Package Overview
Dependencies
0
Maintainers
1
Versions
70
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 7.2.0 to 7.3.0

src/approx_equal.d.ts

8

CHANGELOG.md

@@ -5,2 +5,10 @@ # Changelog

## [7.3.0](https://github.com/simple-statistics/simple-statistics/compare/v7.2.0...v7.3.0) (2020-09-08)
### Features
* Add randomSource argument to permutationTest ([#505](https://github.com/simple-statistics/simple-statistics/issues/505)) ([f289fd1](https://github.com/simple-statistics/simple-statistics/commit/f289fd11bd4eafcd5df319979b051a030bf60f88))
* Relative error and approximate equality ([#506](https://github.com/simple-statistics/simple-statistics/issues/506)) ([88e8794](https://github.com/simple-statistics/simple-statistics/commit/88e87943fdb984c7b410fb7db606cd0fe8b87317))
## [7.2.0](https://github.com/simple-statistics/simple-statistics/compare/v7.1.0...v7.2.0) (2020-08-23)

@@ -7,0 +15,0 @@

2

dist/simple-statistics.min.js

@@ -1,2 +0,2 @@

!function(r,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((r="undefined"!=typeof globalThis?globalThis:r||self).ss={})}(this,(function(r){"use strict";function t(r){if(0===r.length)return 0;for(var t,n=r[0],e=0,a=1;a<r.length;a++)t=n+r[a],Math.abs(n)>=Math.abs(r[a])?e+=n-t+r[a]:e+=r[a]-t+n,n=t;return n+e}function n(r){if(0===r.length)throw new Error("mean requires at least one data point");return t(r)/r.length}function e(r,t){var e,a,o=n(r),i=0;if(2===t)for(a=0;a<r.length;a++)i+=(e=r[a]-o)*e;else for(a=0;a<r.length;a++)i+=Math.pow(r[a]-o,t);return i}function a(r){if(0===r.length)throw new Error("variance requires at least one data point");return e(r,2)/r.length}function o(r){if(1===r.length)return 0;var t=a(r);return Math.sqrt(t)}function i(r){if(0===r.length)throw new Error("mode requires at least one data point");if(1===r.length)return r[0];for(var t=r[0],n=NaN,e=0,a=1,o=1;o<r.length+1;o++)r[o]!==t?(a>e&&(e=a,n=t),a=1,t=r[o]):a++;return n}function u(r){return r.slice().sort((function(r,t){return r-t}))}function h(r){if(0===r.length)throw new Error("min requires at least one data point");for(var t=r[0],n=1;n<r.length;n++)r[n]<t&&(t=r[n]);return t}function f(r){if(0===r.length)throw new Error("max requires at least one data point");for(var t=r[0],n=1;n<r.length;n++)r[n]>t&&(t=r[n]);return t}function l(r){for(var t=0,n=0;n<r.length;n++)t+=r[n];return t}function s(r,t){var n=r.length*t;if(0===r.length)throw new Error("quantile requires at least one data point.");if(t<0||t>1)throw new Error("quantiles must be between 0 and 1");return 1===t?r[r.length-1]:0===t?r[0]:n%1!=0?r[Math.ceil(n)-1]:r.length%2==0?(r[n-1]+r[n])/2:r[n]}function c(r,t,n,e){for(n=n||0,e=e||r.length-1;e>n;){if(e-n>600){var a=e-n+1,o=t-n+1,i=Math.log(a),u=.5*Math.exp(2*i/3),h=.5*Math.sqrt(i*u*(a-u)/a);o-a/2<0&&(h*=-1),c(r,t,Math.max(n,Math.floor(t-o*u/a+h)),Math.min(e,Math.floor(t+(a-o)*u/a+h)))}var f=r[t],l=n,s=e;for(v(r,n,t),r[e]>f&&v(r,n,e);l<s;){for(v(r,l,s),l++,s--;r[l]<f;)l++;for(;r[s]>f;)s--}r[n]===f?v(r,n,s):v(r,++s,e),s<=t&&(n=s+1),t<=s&&(e=s-1)}}function v(r,t,n){var e=r[t];r[t]=r[n],r[n]=e}function g(r,t){var n=r.slice();if(Array.isArray(t)){!function(r,t){for(var n=[0],e=0;e<t.length;e++)n.push(M(r.length,t[e]));n.push(r.length-1),n.sort(w);var a=[0,n.length-1];for(;a.length;){var o=Math.ceil(a.pop()),i=Math.floor(a.pop());if(!(o-i<=1)){var u=Math.floor((i+o)/2);p(r,n[u],Math.floor(n[i]),Math.ceil(n[o])),a.push(i,u,u,o)}}}(n,t);for(var e=[],a=0;a<t.length;a++)e[a]=s(n,t[a]);return e}return p(n,M(n.length,t),0,n.length-1),s(n,t)}function p(r,t,n,e){t%1==0?c(r,t,n,e):(c(r,t=Math.floor(t),n,e),c(r,t+1,t+1,e))}function w(r,t){return r-t}function M(r,t){var n=r*t;return 1===t?r-1:0===t?0:n%1!=0?Math.ceil(n)-1:r%2==0?n-.5:n}function m(r,t){if(t<r[0])return 0;if(t>r[r.length-1])return 1;var n=function(r,t){var n=0,e=0,a=r.length;for(;e<a;)t<=r[n=e+a>>>1]?a=n:e=-~n;return e}(r,t);if(r[n]!==t)return n/r.length;n++;var e=function(r,t){var n=0,e=0,a=r.length;for(;e<a;)t>=r[n=e+a>>>1]?e=-~n:a=n;return e}(r,t);if(e===n)return n/r.length;var a=e-n+1;return a*(e+n)/2/a/r.length}function d(r){var t=g(r,.75),n=g(r,.25);if("number"==typeof t&&"number"==typeof n)return t-n}function b(r){return+g(r,.5)}function q(r){for(var t=b(r),n=[],e=0;e<r.length;e++)n.push(Math.abs(r[e]-t));return b(n)}function E(r,t){t=t||Math.random;for(var n,e,a=r.length;a>0;)e=Math.floor(t()*a--),n=r[a],r[a]=r[e],r[e]=n;return r}function y(r,t){return E(r.slice().slice(),t)}function S(r,t,n){return y(r,n).slice(0,t)}function x(r,t){for(var n=[],e=0;e<r;e++){for(var a=[],o=0;o<t;o++)a.push(0);n.push(a)}return n}function k(r){for(var t,n=0,e=0;e<r.length;e++)0!==e&&r[e]===t||(t=r[e],n++);return n}function P(r,t,n,e){var a;if(r>0){var o=(n[t]-n[r-1])/(t-r+1);a=e[t]-e[r-1]-(t-r+1)*o*o}else a=e[t]-n[t]*n[t]/(t+1);return a<0?0:a}function I(r,t,n,e,a,o,i){if(!(r>t)){var u=Math.floor((r+t)/2);e[n][u]=e[n-1][u-1],a[n][u]=u;var h=n;r>n&&(h=Math.max(h,a[n][r-1]||0)),h=Math.max(h,a[n-1][u]||0);var f,l,s,c=u-1;t<e.length-1&&(c=Math.min(c,a[n][t+1]||0));for(var v=c;v>=h&&!((f=P(v,u,o,i))+e[n-1][h-1]>=e[n][u]);--v)(l=P(h,u,o,i)+e[n-1][h-1])<e[n][u]&&(e[n][u]=l,a[n][u]=h),h++,(s=f+e[n-1][v-1])<e[n][u]&&(e[n][u]=s,a[n][u]=v);I(r,u-1,n,e,a,o,i),I(u+1,t,n,e,a,o,i)}}function A(r,t){if(r.length!==t.length)throw new Error("sampleCovariance requires samples with equal lengths");if(r.length<2)throw new Error("sampleCovariance requires at least two data points in each sample");for(var e=n(r),a=n(t),o=0,i=0;i<r.length;i++)o+=(r[i]-e)*(t[i]-a);return o/(r.length-1)}function C(r){if(r.length<2)throw new Error("sampleVariance requires at least two data points");return e(r,2)/(r.length-1)}function N(r){var t=C(r);return Math.sqrt(t)}function T(r,t,n,e){return(r*t+n*e)/(t+e)}function _(r){if(0===r.length)throw new Error("meanSimple requires at least one data point");return l(r)/r.length}function D(r){if(0===r.length)throw new Error("rootMeanSquare requires at least one data point");for(var t=0,n=0;n<r.length;n++)t+=Math.pow(r[n],2);return Math.sqrt(t/r.length)}var R=function(){this.totalCount=0,this.data={}};R.prototype.train=function(r,t){for(var n in this.data[t]||(this.data[t]={}),r){var e=r[n];void 0===this.data[t][n]&&(this.data[t][n]={}),void 0===this.data[t][n][e]&&(this.data[t][n][e]=0),this.data[t][n][e]++}this.totalCount++},R.prototype.score=function(r){var t,n={};for(var e in r){var a=r[e];for(t in this.data)n[t]={},this.data[t][e]?n[t][e+"_"+a]=(this.data[t][e][a]||0)/this.totalCount:n[t][e+"_"+a]=0}var o={};for(t in n)for(var i in o[t]=0,n[t])o[t]+=n[t][i];return o};var F=function(){this.weights=[],this.bias=0};F.prototype.predict=function(r){if(r.length!==this.weights.length)return null;for(var t=0,n=0;n<this.weights.length;n++)t+=this.weights[n]*r[n];return(t+=this.bias)>0?1:0},F.prototype.train=function(r,t){if(0!==t&&1!==t)return null;r.length!==this.weights.length&&(this.weights=r,this.bias=1);var n=this.predict(r);if("number"==typeof n&&n!==t){for(var e=t-n,a=0;a<this.weights.length;a++)this.weights[a]+=e*r[a];this.bias+=e}return this};function V(r){if(r<0)throw new Error("factorial requires a non-negative value");if(Math.floor(r)!==r)throw new Error("factorial requires an integer input");for(var t=1,n=2;n<=r;n++)t*=n;return t}var U=[.9999999999999971,57.15623566586292,-59.59796035547549,14.136097974741746,-.4919138160976202,3399464998481189e-20,4652362892704858e-20,-9837447530487956e-20,.0001580887032249125,-.00021026444172410488,.00021743961811521265,-.0001643181065367639,8441822398385275e-20,-26190838401581408e-21,36899182659531625e-22],L=Math.log(Math.sqrt(2*Math.PI));var z={1:{.995:0,.99:0,.975:0,.95:0,.9:.02,.5:.45,.1:2.71,.05:3.84,.025:5.02,.01:6.63,.005:7.88},2:{.995:.01,.99:.02,.975:.05,.95:.1,.9:.21,.5:1.39,.1:4.61,.05:5.99,.025:7.38,.01:9.21,.005:10.6},3:{.995:.07,.99:.11,.975:.22,.95:.35,.9:.58,.5:2.37,.1:6.25,.05:7.81,.025:9.35,.01:11.34,.005:12.84},4:{.995:.21,.99:.3,.975:.48,.95:.71,.9:1.06,.5:3.36,.1:7.78,.05:9.49,.025:11.14,.01:13.28,.005:14.86},5:{.995:.41,.99:.55,.975:.83,.95:1.15,.9:1.61,.5:4.35,.1:9.24,.05:11.07,.025:12.83,.01:15.09,.005:16.75},6:{.995:.68,.99:.87,.975:1.24,.95:1.64,.9:2.2,.5:5.35,.1:10.65,.05:12.59,.025:14.45,.01:16.81,.005:18.55},7:{.995:.99,.99:1.25,.975:1.69,.95:2.17,.9:2.83,.5:6.35,.1:12.02,.05:14.07,.025:16.01,.01:18.48,.005:20.28},8:{.995:1.34,.99:1.65,.975:2.18,.95:2.73,.9:3.49,.5:7.34,.1:13.36,.05:15.51,.025:17.53,.01:20.09,.005:21.96},9:{.995:1.73,.99:2.09,.975:2.7,.95:3.33,.9:4.17,.5:8.34,.1:14.68,.05:16.92,.025:19.02,.01:21.67,.005:23.59},10:{.995:2.16,.99:2.56,.975:3.25,.95:3.94,.9:4.87,.5:9.34,.1:15.99,.05:18.31,.025:20.48,.01:23.21,.005:25.19},11:{.995:2.6,.99:3.05,.975:3.82,.95:4.57,.9:5.58,.5:10.34,.1:17.28,.05:19.68,.025:21.92,.01:24.72,.005:26.76},12:{.995:3.07,.99:3.57,.975:4.4,.95:5.23,.9:6.3,.5:11.34,.1:18.55,.05:21.03,.025:23.34,.01:26.22,.005:28.3},13:{.995:3.57,.99:4.11,.975:5.01,.95:5.89,.9:7.04,.5:12.34,.1:19.81,.05:22.36,.025:24.74,.01:27.69,.005:29.82},14:{.995:4.07,.99:4.66,.975:5.63,.95:6.57,.9:7.79,.5:13.34,.1:21.06,.05:23.68,.025:26.12,.01:29.14,.005:31.32},15:{.995:4.6,.99:5.23,.975:6.27,.95:7.26,.9:8.55,.5:14.34,.1:22.31,.05:25,.025:27.49,.01:30.58,.005:32.8},16:{.995:5.14,.99:5.81,.975:6.91,.95:7.96,.9:9.31,.5:15.34,.1:23.54,.05:26.3,.025:28.85,.01:32,.005:34.27},17:{.995:5.7,.99:6.41,.975:7.56,.95:8.67,.9:10.09,.5:16.34,.1:24.77,.05:27.59,.025:30.19,.01:33.41,.005:35.72},18:{.995:6.26,.99:7.01,.975:8.23,.95:9.39,.9:10.87,.5:17.34,.1:25.99,.05:28.87,.025:31.53,.01:34.81,.005:37.16},19:{.995:6.84,.99:7.63,.975:8.91,.95:10.12,.9:11.65,.5:18.34,.1:27.2,.05:30.14,.025:32.85,.01:36.19,.005:38.58},20:{.995:7.43,.99:8.26,.975:9.59,.95:10.85,.9:12.44,.5:19.34,.1:28.41,.05:31.41,.025:34.17,.01:37.57,.005:40},21:{.995:8.03,.99:8.9,.975:10.28,.95:11.59,.9:13.24,.5:20.34,.1:29.62,.05:32.67,.025:35.48,.01:38.93,.005:41.4},22:{.995:8.64,.99:9.54,.975:10.98,.95:12.34,.9:14.04,.5:21.34,.1:30.81,.05:33.92,.025:36.78,.01:40.29,.005:42.8},23:{.995:9.26,.99:10.2,.975:11.69,.95:13.09,.9:14.85,.5:22.34,.1:32.01,.05:35.17,.025:38.08,.01:41.64,.005:44.18},24:{.995:9.89,.99:10.86,.975:12.4,.95:13.85,.9:15.66,.5:23.34,.1:33.2,.05:36.42,.025:39.36,.01:42.98,.005:45.56},25:{.995:10.52,.99:11.52,.975:13.12,.95:14.61,.9:16.47,.5:24.34,.1:34.28,.05:37.65,.025:40.65,.01:44.31,.005:46.93},26:{.995:11.16,.99:12.2,.975:13.84,.95:15.38,.9:17.29,.5:25.34,.1:35.56,.05:38.89,.025:41.92,.01:45.64,.005:48.29},27:{.995:11.81,.99:12.88,.975:14.57,.95:16.15,.9:18.11,.5:26.34,.1:36.74,.05:40.11,.025:43.19,.01:46.96,.005:49.65},28:{.995:12.46,.99:13.57,.975:15.31,.95:16.93,.9:18.94,.5:27.34,.1:37.92,.05:41.34,.025:44.46,.01:48.28,.005:50.99},29:{.995:13.12,.99:14.26,.975:16.05,.95:17.71,.9:19.77,.5:28.34,.1:39.09,.05:42.56,.025:45.72,.01:49.59,.005:52.34},30:{.995:13.79,.99:14.95,.975:16.79,.95:18.49,.9:20.6,.5:29.34,.1:40.26,.05:43.77,.025:46.98,.01:50.89,.005:53.67},40:{.995:20.71,.99:22.16,.975:24.43,.95:26.51,.9:29.05,.5:39.34,.1:51.81,.05:55.76,.025:59.34,.01:63.69,.005:66.77},50:{.995:27.99,.99:29.71,.975:32.36,.95:34.76,.9:37.69,.5:49.33,.1:63.17,.05:67.5,.025:71.42,.01:76.15,.005:79.49},60:{.995:35.53,.99:37.48,.975:40.48,.95:43.19,.9:46.46,.5:59.33,.1:74.4,.05:79.08,.025:83.3,.01:88.38,.005:91.95},70:{.995:43.28,.99:45.44,.975:48.76,.95:51.74,.9:55.33,.5:69.33,.1:85.53,.05:90.53,.025:95.02,.01:100.42,.005:104.22},80:{.995:51.17,.99:53.54,.975:57.15,.95:60.39,.9:64.28,.5:79.33,.1:96.58,.05:101.88,.025:106.63,.01:112.33,.005:116.32},90:{.995:59.2,.99:61.75,.975:65.65,.95:69.13,.9:73.29,.5:89.33,.1:107.57,.05:113.14,.025:118.14,.01:124.12,.005:128.3},100:{.995:67.33,.99:70.06,.975:74.22,.95:77.93,.9:82.36,.5:99.33,.1:118.5,.05:124.34,.025:129.56,.01:135.81,.005:140.17}};var X=Math.sqrt(2*Math.PI),j={gaussian:function(r){return Math.exp(-.5*r*r)/X}},B={nrd:function(r){var t=N(r),n=d(r);return"number"==typeof n&&(t=Math.min(t,n/1.34)),1.06*t*Math.pow(r.length,-.2)}};function K(r,t,n){var e,a;if(void 0===t)e=j.gaussian;else if("string"==typeof t){if(!j[t])throw new Error('Unknown kernel "'+t+'"');e=j[t]}else e=t;if(void 0===n)a=B.nrd(r);else if("string"==typeof n){if(!B[n])throw new Error('Unknown bandwidth method "'+n+'"');a=B[n](r)}else a=n;return function(t){var n=0,o=0;for(n=0;n<r.length;n++)o+=e((t-r[n])/a);return o/a/r.length}}var O=Math.sqrt(2*Math.PI);function G(r){for(var t=r,n=r,e=1;e<15;e++)t+=n*=r*r/(2*e+1);return Math.round(1e4*(.5+t/O*Math.exp(-r*r/2)))/1e4}for(var H=[],W=0;W<=3.09;W+=.01)H.push(G(W));function J(r){var t=1/(1+.5*Math.abs(r)),n=t*Math.exp(-r*r+((((((((.17087277*t-.82215223)*t+1.48851587)*t-1.13520398)*t+.27886807)*t-.18628806)*t+.09678418)*t+.37409196)*t+1.00002368)*t-1.26551223);return r>=0?1-n:n-1}function Q(r){var t=8*(Math.PI-3)/(3*Math.PI*(4-Math.PI)),n=Math.sqrt(Math.sqrt(Math.pow(2/(Math.PI*t)+Math.log(1-r*r)/2,2)-Math.log(1-r*r)/t)-(2/(Math.PI*t)+Math.log(1-r*r)/2));return r>=0?n:-n}function Y(r){if("number"==typeof r)return r<0?-1:0===r?0:1;throw new TypeError("not a number")}function Z(r,t){for(var n=0,e=0;e<r.length;e++){var a=r[e]-t[e];n+=a*a}return Math.sqrt(n)}function $(r,t){return r.map((function(r){for(var n=Number.MAX_VALUE,e=-1,a=0;a<t.length;a++){var o=Z(r,t[a]);o<n&&(n=o,e=a)}return e}))}function rr(r,t,n){for(var e=r[0].length,a=x(n,e),o=Array(n).fill(0),i=r.length,u=0;u<i;u++){for(var h=r[u],f=t[u],l=a[f],s=0;s<e;s++)l[s]+=h[s];o[f]+=1}for(var c=0;c<n;c++){if(0===o[c])throw new Error("Centroid "+c+" has no friends");for(var v=a[c],g=0;g<e;g++)v[g]/=o[c]}return a}function tr(r,t){for(var n=0,e=0;e<r.length;e++)n+=Z(r[e],t[e]);return n}function nr(r,t){if(r.length!==t.length)throw new Error("must have exactly as many labels as points");for(var n=function(r){for(var t=1+f(r),n=Array(t),e=0;e<r.length;e++){var a=r[e];void 0===n[a]&&(n[a]=[]),n[a].push(e)}return n}(t),e=function(r){for(var t=r.length,n=x(t,t),e=0;e<t;e++)for(var a=0;a<e;a++)n[e][a]=Z(r[e],r[a]),n[a][e]=n[e][a];return n}(r),a=[],o=0;o<r.length;o++){var i=0;if(n[t[o]].length>1){var u=ar(o,n[t[o]],e),h=er(o,t,n,e);i=(h-u)/Math.max(u,h)}a.push(i)}return a}function er(r,t,n,e){for(var a=t[r],o=Number.MAX_VALUE,i=0;i<n.length;i++)if(i!==a){var u=ar(r,n[i],e);u<o&&(o=u)}return o}function ar(r,t,n){for(var e=0,a=0;a<t.length;a++)e+=n[r][t[a]];return e/t.length}r.BayesianClassifier=R,r.PerceptronModel=F,r.addToMean=function(r,t,n){return r+(n-r)/(t+1)},r.average=n,r.averageSimple=_,r.bayesian=R,r.bernoulliDistribution=function(r){if(r<0||r>1)throw new Error("bernoulliDistribution requires probability to be between 0 and 1 inclusive");return[1-r,r]},r.binomialDistribution=function(r,t){if(!(t<0||t>1||r<=0||r%1!=0)){var n=0,e=0,a=[],o=1;do{a[n]=o*Math.pow(t,n)*Math.pow(1-t,r-n),e+=a[n],o=o*(r-++n+1)/n}while(e<.9999);return a}},r.bisect=function(r,t,n,e,a){if("function"!=typeof r)throw new TypeError("func must be a function");for(var o=0;o<e;o++){var i=(t+n)/2;if(0===r(i)||Math.abs((n-t)/2)<a)return i;Y(r(i))===Y(r(t))?t=i:n=i}throw new Error("maximum number of iterations exceeded")},r.chiSquaredDistributionTable=z,r.chiSquaredGoodnessOfFit=function(r,t,e){for(var a=0,o=t(n(r)),i=[],u=[],h=0;h<r.length;h++)void 0===i[r[h]]&&(i[r[h]]=0),i[r[h]]++;for(var f=0;f<i.length;f++)void 0===i[f]&&(i[f]=0);for(var l in o)l in i&&(u[+l]=o[l]*r.length);for(var s=u.length-1;s>=0;s--)u[s]<3&&(u[s-1]+=u[s],u.pop(),i[s-1]+=i[s],i.pop());for(var c=0;c<i.length;c++)a+=Math.pow(i[c]-u[c],2)/u[c];var v=i.length-1-1;return z[v][e]<a},r.chunk=function(r,t){var n=[];if(t<1)throw new Error("chunk size must be a positive number");if(Math.floor(t)!==t)throw new Error("chunk size must be an integer");for(var e=0;e<r.length;e+=t)n.push(r.slice(e,e+t));return n},r.ckmeans=function(r,t){if(t>r.length)throw new Error("cannot generate more classes than there are data values");var n=u(r);if(1===k(n))return[n];var e=x(t,n.length),a=x(t,n.length);!function(r,t,n){for(var e=t[0].length,a=r[Math.floor(e/2)],o=[],i=[],u=0,h=void 0;u<e;++u)h=r[u]-a,0===u?(o.push(h),i.push(h*h)):(o.push(o[u-1]+h),i.push(i[u-1]+h*h)),t[0][u]=P(0,u,o,i),n[0][u]=0;for(var f=1;f<t.length;++f)I(f<t.length-1?f:e-1,e-1,f,t,n,o,i)}(n,e,a);for(var o=[],i=a[0].length-1,h=a.length-1;h>=0;h--){var f=a[h][i];o[h]=n.slice(f,i+1),h>0&&(i=f-1)}return o},r.combinations=function r(t,n){var e,a,o,i,u=[];for(e=0;e<t.length;e++)if(1===n)u.push([t[e]]);else for(o=r(t.slice(e+1,t.length),n-1),a=0;a<o.length;a++)(i=o[a]).unshift(t[e]),u.push(i);return u},r.combinationsReplacement=function r(t,n){for(var e=[],a=0;a<t.length;a++)if(1===n)e.push([t[a]]);else for(var o=r(t.slice(a,t.length),n-1),i=0;i<o.length;i++)e.push([t[a]].concat(o[i]));return e},r.combineMeans=T,r.combineVariances=function(r,t,n,e,a,o){var i=T(t,n,a,o);return(n*(r+Math.pow(t-i,2))+o*(e+Math.pow(a-i,2)))/(n+o)},r.cumulativeStdNormalProbability=function(r){var t=Math.abs(r),n=Math.min(Math.round(100*t),H.length-1);return r>=0?H[n]:+(1-H[n]).toFixed(4)},r.epsilon=1e-4,r.equalIntervalBreaks=function(r,t){if(r.length<2)return r;for(var n=h(r),e=f(r),a=[n],o=(e-n)/t,i=1;i<t;i++)a.push(a[0]+o*i);return a.push(e),a},r.erf=J,r.errorFunction=J,r.extent=function(r){if(0===r.length)throw new Error("extent requires at least one data point");for(var t=r[0],n=r[0],e=1;e<r.length;e++)r[e]>n&&(n=r[e]),r[e]<t&&(t=r[e]);return[t,n]},r.extentSorted=function(r){return[r[0],r[r.length-1]]},r.factorial=V,r.gamma=function r(t){if(Number.isInteger(t))return t<=0?NaN:V(t-1);if(--t<0)return Math.PI/(Math.sin(Math.PI*-t)*r(-t));var n=t+1/4;return Math.pow(t/Math.E,t)*Math.sqrt(2*Math.PI*(t+1/6))*(1+1/144/Math.pow(n,2)-1/12960/Math.pow(n,3)-257/207360/Math.pow(n,4)-52/2612736/Math.pow(n,5)+5741173/9405849600/Math.pow(n,6)+37529/18811699200/Math.pow(n,7))},r.gammaln=function(r){if(r<=0)return 1/0;r--;for(var t=U[0],n=1;n<15;n++)t+=U[n]/(r+n);var e=5.2421875+r;return L+Math.log(t)-e+(r+.5)*Math.log(e)},r.geometricMean=function(r){if(0===r.length)throw new Error("geometricMean requires at least one data point");for(var t=1,n=0;n<r.length;n++){if(r[n]<=0)throw new Error("geometricMean requires only positive numbers as input");t*=r[n]}return Math.pow(t,1/r.length)},r.harmonicMean=function(r){if(0===r.length)throw new Error("harmonicMean requires at least one data point");for(var t=0,n=0;n<r.length;n++){if(r[n]<=0)throw new Error("harmonicMean requires only positive numbers as input");t+=1/r[n]}return r.length/t},r.interquartileRange=d,r.inverseErrorFunction=Q,r.iqr=d,r.kMeansCluster=function(r,t,n){void 0===n&&(n=Math.random);for(var e=null,a=S(r,t,n),o=null,i=Number.MAX_VALUE;0!==i;)e=a,i=tr(a=rr(r,o=$(r,a),t),e);return{labels:o,centroids:a}},r.kde=K,r.kernelDensityEstimation=K,r.linearRegression=function(r){var t,n,e=r.length;if(1===e)t=0,n=r[0][1];else{for(var a,o,i,u=0,h=0,f=0,l=0,s=0;s<e;s++)u+=o=(a=r[s])[0],h+=i=a[1],f+=o*o,l+=o*i;n=h/e-(t=(e*l-u*h)/(e*f-u*u))*u/e}return{m:t,b:n}},r.linearRegressionLine=function(r){return function(t){return r.b+r.m*t}},r.mad=q,r.max=f,r.maxSorted=function(r){return r[r.length-1]},r.mean=n,r.meanSimple=_,r.median=b,r.medianAbsoluteDeviation=q,r.medianSorted=function(r){return s(r,.5)},r.min=h,r.minSorted=function(r){return r[0]},r.mode=function(r){return i(u(r))},r.modeFast=function(r){for(var t,n=new Map,e=0,a=0;a<r.length;a++){var o=n.get(r[a]);void 0===o?o=1:o++,o>e&&(t=r[a],e=o),n.set(r[a],o)}if(0===e)throw new Error("mode requires at last one data point");return t},r.modeSorted=i,r.numericSort=u,r.perceptron=F,r.permutationTest=function(r,t,e,a){if(void 0===a&&(a=1e4),void 0===e&&(e="two_side"),"two_side"!==e&&"greater"!==e&&"less"!==e)throw new Error("`alternative` must be either 'two_side', 'greater', or 'less'");for(var o=n(r)-n(t),i=new Array(a),u=r.concat(t),h=Math.floor(u.length/2),f=0;f<a;f++){E(u);var l=u.slice(0,h),s=u.slice(h,u.length),c=n(l)-n(s);i[f]=c}var v=0;if("two_side"===e)for(var g=0;g<=a;g++)Math.abs(i[g])>=Math.abs(o)&&(v+=1);else if("greater"===e)for(var p=0;p<=a;p++)i[p]>=o&&(v+=1);else for(var w=0;w<=a;w++)i[w]<=o&&(v+=1);return v/a},r.permutationsHeap=function(r){for(var t=new Array(r.length),n=[r.slice()],e=0;e<r.length;e++)t[e]=0;for(var a=0;a<r.length;)if(t[a]<a){var o=0;a%2!=0&&(o=t[a]);var i=r[o];r[o]=r[a],r[a]=i,n.push(r.slice()),t[a]++,a=0}else t[a]=0,a++;return n},r.poissonDistribution=function(r){if(!(r<=0)){var t=0,n=0,e=[],a=1;do{e[t]=Math.exp(-r)*Math.pow(r,t)/a,n+=e[t],a*=++t}while(n<.9999);return e}},r.probit=function(r){return 0===r?r=1e-4:r>=1&&(r=.9999),Math.sqrt(2)*Q(2*r-1)},r.product=function(r){for(var t=1,n=0;n<r.length;n++)t*=r[n];return t},r.quantile=g,r.quantileRank=function(r,t){return m(u(r),t)},r.quantileRankSorted=m,r.quantileSorted=s,r.quickselect=c,r.rSquared=function(r,t){if(r.length<2)return 1;for(var n=0,e=0;e<r.length;e++)n+=r[e][1];for(var a=n/r.length,o=0,i=0;i<r.length;i++)o+=Math.pow(a-r[i][1],2);for(var u=0,h=0;h<r.length;h++)u+=Math.pow(r[h][1]-t(r[h][0]),2);return 1-u/o},r.rms=D,r.rootMeanSquare=D,r.sample=S,r.sampleCorrelation=function(r,t){return A(r,t)/N(r)/N(t)},r.sampleCovariance=A,r.sampleKurtosis=function(r){var t=r.length;if(t<4)throw new Error("sampleKurtosis requires at least four data points");for(var e,a=n(r),o=0,i=0,u=0;u<t;u++)o+=(e=r[u]-a)*e,i+=e*e*e*e;return(t-1)/((t-2)*(t-3))*(t*(t+1)*i/(o*o)-3*(t-1))},r.sampleSkewness=function(r){if(r.length<3)throw new Error("sampleSkewness requires at least three data points");for(var t,e=n(r),a=0,o=0,i=0;i<r.length;i++)a+=(t=r[i]-e)*t,o+=t*t*t;var u=r.length-1,h=Math.sqrt(a/u),f=r.length;return f*o/((f-1)*(f-2)*Math.pow(h,3))},r.sampleStandardDeviation=N,r.sampleVariance=C,r.sampleWithReplacement=function(r,t,n){if(0===r.length)return[];n=n||Math.random;for(var e=r.length,a=[],o=0;o<t;o++){var i=Math.floor(n()*e);a.push(r[i])}return a},r.shuffle=y,r.shuffleInPlace=E,r.sign=Y,r.silhouette=nr,r.silhouetteMetric=function(r,t){return f(nr(r,t))},r.standardDeviation=o,r.standardNormalTable=H,r.subtractFromMean=function(r,t,n){return(r*t-n)/(t-1)},r.sum=t,r.sumNthPowerDeviations=e,r.sumSimple=l,r.tTest=function(r,t){return(n(r)-t)/(o(r)/Math.sqrt(r.length))},r.tTestTwoSample=function(r,t,e){var a=r.length,o=t.length;if(!a||!o)return null;e||(e=0);var i=n(r),u=n(t),h=C(r),f=C(t);if("number"==typeof i&&"number"==typeof u&&"number"==typeof h&&"number"==typeof f){var l=((a-1)*h+(o-1)*f)/(a+o-2);return(i-u-e)/Math.sqrt(l*(1/a+1/o))}},r.uniqueCountSorted=k,r.variance=a,r.zScore=function(r,t,n){return(r-t)/n},Object.defineProperty(r,"__esModule",{value:!0})}));
!function(r,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((r="undefined"!=typeof globalThis?globalThis:r||self).ss={})}(this,(function(r){"use strict";function t(r){if(0===r.length)return 0;for(var t,n=r[0],e=0,a=1;a<r.length;a++)t=n+r[a],Math.abs(n)>=Math.abs(r[a])?e+=n-t+r[a]:e+=r[a]-t+n,n=t;return n+e}function n(r){if(0===r.length)throw new Error("mean requires at least one data point");return t(r)/r.length}function e(r,t){var e,a,o=n(r),i=0;if(2===t)for(a=0;a<r.length;a++)i+=(e=r[a]-o)*e;else for(a=0;a<r.length;a++)i+=Math.pow(r[a]-o,t);return i}function a(r){if(0===r.length)throw new Error("variance requires at least one data point");return e(r,2)/r.length}function o(r){if(1===r.length)return 0;var t=a(r);return Math.sqrt(t)}function i(r){if(0===r.length)throw new Error("mode requires at least one data point");if(1===r.length)return r[0];for(var t=r[0],n=NaN,e=0,a=1,o=1;o<r.length+1;o++)r[o]!==t?(a>e&&(e=a,n=t),a=1,t=r[o]):a++;return n}function u(r){return r.slice().sort((function(r,t){return r-t}))}function h(r){if(0===r.length)throw new Error("min requires at least one data point");for(var t=r[0],n=1;n<r.length;n++)r[n]<t&&(t=r[n]);return t}function f(r){if(0===r.length)throw new Error("max requires at least one data point");for(var t=r[0],n=1;n<r.length;n++)r[n]>t&&(t=r[n]);return t}function l(r){for(var t=0,n=0;n<r.length;n++)t+=r[n];return t}function s(r,t){var n=r.length*t;if(0===r.length)throw new Error("quantile requires at least one data point.");if(t<0||t>1)throw new Error("quantiles must be between 0 and 1");return 1===t?r[r.length-1]:0===t?r[0]:n%1!=0?r[Math.ceil(n)-1]:r.length%2==0?(r[n-1]+r[n])/2:r[n]}function c(r,t,n,e){for(n=n||0,e=e||r.length-1;e>n;){if(e-n>600){var a=e-n+1,o=t-n+1,i=Math.log(a),u=.5*Math.exp(2*i/3),h=.5*Math.sqrt(i*u*(a-u)/a);o-a/2<0&&(h*=-1),c(r,t,Math.max(n,Math.floor(t-o*u/a+h)),Math.min(e,Math.floor(t+(a-o)*u/a+h)))}var f=r[t],l=n,s=e;for(v(r,n,t),r[e]>f&&v(r,n,e);l<s;){for(v(r,l,s),l++,s--;r[l]<f;)l++;for(;r[s]>f;)s--}r[n]===f?v(r,n,s):v(r,++s,e),s<=t&&(n=s+1),t<=s&&(e=s-1)}}function v(r,t,n){var e=r[t];r[t]=r[n],r[n]=e}function g(r,t){var n=r.slice();if(Array.isArray(t)){!function(r,t){for(var n=[0],e=0;e<t.length;e++)n.push(w(r.length,t[e]));n.push(r.length-1),n.sort(M);var a=[0,n.length-1];for(;a.length;){var o=Math.ceil(a.pop()),i=Math.floor(a.pop());if(!(o-i<=1)){var u=Math.floor((i+o)/2);p(r,n[u],Math.floor(n[i]),Math.ceil(n[o])),a.push(i,u,u,o)}}}(n,t);for(var e=[],a=0;a<t.length;a++)e[a]=s(n,t[a]);return e}return p(n,w(n.length,t),0,n.length-1),s(n,t)}function p(r,t,n,e){t%1==0?c(r,t,n,e):(c(r,t=Math.floor(t),n,e),c(r,t+1,t+1,e))}function M(r,t){return r-t}function w(r,t){var n=r*t;return 1===t?r-1:0===t?0:n%1!=0?Math.ceil(n)-1:r%2==0?n-.5:n}function m(r,t){if(t<r[0])return 0;if(t>r[r.length-1])return 1;var n=function(r,t){var n=0,e=0,a=r.length;for(;e<a;)t<=r[n=e+a>>>1]?a=n:e=-~n;return e}(r,t);if(r[n]!==t)return n/r.length;n++;var e=function(r,t){var n=0,e=0,a=r.length;for(;e<a;)t>=r[n=e+a>>>1]?e=-~n:a=n;return e}(r,t);if(e===n)return n/r.length;var a=e-n+1;return a*(e+n)/2/a/r.length}function d(r){var t=g(r,.75),n=g(r,.25);if("number"==typeof t&&"number"==typeof n)return t-n}function b(r){return+g(r,.5)}function q(r){for(var t=b(r),n=[],e=0;e<r.length;e++)n.push(Math.abs(r[e]-t));return b(n)}function E(r,t){t=t||Math.random;for(var n,e,a=r.length;a>0;)e=Math.floor(t()*a--),n=r[a],r[a]=r[e],r[e]=n;return r}function y(r,t){return E(r.slice().slice(),t)}function S(r,t,n){return y(r,n).slice(0,t)}function x(r,t){for(var n=[],e=0;e<r;e++){for(var a=[],o=0;o<t;o++)a.push(0);n.push(a)}return n}function k(r){for(var t,n=0,e=0;e<r.length;e++)0!==e&&r[e]===t||(t=r[e],n++);return n}function P(r,t,n,e){var a;if(r>0){var o=(n[t]-n[r-1])/(t-r+1);a=e[t]-e[r-1]-(t-r+1)*o*o}else a=e[t]-n[t]*n[t]/(t+1);return a<0?0:a}function I(r,t,n,e,a,o,i){if(!(r>t)){var u=Math.floor((r+t)/2);e[n][u]=e[n-1][u-1],a[n][u]=u;var h=n;r>n&&(h=Math.max(h,a[n][r-1]||0)),h=Math.max(h,a[n-1][u]||0);var f,l,s,c=u-1;t<e.length-1&&(c=Math.min(c,a[n][t+1]||0));for(var v=c;v>=h&&!((f=P(v,u,o,i))+e[n-1][h-1]>=e[n][u]);--v)(l=P(h,u,o,i)+e[n-1][h-1])<e[n][u]&&(e[n][u]=l,a[n][u]=h),h++,(s=f+e[n-1][v-1])<e[n][u]&&(e[n][u]=s,a[n][u]=v);I(r,u-1,n,e,a,o,i),I(u+1,t,n,e,a,o,i)}}function A(r,t){if(r.length!==t.length)throw new Error("sampleCovariance requires samples with equal lengths");if(r.length<2)throw new Error("sampleCovariance requires at least two data points in each sample");for(var e=n(r),a=n(t),o=0,i=0;i<r.length;i++)o+=(r[i]-e)*(t[i]-a);return o/(r.length-1)}function C(r){if(r.length<2)throw new Error("sampleVariance requires at least two data points");return e(r,2)/(r.length-1)}function N(r){var t=C(r);return Math.sqrt(t)}function T(r,t,n,e){return(r*t+n*e)/(t+e)}function _(r){if(0===r.length)throw new Error("meanSimple requires at least one data point");return l(r)/r.length}function D(r){if(0===r.length)throw new Error("rootMeanSquare requires at least one data point");for(var t=0,n=0;n<r.length;n++)t+=Math.pow(r[n],2);return Math.sqrt(t/r.length)}var R=function(){this.totalCount=0,this.data={}};R.prototype.train=function(r,t){for(var n in this.data[t]||(this.data[t]={}),r){var e=r[n];void 0===this.data[t][n]&&(this.data[t][n]={}),void 0===this.data[t][n][e]&&(this.data[t][n][e]=0),this.data[t][n][e]++}this.totalCount++},R.prototype.score=function(r){var t,n={};for(var e in r){var a=r[e];for(t in this.data)n[t]={},this.data[t][e]?n[t][e+"_"+a]=(this.data[t][e][a]||0)/this.totalCount:n[t][e+"_"+a]=0}var o={};for(t in n)for(var i in o[t]=0,n[t])o[t]+=n[t][i];return o};var F=function(){this.weights=[],this.bias=0};F.prototype.predict=function(r){if(r.length!==this.weights.length)return null;for(var t=0,n=0;n<this.weights.length;n++)t+=this.weights[n]*r[n];return(t+=this.bias)>0?1:0},F.prototype.train=function(r,t){if(0!==t&&1!==t)return null;r.length!==this.weights.length&&(this.weights=r,this.bias=1);var n=this.predict(r);if("number"==typeof n&&n!==t){for(var e=t-n,a=0;a<this.weights.length;a++)this.weights[a]+=e*r[a];this.bias+=e}return this};var V=1e-4;function U(r){if(r<0)throw new Error("factorial requires a non-negative value");if(Math.floor(r)!==r)throw new Error("factorial requires an integer input");for(var t=1,n=2;n<=r;n++)t*=n;return t}var L=[.9999999999999971,57.15623566586292,-59.59796035547549,14.136097974741746,-.4919138160976202,3399464998481189e-20,4652362892704858e-20,-9837447530487956e-20,.0001580887032249125,-.00021026444172410488,.00021743961811521265,-.0001643181065367639,8441822398385275e-20,-26190838401581408e-21,36899182659531625e-22],z=Math.log(Math.sqrt(2*Math.PI));var X={1:{.995:0,.99:0,.975:0,.95:0,.9:.02,.5:.45,.1:2.71,.05:3.84,.025:5.02,.01:6.63,.005:7.88},2:{.995:.01,.99:.02,.975:.05,.95:.1,.9:.21,.5:1.39,.1:4.61,.05:5.99,.025:7.38,.01:9.21,.005:10.6},3:{.995:.07,.99:.11,.975:.22,.95:.35,.9:.58,.5:2.37,.1:6.25,.05:7.81,.025:9.35,.01:11.34,.005:12.84},4:{.995:.21,.99:.3,.975:.48,.95:.71,.9:1.06,.5:3.36,.1:7.78,.05:9.49,.025:11.14,.01:13.28,.005:14.86},5:{.995:.41,.99:.55,.975:.83,.95:1.15,.9:1.61,.5:4.35,.1:9.24,.05:11.07,.025:12.83,.01:15.09,.005:16.75},6:{.995:.68,.99:.87,.975:1.24,.95:1.64,.9:2.2,.5:5.35,.1:10.65,.05:12.59,.025:14.45,.01:16.81,.005:18.55},7:{.995:.99,.99:1.25,.975:1.69,.95:2.17,.9:2.83,.5:6.35,.1:12.02,.05:14.07,.025:16.01,.01:18.48,.005:20.28},8:{.995:1.34,.99:1.65,.975:2.18,.95:2.73,.9:3.49,.5:7.34,.1:13.36,.05:15.51,.025:17.53,.01:20.09,.005:21.96},9:{.995:1.73,.99:2.09,.975:2.7,.95:3.33,.9:4.17,.5:8.34,.1:14.68,.05:16.92,.025:19.02,.01:21.67,.005:23.59},10:{.995:2.16,.99:2.56,.975:3.25,.95:3.94,.9:4.87,.5:9.34,.1:15.99,.05:18.31,.025:20.48,.01:23.21,.005:25.19},11:{.995:2.6,.99:3.05,.975:3.82,.95:4.57,.9:5.58,.5:10.34,.1:17.28,.05:19.68,.025:21.92,.01:24.72,.005:26.76},12:{.995:3.07,.99:3.57,.975:4.4,.95:5.23,.9:6.3,.5:11.34,.1:18.55,.05:21.03,.025:23.34,.01:26.22,.005:28.3},13:{.995:3.57,.99:4.11,.975:5.01,.95:5.89,.9:7.04,.5:12.34,.1:19.81,.05:22.36,.025:24.74,.01:27.69,.005:29.82},14:{.995:4.07,.99:4.66,.975:5.63,.95:6.57,.9:7.79,.5:13.34,.1:21.06,.05:23.68,.025:26.12,.01:29.14,.005:31.32},15:{.995:4.6,.99:5.23,.975:6.27,.95:7.26,.9:8.55,.5:14.34,.1:22.31,.05:25,.025:27.49,.01:30.58,.005:32.8},16:{.995:5.14,.99:5.81,.975:6.91,.95:7.96,.9:9.31,.5:15.34,.1:23.54,.05:26.3,.025:28.85,.01:32,.005:34.27},17:{.995:5.7,.99:6.41,.975:7.56,.95:8.67,.9:10.09,.5:16.34,.1:24.77,.05:27.59,.025:30.19,.01:33.41,.005:35.72},18:{.995:6.26,.99:7.01,.975:8.23,.95:9.39,.9:10.87,.5:17.34,.1:25.99,.05:28.87,.025:31.53,.01:34.81,.005:37.16},19:{.995:6.84,.99:7.63,.975:8.91,.95:10.12,.9:11.65,.5:18.34,.1:27.2,.05:30.14,.025:32.85,.01:36.19,.005:38.58},20:{.995:7.43,.99:8.26,.975:9.59,.95:10.85,.9:12.44,.5:19.34,.1:28.41,.05:31.41,.025:34.17,.01:37.57,.005:40},21:{.995:8.03,.99:8.9,.975:10.28,.95:11.59,.9:13.24,.5:20.34,.1:29.62,.05:32.67,.025:35.48,.01:38.93,.005:41.4},22:{.995:8.64,.99:9.54,.975:10.98,.95:12.34,.9:14.04,.5:21.34,.1:30.81,.05:33.92,.025:36.78,.01:40.29,.005:42.8},23:{.995:9.26,.99:10.2,.975:11.69,.95:13.09,.9:14.85,.5:22.34,.1:32.01,.05:35.17,.025:38.08,.01:41.64,.005:44.18},24:{.995:9.89,.99:10.86,.975:12.4,.95:13.85,.9:15.66,.5:23.34,.1:33.2,.05:36.42,.025:39.36,.01:42.98,.005:45.56},25:{.995:10.52,.99:11.52,.975:13.12,.95:14.61,.9:16.47,.5:24.34,.1:34.28,.05:37.65,.025:40.65,.01:44.31,.005:46.93},26:{.995:11.16,.99:12.2,.975:13.84,.95:15.38,.9:17.29,.5:25.34,.1:35.56,.05:38.89,.025:41.92,.01:45.64,.005:48.29},27:{.995:11.81,.99:12.88,.975:14.57,.95:16.15,.9:18.11,.5:26.34,.1:36.74,.05:40.11,.025:43.19,.01:46.96,.005:49.65},28:{.995:12.46,.99:13.57,.975:15.31,.95:16.93,.9:18.94,.5:27.34,.1:37.92,.05:41.34,.025:44.46,.01:48.28,.005:50.99},29:{.995:13.12,.99:14.26,.975:16.05,.95:17.71,.9:19.77,.5:28.34,.1:39.09,.05:42.56,.025:45.72,.01:49.59,.005:52.34},30:{.995:13.79,.99:14.95,.975:16.79,.95:18.49,.9:20.6,.5:29.34,.1:40.26,.05:43.77,.025:46.98,.01:50.89,.005:53.67},40:{.995:20.71,.99:22.16,.975:24.43,.95:26.51,.9:29.05,.5:39.34,.1:51.81,.05:55.76,.025:59.34,.01:63.69,.005:66.77},50:{.995:27.99,.99:29.71,.975:32.36,.95:34.76,.9:37.69,.5:49.33,.1:63.17,.05:67.5,.025:71.42,.01:76.15,.005:79.49},60:{.995:35.53,.99:37.48,.975:40.48,.95:43.19,.9:46.46,.5:59.33,.1:74.4,.05:79.08,.025:83.3,.01:88.38,.005:91.95},70:{.995:43.28,.99:45.44,.975:48.76,.95:51.74,.9:55.33,.5:69.33,.1:85.53,.05:90.53,.025:95.02,.01:100.42,.005:104.22},80:{.995:51.17,.99:53.54,.975:57.15,.95:60.39,.9:64.28,.5:79.33,.1:96.58,.05:101.88,.025:106.63,.01:112.33,.005:116.32},90:{.995:59.2,.99:61.75,.975:65.65,.95:69.13,.9:73.29,.5:89.33,.1:107.57,.05:113.14,.025:118.14,.01:124.12,.005:128.3},100:{.995:67.33,.99:70.06,.975:74.22,.95:77.93,.9:82.36,.5:99.33,.1:118.5,.05:124.34,.025:129.56,.01:135.81,.005:140.17}};var j=Math.sqrt(2*Math.PI),B={gaussian:function(r){return Math.exp(-.5*r*r)/j}},K={nrd:function(r){var t=N(r),n=d(r);return"number"==typeof n&&(t=Math.min(t,n/1.34)),1.06*t*Math.pow(r.length,-.2)}};function O(r,t,n){var e,a;if(void 0===t)e=B.gaussian;else if("string"==typeof t){if(!B[t])throw new Error('Unknown kernel "'+t+'"');e=B[t]}else e=t;if(void 0===n)a=K.nrd(r);else if("string"==typeof n){if(!K[n])throw new Error('Unknown bandwidth method "'+n+'"');a=K[n](r)}else a=n;return function(t){var n=0,o=0;for(n=0;n<r.length;n++)o+=e((t-r[n])/a);return o/a/r.length}}var G=Math.sqrt(2*Math.PI);function H(r){for(var t=r,n=r,e=1;e<15;e++)t+=n*=r*r/(2*e+1);return Math.round(1e4*(.5+t/G*Math.exp(-r*r/2)))/1e4}for(var W=[],J=0;J<=3.09;J+=.01)W.push(H(J));function Q(r){var t=1/(1+.5*Math.abs(r)),n=t*Math.exp(-r*r+((((((((.17087277*t-.82215223)*t+1.48851587)*t-1.13520398)*t+.27886807)*t-.18628806)*t+.09678418)*t+.37409196)*t+1.00002368)*t-1.26551223);return r>=0?1-n:n-1}function Y(r){var t=8*(Math.PI-3)/(3*Math.PI*(4-Math.PI)),n=Math.sqrt(Math.sqrt(Math.pow(2/(Math.PI*t)+Math.log(1-r*r)/2,2)-Math.log(1-r*r)/t)-(2/(Math.PI*t)+Math.log(1-r*r)/2));return r>=0?n:-n}function Z(r){if("number"==typeof r)return r<0?-1:0===r?0:1;throw new TypeError("not a number")}function $(r,t){for(var n=0,e=0;e<r.length;e++){var a=r[e]-t[e];n+=a*a}return Math.sqrt(n)}function rr(r,t){return r.map((function(r){for(var n=Number.MAX_VALUE,e=-1,a=0;a<t.length;a++){var o=$(r,t[a]);o<n&&(n=o,e=a)}return e}))}function tr(r,t,n){for(var e=r[0].length,a=x(n,e),o=Array(n).fill(0),i=r.length,u=0;u<i;u++){for(var h=r[u],f=t[u],l=a[f],s=0;s<e;s++)l[s]+=h[s];o[f]+=1}for(var c=0;c<n;c++){if(0===o[c])throw new Error("Centroid "+c+" has no friends");for(var v=a[c],g=0;g<e;g++)v[g]/=o[c]}return a}function nr(r,t){for(var n=0,e=0;e<r.length;e++)n+=$(r[e],t[e]);return n}function er(r,t){if(r.length!==t.length)throw new Error("must have exactly as many labels as points");for(var n=function(r){for(var t=1+f(r),n=Array(t),e=0;e<r.length;e++){var a=r[e];void 0===n[a]&&(n[a]=[]),n[a].push(e)}return n}(t),e=function(r){for(var t=r.length,n=x(t,t),e=0;e<t;e++)for(var a=0;a<e;a++)n[e][a]=$(r[e],r[a]),n[a][e]=n[e][a];return n}(r),a=[],o=0;o<r.length;o++){var i=0;if(n[t[o]].length>1){var u=or(o,n[t[o]],e),h=ar(o,t,n,e);i=(h-u)/Math.max(u,h)}a.push(i)}return a}function ar(r,t,n,e){for(var a=t[r],o=Number.MAX_VALUE,i=0;i<n.length;i++)if(i!==a){var u=or(r,n[i],e);u<o&&(o=u)}return o}function or(r,t,n){for(var e=0,a=0;a<t.length;a++)e+=n[r][t[a]];return e/t.length}function ir(r,t){return 0===r&&0===t?0:Math.abs((r-t)/t)}r.BayesianClassifier=R,r.PerceptronModel=F,r.addToMean=function(r,t,n){return r+(n-r)/(t+1)},r.approxEqual=function(r,t,n){return void 0===n&&(n=V),ir(r,t)<=n},r.average=n,r.averageSimple=_,r.bayesian=R,r.bernoulliDistribution=function(r){if(r<0||r>1)throw new Error("bernoulliDistribution requires probability to be between 0 and 1 inclusive");return[1-r,r]},r.binomialDistribution=function(r,t){if(!(t<0||t>1||r<=0||r%1!=0)){var n=0,e=0,a=[],o=1;do{a[n]=o*Math.pow(t,n)*Math.pow(1-t,r-n),e+=a[n],o=o*(r-++n+1)/n}while(e<.9999);return a}},r.bisect=function(r,t,n,e,a){if("function"!=typeof r)throw new TypeError("func must be a function");for(var o=0;o<e;o++){var i=(t+n)/2;if(0===r(i)||Math.abs((n-t)/2)<a)return i;Z(r(i))===Z(r(t))?t=i:n=i}throw new Error("maximum number of iterations exceeded")},r.chiSquaredDistributionTable=X,r.chiSquaredGoodnessOfFit=function(r,t,e){for(var a=0,o=t(n(r)),i=[],u=[],h=0;h<r.length;h++)void 0===i[r[h]]&&(i[r[h]]=0),i[r[h]]++;for(var f=0;f<i.length;f++)void 0===i[f]&&(i[f]=0);for(var l in o)l in i&&(u[+l]=o[l]*r.length);for(var s=u.length-1;s>=0;s--)u[s]<3&&(u[s-1]+=u[s],u.pop(),i[s-1]+=i[s],i.pop());for(var c=0;c<i.length;c++)a+=Math.pow(i[c]-u[c],2)/u[c];var v=i.length-1-1;return X[v][e]<a},r.chunk=function(r,t){var n=[];if(t<1)throw new Error("chunk size must be a positive number");if(Math.floor(t)!==t)throw new Error("chunk size must be an integer");for(var e=0;e<r.length;e+=t)n.push(r.slice(e,e+t));return n},r.ckmeans=function(r,t){if(t>r.length)throw new Error("cannot generate more classes than there are data values");var n=u(r);if(1===k(n))return[n];var e=x(t,n.length),a=x(t,n.length);!function(r,t,n){for(var e=t[0].length,a=r[Math.floor(e/2)],o=[],i=[],u=0,h=void 0;u<e;++u)h=r[u]-a,0===u?(o.push(h),i.push(h*h)):(o.push(o[u-1]+h),i.push(i[u-1]+h*h)),t[0][u]=P(0,u,o,i),n[0][u]=0;for(var f=1;f<t.length;++f)I(f<t.length-1?f:e-1,e-1,f,t,n,o,i)}(n,e,a);for(var o=[],i=a[0].length-1,h=a.length-1;h>=0;h--){var f=a[h][i];o[h]=n.slice(f,i+1),h>0&&(i=f-1)}return o},r.combinations=function r(t,n){var e,a,o,i,u=[];for(e=0;e<t.length;e++)if(1===n)u.push([t[e]]);else for(o=r(t.slice(e+1,t.length),n-1),a=0;a<o.length;a++)(i=o[a]).unshift(t[e]),u.push(i);return u},r.combinationsReplacement=function r(t,n){for(var e=[],a=0;a<t.length;a++)if(1===n)e.push([t[a]]);else for(var o=r(t.slice(a,t.length),n-1),i=0;i<o.length;i++)e.push([t[a]].concat(o[i]));return e},r.combineMeans=T,r.combineVariances=function(r,t,n,e,a,o){var i=T(t,n,a,o);return(n*(r+Math.pow(t-i,2))+o*(e+Math.pow(a-i,2)))/(n+o)},r.cumulativeStdNormalProbability=function(r){var t=Math.abs(r),n=Math.min(Math.round(100*t),W.length-1);return r>=0?W[n]:+(1-W[n]).toFixed(4)},r.epsilon=V,r.equalIntervalBreaks=function(r,t){if(r.length<2)return r;for(var n=h(r),e=f(r),a=[n],o=(e-n)/t,i=1;i<t;i++)a.push(a[0]+o*i);return a.push(e),a},r.erf=Q,r.errorFunction=Q,r.extent=function(r){if(0===r.length)throw new Error("extent requires at least one data point");for(var t=r[0],n=r[0],e=1;e<r.length;e++)r[e]>n&&(n=r[e]),r[e]<t&&(t=r[e]);return[t,n]},r.extentSorted=function(r){return[r[0],r[r.length-1]]},r.factorial=U,r.gamma=function r(t){if(Number.isInteger(t))return t<=0?NaN:U(t-1);if(--t<0)return Math.PI/(Math.sin(Math.PI*-t)*r(-t));var n=t+1/4;return Math.pow(t/Math.E,t)*Math.sqrt(2*Math.PI*(t+1/6))*(1+1/144/Math.pow(n,2)-1/12960/Math.pow(n,3)-257/207360/Math.pow(n,4)-52/2612736/Math.pow(n,5)+5741173/9405849600/Math.pow(n,6)+37529/18811699200/Math.pow(n,7))},r.gammaln=function(r){if(r<=0)return 1/0;r--;for(var t=L[0],n=1;n<15;n++)t+=L[n]/(r+n);var e=5.2421875+r;return z+Math.log(t)-e+(r+.5)*Math.log(e)},r.geometricMean=function(r){if(0===r.length)throw new Error("geometricMean requires at least one data point");for(var t=1,n=0;n<r.length;n++){if(r[n]<=0)throw new Error("geometricMean requires only positive numbers as input");t*=r[n]}return Math.pow(t,1/r.length)},r.harmonicMean=function(r){if(0===r.length)throw new Error("harmonicMean requires at least one data point");for(var t=0,n=0;n<r.length;n++){if(r[n]<=0)throw new Error("harmonicMean requires only positive numbers as input");t+=1/r[n]}return r.length/t},r.interquartileRange=d,r.inverseErrorFunction=Y,r.iqr=d,r.kMeansCluster=function(r,t,n){void 0===n&&(n=Math.random);for(var e=null,a=S(r,t,n),o=null,i=Number.MAX_VALUE;0!==i;)e=a,i=nr(a=tr(r,o=rr(r,a),t),e);return{labels:o,centroids:a}},r.kde=O,r.kernelDensityEstimation=O,r.linearRegression=function(r){var t,n,e=r.length;if(1===e)t=0,n=r[0][1];else{for(var a,o,i,u=0,h=0,f=0,l=0,s=0;s<e;s++)u+=o=(a=r[s])[0],h+=i=a[1],f+=o*o,l+=o*i;n=h/e-(t=(e*l-u*h)/(e*f-u*u))*u/e}return{m:t,b:n}},r.linearRegressionLine=function(r){return function(t){return r.b+r.m*t}},r.mad=q,r.max=f,r.maxSorted=function(r){return r[r.length-1]},r.mean=n,r.meanSimple=_,r.median=b,r.medianAbsoluteDeviation=q,r.medianSorted=function(r){return s(r,.5)},r.min=h,r.minSorted=function(r){return r[0]},r.mode=function(r){return i(u(r))},r.modeFast=function(r){for(var t,n=new Map,e=0,a=0;a<r.length;a++){var o=n.get(r[a]);void 0===o?o=1:o++,o>e&&(t=r[a],e=o),n.set(r[a],o)}if(0===e)throw new Error("mode requires at last one data point");return t},r.modeSorted=i,r.numericSort=u,r.perceptron=F,r.permutationTest=function(r,t,e,a,o){if(void 0===a&&(a=1e4),void 0===e&&(e="two_side"),"two_side"!==e&&"greater"!==e&&"less"!==e)throw new Error("`alternative` must be either 'two_side', 'greater', or 'less'");for(var i=n(r)-n(t),u=new Array(a),h=r.concat(t),f=Math.floor(h.length/2),l=0;l<a;l++){E(h,o);var s=h.slice(0,f),c=h.slice(f,h.length),v=n(s)-n(c);u[l]=v}var g=0;if("two_side"===e)for(var p=0;p<=a;p++)Math.abs(u[p])>=Math.abs(i)&&(g+=1);else if("greater"===e)for(var M=0;M<=a;M++)u[M]>=i&&(g+=1);else for(var w=0;w<=a;w++)u[w]<=i&&(g+=1);return g/a},r.permutationsHeap=function(r){for(var t=new Array(r.length),n=[r.slice()],e=0;e<r.length;e++)t[e]=0;for(var a=0;a<r.length;)if(t[a]<a){var o=0;a%2!=0&&(o=t[a]);var i=r[o];r[o]=r[a],r[a]=i,n.push(r.slice()),t[a]++,a=0}else t[a]=0,a++;return n},r.poissonDistribution=function(r){if(!(r<=0)){var t=0,n=0,e=[],a=1;do{e[t]=Math.exp(-r)*Math.pow(r,t)/a,n+=e[t],a*=++t}while(n<.9999);return e}},r.probit=function(r){return 0===r?r=V:r>=1&&(r=.9999),Math.sqrt(2)*Y(2*r-1)},r.product=function(r){for(var t=1,n=0;n<r.length;n++)t*=r[n];return t},r.quantile=g,r.quantileRank=function(r,t){return m(u(r),t)},r.quantileRankSorted=m,r.quantileSorted=s,r.quickselect=c,r.rSquared=function(r,t){if(r.length<2)return 1;for(var n=0,e=0;e<r.length;e++)n+=r[e][1];for(var a=n/r.length,o=0,i=0;i<r.length;i++)o+=Math.pow(a-r[i][1],2);for(var u=0,h=0;h<r.length;h++)u+=Math.pow(r[h][1]-t(r[h][0]),2);return 1-u/o},r.relativeError=ir,r.rms=D,r.rootMeanSquare=D,r.sample=S,r.sampleCorrelation=function(r,t){return A(r,t)/N(r)/N(t)},r.sampleCovariance=A,r.sampleKurtosis=function(r){var t=r.length;if(t<4)throw new Error("sampleKurtosis requires at least four data points");for(var e,a=n(r),o=0,i=0,u=0;u<t;u++)o+=(e=r[u]-a)*e,i+=e*e*e*e;return(t-1)/((t-2)*(t-3))*(t*(t+1)*i/(o*o)-3*(t-1))},r.sampleSkewness=function(r){if(r.length<3)throw new Error("sampleSkewness requires at least three data points");for(var t,e=n(r),a=0,o=0,i=0;i<r.length;i++)a+=(t=r[i]-e)*t,o+=t*t*t;var u=r.length-1,h=Math.sqrt(a/u),f=r.length;return f*o/((f-1)*(f-2)*Math.pow(h,3))},r.sampleStandardDeviation=N,r.sampleVariance=C,r.sampleWithReplacement=function(r,t,n){if(0===r.length)return[];n=n||Math.random;for(var e=r.length,a=[],o=0;o<t;o++){var i=Math.floor(n()*e);a.push(r[i])}return a},r.shuffle=y,r.shuffleInPlace=E,r.sign=Z,r.silhouette=er,r.silhouetteMetric=function(r,t){return f(er(r,t))},r.standardDeviation=o,r.standardNormalTable=W,r.subtractFromMean=function(r,t,n){return(r*t-n)/(t-1)},r.sum=t,r.sumNthPowerDeviations=e,r.sumSimple=l,r.tTest=function(r,t){return(n(r)-t)/(o(r)/Math.sqrt(r.length))},r.tTestTwoSample=function(r,t,e){var a=r.length,o=t.length;if(!a||!o)return null;e||(e=0);var i=n(r),u=n(t),h=C(r),f=C(t);if("number"==typeof i&&"number"==typeof u&&"number"==typeof h&&"number"==typeof f){var l=((a-1)*h+(o-1)*f)/(a+o-2);return(i-u-e)/Math.sqrt(l*(1/a+1/o))}},r.uniqueCountSorted=k,r.variance=a,r.zScore=function(r,t,n){return(r-t)/n},Object.defineProperty(r,"__esModule",{value:!0})}));
//# sourceMappingURL=simple-statistics.min.js.map

@@ -131,1 +131,3 @@ // # simple-statistics

export { default as numericSort } from "./src/numeric_sort";
export { default as relativeError } from "./src/relative_error";
export { default as approxEqual } from "./src/approx_equal";
{
"name": "simple-statistics",
"version": "7.2.0",
"version": "7.3.0",
"description": "Simple Statistics",

@@ -25,6 +25,6 @@ "author": "Tom MacWright <tom@macwright.org> (http://macwright.org/)",

"rollup": "^2.3.2",
"rollup-plugin-terser": "^6.1.0",
"standard-version": "^8.0.0",
"rollup-plugin-terser": "^7.0.1",
"standard-version": "^9.0.0",
"tap": "^14.4.1",
"typescript": "^3.6.4"
"typescript": "^4.0.2"
},

@@ -37,3 +37,3 @@ "scripts": {

"prelint": "tsc --skipLibCheck",
"lint": "eslint index.js src test",
"lint": "eslint index.js src test && prettier --check src/*.d.ts",
"postlint": "documentation lint src"

@@ -40,0 +40,0 @@ },

@@ -39,3 +39,3 @@ # Simple Statistics

```HTML
<script src='https://unpkg.com/simple-statistics@7.2.0/dist/simple-statistics.min.js'>
<script src='https://unpkg.com/simple-statistics@7.3.0/dist/simple-statistics.min.js'>
</script>

@@ -49,3 +49,3 @@ ```

<script type='module'>
import {min} from "https://unpkg.com/simple-statistics@7.2.0/index.js?module"
import {min} from "https://unpkg.com/simple-statistics@7.3.0/index.js?module"
console.log(min([1, 2, 3]))

@@ -52,0 +52,0 @@ </script>

/**
* https://simplestatistics.org/docs/#addtomean
*/
declare function addToMean(
mean: number,
n: number,
newValue: number
): number
declare function addToMean(mean: number, n: number, newValue: number): number;
export default addToMean
export default addToMean;

@@ -9,8 +9,8 @@ type Data = object;

declare class BayesianClassifier {
public totalCount: number;
public data: Data;
train(item: Item, category: string): void
score(item: Item): OddsSums
public totalCount: number;
public data: Data;
train(item: Item, category: string): void;
score(item: Item): OddsSums;
}
export default BayesianClassifier;
/**
* https://simplestatistics.org/docs/#bernoullidistribution
*/
declare function bernoulliDistribution(
p: number
): number[]
declare function bernoulliDistribution(p: number): number[];
export default bernoulliDistribution;

@@ -5,6 +5,6 @@ /**

declare function binomialDistribution(
trials: number,
probability: number
): number[]
trials: number,
probability: number
): number[];
export default binomialDistribution;

@@ -5,9 +5,9 @@ /**

declare function bisect(
func: (x: any) => number,
start: number,
end: number,
maxIterations: number,
errorTolerance: number
): number
func: (x: any) => number,
start: number,
end: number,
maxIterations: number,
errorTolerance: number
): number;
export default bisect;
export interface DistributionTable {
0.995: number;
0.99: number;
0.975: number;
0.95: number;
0.9: number;
0.5: number;
0.1: number;
0.05: number;
0.025: number;
0.01: number;
0.005: number;
0.995: number;
0.99: number;
0.975: number;
0.95: number;
0.9: number;
0.5: number;
0.1: number;
0.05: number;
0.025: number;
0.01: number;
0.005: number;
}

@@ -19,41 +19,41 @@

declare const chiSquaredDistributionTable: {
1: DistributionTable;
2: DistributionTable;
3: DistributionTable;
4: DistributionTable;
5: DistributionTable;
6: DistributionTable;
7: DistributionTable;
8: DistributionTable;
9: DistributionTable;
10: DistributionTable;
11: DistributionTable;
12: DistributionTable;
13: DistributionTable;
14: DistributionTable;
15: DistributionTable;
16: DistributionTable;
17: DistributionTable;
18: DistributionTable;
19: DistributionTable;
20: DistributionTable;
21: DistributionTable;
22: DistributionTable;
23: DistributionTable;
24: DistributionTable;
25: DistributionTable;
26: DistributionTable;
27: DistributionTable;
28: DistributionTable;
29: DistributionTable;
30: DistributionTable;
40: DistributionTable;
50: DistributionTable;
60: DistributionTable;
70: DistributionTable;
80: DistributionTable;
90: DistributionTable;
100: DistributionTable;
}
1: DistributionTable;
2: DistributionTable;
3: DistributionTable;
4: DistributionTable;
5: DistributionTable;
6: DistributionTable;
7: DistributionTable;
8: DistributionTable;
9: DistributionTable;
10: DistributionTable;
11: DistributionTable;
12: DistributionTable;
13: DistributionTable;
14: DistributionTable;
15: DistributionTable;
16: DistributionTable;
17: DistributionTable;
18: DistributionTable;
19: DistributionTable;
20: DistributionTable;
21: DistributionTable;
22: DistributionTable;
23: DistributionTable;
24: DistributionTable;
25: DistributionTable;
26: DistributionTable;
27: DistributionTable;
28: DistributionTable;
29: DistributionTable;
30: DistributionTable;
40: DistributionTable;
50: DistributionTable;
60: DistributionTable;
70: DistributionTable;
80: DistributionTable;
90: DistributionTable;
100: DistributionTable;
};
export default chiSquaredDistributionTable;

@@ -13,482 +13,482 @@ /**

const chiSquaredDistributionTable = {
"1": {
"0.995": 0,
"0.99": 0,
"0.975": 0,
"0.95": 0,
"0.9": 0.02,
"0.5": 0.45,
"0.1": 2.71,
"0.05": 3.84,
"0.025": 5.02,
"0.01": 6.63,
"0.005": 7.88
1: {
0.995: 0,
0.99: 0,
0.975: 0,
0.95: 0,
0.9: 0.02,
0.5: 0.45,
0.1: 2.71,
0.05: 3.84,
0.025: 5.02,
0.01: 6.63,
0.005: 7.88
},
"2": {
"0.995": 0.01,
"0.99": 0.02,
"0.975": 0.05,
"0.95": 0.1,
"0.9": 0.21,
"0.5": 1.39,
"0.1": 4.61,
"0.05": 5.99,
"0.025": 7.38,
"0.01": 9.21,
"0.005": 10.6
2: {
0.995: 0.01,
0.99: 0.02,
0.975: 0.05,
0.95: 0.1,
0.9: 0.21,
0.5: 1.39,
0.1: 4.61,
0.05: 5.99,
0.025: 7.38,
0.01: 9.21,
0.005: 10.6
},
"3": {
"0.995": 0.07,
"0.99": 0.11,
"0.975": 0.22,
"0.95": 0.35,
"0.9": 0.58,
"0.5": 2.37,
"0.1": 6.25,
"0.05": 7.81,
"0.025": 9.35,
"0.01": 11.34,
"0.005": 12.84
3: {
0.995: 0.07,
0.99: 0.11,
0.975: 0.22,
0.95: 0.35,
0.9: 0.58,
0.5: 2.37,
0.1: 6.25,
0.05: 7.81,
0.025: 9.35,
0.01: 11.34,
0.005: 12.84
},
"4": {
"0.995": 0.21,
"0.99": 0.3,
"0.975": 0.48,
"0.95": 0.71,
"0.9": 1.06,
"0.5": 3.36,
"0.1": 7.78,
"0.05": 9.49,
"0.025": 11.14,
"0.01": 13.28,
"0.005": 14.86
4: {
0.995: 0.21,
0.99: 0.3,
0.975: 0.48,
0.95: 0.71,
0.9: 1.06,
0.5: 3.36,
0.1: 7.78,
0.05: 9.49,
0.025: 11.14,
0.01: 13.28,
0.005: 14.86
},
"5": {
"0.995": 0.41,
"0.99": 0.55,
"0.975": 0.83,
"0.95": 1.15,
"0.9": 1.61,
"0.5": 4.35,
"0.1": 9.24,
"0.05": 11.07,
"0.025": 12.83,
"0.01": 15.09,
"0.005": 16.75
5: {
0.995: 0.41,
0.99: 0.55,
0.975: 0.83,
0.95: 1.15,
0.9: 1.61,
0.5: 4.35,
0.1: 9.24,
0.05: 11.07,
0.025: 12.83,
0.01: 15.09,
0.005: 16.75
},
"6": {
"0.995": 0.68,
"0.99": 0.87,
"0.975": 1.24,
"0.95": 1.64,
"0.9": 2.2,
"0.5": 5.35,
"0.1": 10.65,
"0.05": 12.59,
"0.025": 14.45,
"0.01": 16.81,
"0.005": 18.55
6: {
0.995: 0.68,
0.99: 0.87,
0.975: 1.24,
0.95: 1.64,
0.9: 2.2,
0.5: 5.35,
0.1: 10.65,
0.05: 12.59,
0.025: 14.45,
0.01: 16.81,
0.005: 18.55
},
"7": {
"0.995": 0.99,
"0.99": 1.25,
"0.975": 1.69,
"0.95": 2.17,
"0.9": 2.83,
"0.5": 6.35,
"0.1": 12.02,
"0.05": 14.07,
"0.025": 16.01,
"0.01": 18.48,
"0.005": 20.28
7: {
0.995: 0.99,
0.99: 1.25,
0.975: 1.69,
0.95: 2.17,
0.9: 2.83,
0.5: 6.35,
0.1: 12.02,
0.05: 14.07,
0.025: 16.01,
0.01: 18.48,
0.005: 20.28
},
"8": {
"0.995": 1.34,
"0.99": 1.65,
"0.975": 2.18,
"0.95": 2.73,
"0.9": 3.49,
"0.5": 7.34,
"0.1": 13.36,
"0.05": 15.51,
"0.025": 17.53,
"0.01": 20.09,
"0.005": 21.96
8: {
0.995: 1.34,
0.99: 1.65,
0.975: 2.18,
0.95: 2.73,
0.9: 3.49,
0.5: 7.34,
0.1: 13.36,
0.05: 15.51,
0.025: 17.53,
0.01: 20.09,
0.005: 21.96
},
"9": {
"0.995": 1.73,
"0.99": 2.09,
"0.975": 2.7,
"0.95": 3.33,
"0.9": 4.17,
"0.5": 8.34,
"0.1": 14.68,
"0.05": 16.92,
"0.025": 19.02,
"0.01": 21.67,
"0.005": 23.59
9: {
0.995: 1.73,
0.99: 2.09,
0.975: 2.7,
0.95: 3.33,
0.9: 4.17,
0.5: 8.34,
0.1: 14.68,
0.05: 16.92,
0.025: 19.02,
0.01: 21.67,
0.005: 23.59
},
"10": {
"0.995": 2.16,
"0.99": 2.56,
"0.975": 3.25,
"0.95": 3.94,
"0.9": 4.87,
"0.5": 9.34,
"0.1": 15.99,
"0.05": 18.31,
"0.025": 20.48,
"0.01": 23.21,
"0.005": 25.19
10: {
0.995: 2.16,
0.99: 2.56,
0.975: 3.25,
0.95: 3.94,
0.9: 4.87,
0.5: 9.34,
0.1: 15.99,
0.05: 18.31,
0.025: 20.48,
0.01: 23.21,
0.005: 25.19
},
"11": {
"0.995": 2.6,
"0.99": 3.05,
"0.975": 3.82,
"0.95": 4.57,
"0.9": 5.58,
"0.5": 10.34,
"0.1": 17.28,
"0.05": 19.68,
"0.025": 21.92,
"0.01": 24.72,
"0.005": 26.76
11: {
0.995: 2.6,
0.99: 3.05,
0.975: 3.82,
0.95: 4.57,
0.9: 5.58,
0.5: 10.34,
0.1: 17.28,
0.05: 19.68,
0.025: 21.92,
0.01: 24.72,
0.005: 26.76
},
"12": {
"0.995": 3.07,
"0.99": 3.57,
"0.975": 4.4,
"0.95": 5.23,
"0.9": 6.3,
"0.5": 11.34,
"0.1": 18.55,
"0.05": 21.03,
"0.025": 23.34,
"0.01": 26.22,
"0.005": 28.3
12: {
0.995: 3.07,
0.99: 3.57,
0.975: 4.4,
0.95: 5.23,
0.9: 6.3,
0.5: 11.34,
0.1: 18.55,
0.05: 21.03,
0.025: 23.34,
0.01: 26.22,
0.005: 28.3
},
"13": {
"0.995": 3.57,
"0.99": 4.11,
"0.975": 5.01,
"0.95": 5.89,
"0.9": 7.04,
"0.5": 12.34,
"0.1": 19.81,
"0.05": 22.36,
"0.025": 24.74,
"0.01": 27.69,
"0.005": 29.82
13: {
0.995: 3.57,
0.99: 4.11,
0.975: 5.01,
0.95: 5.89,
0.9: 7.04,
0.5: 12.34,
0.1: 19.81,
0.05: 22.36,
0.025: 24.74,
0.01: 27.69,
0.005: 29.82
},
"14": {
"0.995": 4.07,
"0.99": 4.66,
"0.975": 5.63,
"0.95": 6.57,
"0.9": 7.79,
"0.5": 13.34,
"0.1": 21.06,
"0.05": 23.68,
"0.025": 26.12,
"0.01": 29.14,
"0.005": 31.32
14: {
0.995: 4.07,
0.99: 4.66,
0.975: 5.63,
0.95: 6.57,
0.9: 7.79,
0.5: 13.34,
0.1: 21.06,
0.05: 23.68,
0.025: 26.12,
0.01: 29.14,
0.005: 31.32
},
"15": {
"0.995": 4.6,
"0.99": 5.23,
"0.975": 6.27,
"0.95": 7.26,
"0.9": 8.55,
"0.5": 14.34,
"0.1": 22.31,
"0.05": 25,
"0.025": 27.49,
"0.01": 30.58,
"0.005": 32.8
15: {
0.995: 4.6,
0.99: 5.23,
0.975: 6.27,
0.95: 7.26,
0.9: 8.55,
0.5: 14.34,
0.1: 22.31,
0.05: 25,
0.025: 27.49,
0.01: 30.58,
0.005: 32.8
},
"16": {
"0.995": 5.14,
"0.99": 5.81,
"0.975": 6.91,
"0.95": 7.96,
"0.9": 9.31,
"0.5": 15.34,
"0.1": 23.54,
"0.05": 26.3,
"0.025": 28.85,
"0.01": 32,
"0.005": 34.27
16: {
0.995: 5.14,
0.99: 5.81,
0.975: 6.91,
0.95: 7.96,
0.9: 9.31,
0.5: 15.34,
0.1: 23.54,
0.05: 26.3,
0.025: 28.85,
0.01: 32,
0.005: 34.27
},
"17": {
"0.995": 5.7,
"0.99": 6.41,
"0.975": 7.56,
"0.95": 8.67,
"0.9": 10.09,
"0.5": 16.34,
"0.1": 24.77,
"0.05": 27.59,
"0.025": 30.19,
"0.01": 33.41,
"0.005": 35.72
17: {
0.995: 5.7,
0.99: 6.41,
0.975: 7.56,
0.95: 8.67,
0.9: 10.09,
0.5: 16.34,
0.1: 24.77,
0.05: 27.59,
0.025: 30.19,
0.01: 33.41,
0.005: 35.72
},
"18": {
"0.995": 6.26,
"0.99": 7.01,
"0.975": 8.23,
"0.95": 9.39,
"0.9": 10.87,
"0.5": 17.34,
"0.1": 25.99,
"0.05": 28.87,
"0.025": 31.53,
"0.01": 34.81,
"0.005": 37.16
18: {
0.995: 6.26,
0.99: 7.01,
0.975: 8.23,
0.95: 9.39,
0.9: 10.87,
0.5: 17.34,
0.1: 25.99,
0.05: 28.87,
0.025: 31.53,
0.01: 34.81,
0.005: 37.16
},
"19": {
"0.995": 6.84,
"0.99": 7.63,
"0.975": 8.91,
"0.95": 10.12,
"0.9": 11.65,
"0.5": 18.34,
"0.1": 27.2,
"0.05": 30.14,
"0.025": 32.85,
"0.01": 36.19,
"0.005": 38.58
19: {
0.995: 6.84,
0.99: 7.63,
0.975: 8.91,
0.95: 10.12,
0.9: 11.65,
0.5: 18.34,
0.1: 27.2,
0.05: 30.14,
0.025: 32.85,
0.01: 36.19,
0.005: 38.58
},
"20": {
"0.995": 7.43,
"0.99": 8.26,
"0.975": 9.59,
"0.95": 10.85,
"0.9": 12.44,
"0.5": 19.34,
"0.1": 28.41,
"0.05": 31.41,
"0.025": 34.17,
"0.01": 37.57,
"0.005": 40
20: {
0.995: 7.43,
0.99: 8.26,
0.975: 9.59,
0.95: 10.85,
0.9: 12.44,
0.5: 19.34,
0.1: 28.41,
0.05: 31.41,
0.025: 34.17,
0.01: 37.57,
0.005: 40
},
"21": {
"0.995": 8.03,
"0.99": 8.9,
"0.975": 10.28,
"0.95": 11.59,
"0.9": 13.24,
"0.5": 20.34,
"0.1": 29.62,
"0.05": 32.67,
"0.025": 35.48,
"0.01": 38.93,
"0.005": 41.4
21: {
0.995: 8.03,
0.99: 8.9,
0.975: 10.28,
0.95: 11.59,
0.9: 13.24,
0.5: 20.34,
0.1: 29.62,
0.05: 32.67,
0.025: 35.48,
0.01: 38.93,
0.005: 41.4
},
"22": {
"0.995": 8.64,
"0.99": 9.54,
"0.975": 10.98,
"0.95": 12.34,
"0.9": 14.04,
"0.5": 21.34,
"0.1": 30.81,
"0.05": 33.92,
"0.025": 36.78,
"0.01": 40.29,
"0.005": 42.8
22: {
0.995: 8.64,
0.99: 9.54,
0.975: 10.98,
0.95: 12.34,
0.9: 14.04,
0.5: 21.34,
0.1: 30.81,
0.05: 33.92,
0.025: 36.78,
0.01: 40.29,
0.005: 42.8
},
"23": {
"0.995": 9.26,
"0.99": 10.2,
"0.975": 11.69,
"0.95": 13.09,
"0.9": 14.85,
"0.5": 22.34,
"0.1": 32.01,
"0.05": 35.17,
"0.025": 38.08,
"0.01": 41.64,
"0.005": 44.18
23: {
0.995: 9.26,
0.99: 10.2,
0.975: 11.69,
0.95: 13.09,
0.9: 14.85,
0.5: 22.34,
0.1: 32.01,
0.05: 35.17,
0.025: 38.08,
0.01: 41.64,
0.005: 44.18
},
"24": {
"0.995": 9.89,
"0.99": 10.86,
"0.975": 12.4,
"0.95": 13.85,
"0.9": 15.66,
"0.5": 23.34,
"0.1": 33.2,
"0.05": 36.42,
"0.025": 39.36,
"0.01": 42.98,
"0.005": 45.56
24: {
0.995: 9.89,
0.99: 10.86,
0.975: 12.4,
0.95: 13.85,
0.9: 15.66,
0.5: 23.34,
0.1: 33.2,
0.05: 36.42,
0.025: 39.36,
0.01: 42.98,
0.005: 45.56
},
"25": {
"0.995": 10.52,
"0.99": 11.52,
"0.975": 13.12,
"0.95": 14.61,
"0.9": 16.47,
"0.5": 24.34,
"0.1": 34.28,
"0.05": 37.65,
"0.025": 40.65,
"0.01": 44.31,
"0.005": 46.93
25: {
0.995: 10.52,
0.99: 11.52,
0.975: 13.12,
0.95: 14.61,
0.9: 16.47,
0.5: 24.34,
0.1: 34.28,
0.05: 37.65,
0.025: 40.65,
0.01: 44.31,
0.005: 46.93
},
"26": {
"0.995": 11.16,
"0.99": 12.2,
"0.975": 13.84,
"0.95": 15.38,
"0.9": 17.29,
"0.5": 25.34,
"0.1": 35.56,
"0.05": 38.89,
"0.025": 41.92,
"0.01": 45.64,
"0.005": 48.29
26: {
0.995: 11.16,
0.99: 12.2,
0.975: 13.84,
0.95: 15.38,
0.9: 17.29,
0.5: 25.34,
0.1: 35.56,
0.05: 38.89,
0.025: 41.92,
0.01: 45.64,
0.005: 48.29
},
"27": {
"0.995": 11.81,
"0.99": 12.88,
"0.975": 14.57,
"0.95": 16.15,
"0.9": 18.11,
"0.5": 26.34,
"0.1": 36.74,
"0.05": 40.11,
"0.025": 43.19,
"0.01": 46.96,
"0.005": 49.65
27: {
0.995: 11.81,
0.99: 12.88,
0.975: 14.57,
0.95: 16.15,
0.9: 18.11,
0.5: 26.34,
0.1: 36.74,
0.05: 40.11,
0.025: 43.19,
0.01: 46.96,
0.005: 49.65
},
"28": {
"0.995": 12.46,
"0.99": 13.57,
"0.975": 15.31,
"0.95": 16.93,
"0.9": 18.94,
"0.5": 27.34,
"0.1": 37.92,
"0.05": 41.34,
"0.025": 44.46,
"0.01": 48.28,
"0.005": 50.99
28: {
0.995: 12.46,
0.99: 13.57,
0.975: 15.31,
0.95: 16.93,
0.9: 18.94,
0.5: 27.34,
0.1: 37.92,
0.05: 41.34,
0.025: 44.46,
0.01: 48.28,
0.005: 50.99
},
"29": {
"0.995": 13.12,
"0.99": 14.26,
"0.975": 16.05,
"0.95": 17.71,
"0.9": 19.77,
"0.5": 28.34,
"0.1": 39.09,
"0.05": 42.56,
"0.025": 45.72,
"0.01": 49.59,
"0.005": 52.34
29: {
0.995: 13.12,
0.99: 14.26,
0.975: 16.05,
0.95: 17.71,
0.9: 19.77,
0.5: 28.34,
0.1: 39.09,
0.05: 42.56,
0.025: 45.72,
0.01: 49.59,
0.005: 52.34
},
"30": {
"0.995": 13.79,
"0.99": 14.95,
"0.975": 16.79,
"0.95": 18.49,
"0.9": 20.6,
"0.5": 29.34,
"0.1": 40.26,
"0.05": 43.77,
"0.025": 46.98,
"0.01": 50.89,
"0.005": 53.67
30: {
0.995: 13.79,
0.99: 14.95,
0.975: 16.79,
0.95: 18.49,
0.9: 20.6,
0.5: 29.34,
0.1: 40.26,
0.05: 43.77,
0.025: 46.98,
0.01: 50.89,
0.005: 53.67
},
"40": {
"0.995": 20.71,
"0.99": 22.16,
"0.975": 24.43,
"0.95": 26.51,
"0.9": 29.05,
"0.5": 39.34,
"0.1": 51.81,
"0.05": 55.76,
"0.025": 59.34,
"0.01": 63.69,
"0.005": 66.77
40: {
0.995: 20.71,
0.99: 22.16,
0.975: 24.43,
0.95: 26.51,
0.9: 29.05,
0.5: 39.34,
0.1: 51.81,
0.05: 55.76,
0.025: 59.34,
0.01: 63.69,
0.005: 66.77
},
"50": {
"0.995": 27.99,
"0.99": 29.71,
"0.975": 32.36,
"0.95": 34.76,
"0.9": 37.69,
"0.5": 49.33,
"0.1": 63.17,
"0.05": 67.5,
"0.025": 71.42,
"0.01": 76.15,
"0.005": 79.49
50: {
0.995: 27.99,
0.99: 29.71,
0.975: 32.36,
0.95: 34.76,
0.9: 37.69,
0.5: 49.33,
0.1: 63.17,
0.05: 67.5,
0.025: 71.42,
0.01: 76.15,
0.005: 79.49
},
"60": {
"0.995": 35.53,
"0.99": 37.48,
"0.975": 40.48,
"0.95": 43.19,
"0.9": 46.46,
"0.5": 59.33,
"0.1": 74.4,
"0.05": 79.08,
"0.025": 83.3,
"0.01": 88.38,
"0.005": 91.95
60: {
0.995: 35.53,
0.99: 37.48,
0.975: 40.48,
0.95: 43.19,
0.9: 46.46,
0.5: 59.33,
0.1: 74.4,
0.05: 79.08,
0.025: 83.3,
0.01: 88.38,
0.005: 91.95
},
"70": {
"0.995": 43.28,
"0.99": 45.44,
"0.975": 48.76,
"0.95": 51.74,
"0.9": 55.33,
"0.5": 69.33,
"0.1": 85.53,
"0.05": 90.53,
"0.025": 95.02,
"0.01": 100.42,
"0.005": 104.22
70: {
0.995: 43.28,
0.99: 45.44,
0.975: 48.76,
0.95: 51.74,
0.9: 55.33,
0.5: 69.33,
0.1: 85.53,
0.05: 90.53,
0.025: 95.02,
0.01: 100.42,
0.005: 104.22
},
"80": {
"0.995": 51.17,
"0.99": 53.54,
"0.975": 57.15,
"0.95": 60.39,
"0.9": 64.28,
"0.5": 79.33,
"0.1": 96.58,
"0.05": 101.88,
"0.025": 106.63,
"0.01": 112.33,
"0.005": 116.32
80: {
0.995: 51.17,
0.99: 53.54,
0.975: 57.15,
0.95: 60.39,
0.9: 64.28,
0.5: 79.33,
0.1: 96.58,
0.05: 101.88,
0.025: 106.63,
0.01: 112.33,
0.005: 116.32
},
"90": {
"0.995": 59.2,
"0.99": 61.75,
"0.975": 65.65,
"0.95": 69.13,
"0.9": 73.29,
"0.5": 89.33,
"0.1": 107.57,
"0.05": 113.14,
"0.025": 118.14,
"0.01": 124.12,
"0.005": 128.3
90: {
0.995: 59.2,
0.99: 61.75,
0.975: 65.65,
0.95: 69.13,
0.9: 73.29,
0.5: 89.33,
0.1: 107.57,
0.05: 113.14,
0.025: 118.14,
0.01: 124.12,
0.005: 128.3
},
"100": {
"0.995": 67.33,
"0.99": 70.06,
"0.975": 74.22,
"0.95": 77.93,
"0.9": 82.36,
"0.5": 99.33,
"0.1": 118.5,
"0.05": 124.34,
"0.025": 129.56,
"0.01": 135.81,
"0.005": 140.17
100: {
0.995: 67.33,
0.99: 70.06,
0.975: 74.22,
0.95: 77.93,
0.9: 82.36,
0.5: 99.33,
0.1: 118.5,
0.05: 124.34,
0.025: 129.56,
0.01: 135.81,
0.005: 140.17
}

@@ -495,0 +495,0 @@ };

@@ -5,7 +5,7 @@ /**

declare function chiSquaredGoodnessOfFit(
data: number[],
distributionType: Function,
significance: number
): boolean
data: number[],
distributionType: Function,
significance: number
): boolean;
export default chiSquaredGoodnessOfFit;
/**
* https://simplestatistics.org/docs/#chunk
*/
declare function chunk<T extends any>(
x: T[],
chunkSize: number
): T[][]
declare function chunk<T extends any>(x: T[], chunkSize: number): T[][];
export default chunk;
/**
* https://simplestatistics.org/docs/#ckmeans
*/
declare function ckmeans<T extends number[]>(
x: T,
nClusters: number
): T[]
declare function ckmeans<T extends number[]>(x: T, nClusters: number): T[];
export default ckmeans;
/**
* https://simplestatistics.org/docs/#combinationsreplacement
*/
declare function combinationsReplacement<T extends any[]>(
x: T,
k: number
): T[]
declare function combinationsReplacement<T extends any[]>(x: T, k: number): T[];
export default combinationsReplacement;
/**
* https://simplestatistics.org/docs/#combinations
*/
declare function combinations<T extends any[]>(
x: T,
k: number
): T[]
declare function combinations<T extends any[]>(x: T, k: number): T[];
export default combinations;

@@ -5,8 +5,8 @@ /**

declare function combineMeans(
mean1: number,
n1: number,
mean2: number,
n2: number
): number
mean1: number,
n1: number,
mean2: number,
n2: number
): number;
export default combineMeans
export default combineMeans;

@@ -5,10 +5,10 @@ /**

declare function combineVariances(
variance1: number,
mean1: number,
n1: number,
variance2: number,
mean2: number,
n2: number
): number
variance1: number,
mean1: number,
n1: number,
variance2: number,
mean2: number,
n2: number
): number;
export default combineVariances
export default combineVariances;
/**
* https://simplestatistics.org/docs/#cumulativestdnormalprobability
*/
declare function cumulativeStdNormalProbability(z: number): number
declare function cumulativeStdNormalProbability(z: number): number;
export default cumulativeStdNormalProbability;
/**
* https://simplestatistics.org/docs/#equalintervalbreaks
*/
declare function equalIntervalBreaks(
x: number[],
nClasses: number
): number[]
declare function equalIntervalBreaks(x: number[], nClasses: number): number[];
export default equalIntervalBreaks;
/**
* https://simplestatistics.org/docs/#errorfunction
*/
declare function errorFunction(
x: number
): number
declare function errorFunction(x: number): number;
export default errorFunction;
/**
* https://simplestatistics.org/docs/#extent
*/
declare function extent(
x: number[]
): [number,number]
declare function extent(x: number[]): [number, number];
export default extent;
/**
* https://simplestatistics.org/docs/#factorial
*/
declare function factorial(n: number): number
declare function factorial(n: number): number;
export default factorial;
/**
* https://simplestatistics.org/docs/#geometricmean
*/
declare function geometricMean(
x: number[]
): number
declare function geometricMean(x: number[]): number;
export default geometricMean
export default geometricMean;
/**
* https://simplestatistics.org/docs/#harmonicmean
*/
declare function harmonicMean(
x: number[]
): number
declare function harmonicMean(x: number[]): number;
export default harmonicMean;
/**
* https://simplestatistics.org/docs/#interquartilerange
*/
declare function interquartileRange(
x: number[]
): number
declare function interquartileRange(x: number[]): number;
export default interquartileRange;
/**
* https://simplestatistics.org/docs/#inverseerrorfunction
*/
declare function inverseErrorFunction(
x: number
): number
declare function inverseErrorFunction(x: number): number;
export default inverseErrorFunction;

@@ -5,7 +5,7 @@ /**

declare function kMeansCluster(
points: number[][],
numCluster: number,
randomSource?: (() => number)
) : { labels: number[], centroids: number[][] }
points: number[][],
numCluster: number,
randomSource?: () => number
): { labels: number[]; centroids: number[][] };
export default kMeansCluster;

@@ -1,3 +0,3 @@

export type Kernels = 'gaussian'
export type BandwidthMethods = 'nrd'
export type Kernels = "gaussian";
export type BandwidthMethods = "nrd";

@@ -8,7 +8,7 @@ /**

declare function kernelDensityEstimation(
X: number[],
kernel?: Kernels | ((u: number) => number),
bandwidthMethod?: BandwidthMethods | number
X: number[],
kernel?: Kernels | ((u: number) => number),
bandwidthMethod?: BandwidthMethods | number
): (x: number) => number;
export default kernelDensityEstimation;
/**
* https://simplestatistics.org/docs/#linearregressionline
*/
declare function linearRegressionLine(
mb: {b: number, m: number}
): (x: number) => number;
declare function linearRegressionLine(mb: {
b: number;
m: number;
}): (x: number) => number;
export default linearRegressionLine;
/**
* https://simplestatistics.org/docs/#linearregression
*/
declare function linearRegression(
data: number[][]
): { m: number, b: number }
declare function linearRegression(data: number[][]): { m: number; b: number };
export default linearRegression;
/**
* https://simplestatistics.org/docs/#maxsorted
*/
declare function maxSorted(
x: number[]
): number
declare function maxSorted(x: number[]): number;
export default maxSorted;
/**
* https://simplestatistics.org/docs/#max
*/
declare function max(
x: number[]
): number
declare function max(x: number[]): number;
export default max;
/**
* https://simplestatistics.org/docs/#mean
*/
declare function meanSimple(
x: number[]
):number
declare function meanSimple(x: number[]): number;
export default meanSimple;
/**
* https://simplestatistics.org/docs/#mean
*/
declare function mean(
x: number[]
):number
declare function mean(x: number[]): number;
export default mean;
/**
* https://simplestatistics.org/docs/#medianabsolutedeviation
*/
declare function medianAbsoluteDeviation(
x: number[]
): number
declare function medianAbsoluteDeviation(x: number[]): number;
export default medianAbsoluteDeviation;
/**
* https://simplestatistics.org/docs/#mediansorted
*/
declare function medianSorted(
sorted: number[]
): number
declare function medianSorted(sorted: number[]): number;
export default medianSorted;
/**
* https://simplestatistics.org/docs/#median
*/
declare function median(
x: number[]
):number
declare function median(x: number[]): number;
export default median;
/**
* https://simplestatistics.org/docs/#minsorted
*/
declare function minSorted(
x: number[]
): number
declare function minSorted(x: number[]): number;
export default minSorted;
/**
* https://simplestatistics.org/docs/#min
*/
declare function min(
x: number[]
): number
declare function min(x: number[]): number;
export default min;
/**
* https://simplestatistics.org/docs/#modefast
*/
declare function modeFast<T extends any>(
x: T[]
): T
declare function modeFast<T extends any>(x: T[]): T;
export default modeFast;
/**
* https://simplestatistics.org/docs/#modesorted
*/
declare function modeSorted(
sorted: number[]
): number
declare function modeSorted(sorted: number[]): number;
export default modeSorted;
/**
* https://simplestatistics.org/docs/#mode
*/
declare function mode(
x: number[]
): number
declare function mode(x: number[]): number;
export default mode;
/**
* https://simplestatistics.org/docs/#numericsort
*/
declare function numericSort(
x: number[]
): number[]
declare function numericSort(x: number[]): number[];
export default numericSort;

@@ -5,8 +5,8 @@ /**

declare class PerceptronModel {
public weights: number[]
public bias: number
predict(features: number[]): number
train(features: number[], label: number): PerceptronModel
public weights: number[];
public bias: number;
predict(features: number[]): number;
train(features: number[], label: number): PerceptronModel;
}
export default PerceptronModel;

@@ -5,8 +5,9 @@ /**

declare function permutationTest(
sampleX: number[],
sampleY: number[],
string?: string,
k?: number
): number
sampleX: number[],
sampleY: number[],
string?: string,
k?: number,
randomSource?: () => number
): number;
export default permutationTest;

@@ -18,2 +18,3 @@ import mean from "./mean";

* @param {number} k number of values in permutation distribution.
* @param {Function} [randomSource=Math.random] an optional entropy source
* @returns {number} p-value The probability of observing the difference between groups (as or more extreme than what we did), assuming the null hypothesis.

@@ -26,3 +27,3 @@ *

*/
function permutationTest(sampleX, sampleY, alternative, k) {
function permutationTest(sampleX, sampleY, alternative, k, randomSource) {
// Set default arguments

@@ -62,3 +63,3 @@ if (k === undefined) {

// 1. shuffle data assignments
shuffleInPlace(allData);
shuffleInPlace(allData, randomSource);
const permLeft = allData.slice(0, midIndex);

@@ -65,0 +66,0 @@ const permRight = allData.slice(midIndex, allData.length);

/**
* https://simplestatistics.org/docs/#permutationsheap
*/
declare function permutationsHeap<T extends any[]>(
elements: T
): T[]
declare function permutationsHeap<T extends any[]>(elements: T): T[];
export default permutationsHeap;
/**
* https://simplestatistics.org/docs/#poissondistribution
*/
declare function poissonDistribution(
lambda: number
): number[]
declare function poissonDistribution(lambda: number): number[];
export default poissonDistribution;
/**
* https://simplestatistics.org/docs/#probit
*/
declare function probit(
p: number
): number
declare function probit(p: number): number;
export default probit;
/**
* https://simplestatistics.org/docs/#product
*/
declare function product(
x: number[]
): number
declare function product(x: number[]): number;
export default product;
/**
* https://simplestatistics.org/docs/#quantileranksorted
*/
declare function quantileRankSorted(
x: number[],
value: number
): number
declare function quantileRankSorted(x: number[], value: number): number;
export default quantileRankSorted;
/**
* https://simplestatistics.org/docs/#quantilerank
*/
declare function quantileRank(
x: number[],
value: number
): number
declare function quantileRank(x: number[], value: number): number;
export default quantileRank;
/**
* https://simplestatistics.org/docs/#quantilesorted
*/
declare function quantileSorted(
x: number[],
p: number
): number
declare function quantileSorted(x: number[], p: number): number;
export default quantileSorted;
/**
* https://simplestatistics.org/docs/#quantile
*/
declare function quantile(x: number[], p: number): number
declare function quantile(x: number[], p: number[]): number[]
declare function quantile(x: number[], p: number): number;
declare function quantile(x: number[], p: number[]): number[];
export default quantile;

@@ -5,8 +5,8 @@ /**

declare function quickselect(
arr: number[],
k: number,
left?: number,
right?: number
): void
arr: number[],
k: number,
left?: number,
right?: number
): void;
export default quickselect;
/**
* https://simplestatistics.org/docs/#rsquared
*/
declare function rSquared(
x: number[][],
func: (x: number) => number
): number
declare function rSquared(x: number[][], func: (x: number) => number): number;
export default rSquared;
/**
* https://simplestatistics.org/docs/#rootmeansquare
*/
declare function rootMeanSquare(
x: number[]
): number
declare function rootMeanSquare(x: number[]): number;
export default rootMeanSquare;
/**
* https://simplestatistics.org/docs/#samplecorrelation
*/
declare function sampleCorrelation(
x: number[],
y: number[]
): number
declare function sampleCorrelation(x: number[], y: number[]): number;
export default sampleCorrelation;
/**
* https://simplestatistics.org/docs/#samplecovariance
*/
declare function sampleCovariance(
x: number[],
y: number[]
): number
declare function sampleCovariance(x: number[], y: number[]): number;
export default sampleCovariance;
/**
* https://simplestatistics.org/docs/#samplekurtosis
*/
declare function sampleKurtosis(
x: number[]
): number
declare function sampleKurtosis(x: number[]): number;
export default sampleKurtosis;
/**
* https://simplestatistics.org/docs/#sampleskewness
*/
declare function sampleSkewness(
x: number[]
): number
declare function sampleSkewness(x: number[]): number;
export default sampleSkewness;
/**
* https://simplestatistics.org/docs/#samplestandarddeviation
*/
declare function sampleStandardDeviation(
x: number[]
): number
declare function sampleStandardDeviation(x: number[]): number;
export default sampleStandardDeviation;
/**
* https://simplestatistics.org/docs/#samplevariance
*/
declare function sampleVariance(
x: number[]
): number
declare function sampleVariance(x: number[]): number;
export default sampleVariance;

@@ -5,7 +5,7 @@ /**

declare function sampleWithReplacement<T extends any>(
x: T[],
n: number,
randomSource?: (() => number)
): T[]
x: T[],
n: number,
randomSource?: () => number
): T[];
export default sampleWithReplacement;

@@ -5,7 +5,7 @@ /**

declare function sample<T extends any>(
x: T[],
n: number,
randomSource: (() => number)
): T[]
x: T[],
n: number,
randomSource: () => number
): T[];
export default sample;

@@ -5,6 +5,6 @@ /**

declare function shuffleInPlace<T extends any[]>(
x: T,
randomSource?: (() => number)
): T
x: T,
randomSource?: () => number
): T;
export default shuffleInPlace;
/**
* https://simplestatistics.org/docs/#shuffle
*/
declare function shuffle<T extends any[]>(
x: T,
randomSource?: (() => number)
): T
declare function shuffle<T extends any[]>(x: T, randomSource?: () => number): T;
export default shuffle;
/**
* https://simplestatistics.org/docs/#sign
*/
declare function sign(
x: number
): number
declare function sign(x: number): number;
export default sign;
/**
* https://simplestatistics.org/docs/#standarddeviation
*/
declare function standardDeviation(
x: number[]
): number
declare function standardDeviation(x: number[]): number;
export default standardDeviation;
/**
* https://simplestatistics.org/docs/#standardnormaltable
*/
declare const standardNormalTable: number[]
declare const standardNormalTable: number[];
export default standardNormalTable;

@@ -5,7 +5,7 @@ /**

declare function subtractFromMean(
mean: number,
n: number,
value: number
): number
mean: number,
n: number,
value: number
): number;
export default subtractFromMean;
/**
* https://simplestatistics.org/docs/#sumnthpowerdeviations
*/
declare function sumNthPowerDeviations(
x: number[],
n?: number
): number
declare function sumNthPowerDeviations(x: number[], n?: number): number;
export default sumNthPowerDeviations;
/**
* https://simplestatistics.org/docs/#sumsimple
*/
declare function sumSimple(
x: number[]
): number
declare function sumSimple(x: number[]): number;
export default sumSimple;
/**
* https://simplestatistics.org/docs/#sum
*/
declare function sum(
x: number[]
): number
declare function sum(x: number[]): number;
export default sum;

@@ -5,7 +5,7 @@ /**

declare function tTestTwoSample(
sampleX: number[],
sampleY: number[],
difference?: number
): number | null
sampleX: number[],
sampleY: number[],
difference?: number
): number | null;
export default tTestTwoSample;
/**
* https://simplestatistics.org/docs/#ttest
*/
declare function tTest(
x: number[],
expectedValue: number
): number
declare function tTest(x: number[], expectedValue: number): number;
export default tTest;
/**
* https://simplestatistics.org/docs/#uniquecountsorted
*/
declare function uniqueCountSorted(
x: any[]
): number
declare function uniqueCountSorted(x: any[]): number;
export default uniqueCountSorted;
/**
* https://simplestatistics.org/docs/#variance
*/
declare function variance(
x: number[]
): number
declare function variance(x: number[]): number;
export default variance;

@@ -5,7 +5,7 @@ /**

declare function zScore(
x: number,
mean: number,
standardDeviation: number
): number
x: number,
mean: number,
standardDeviation: number
): number;
export default zScore;

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc