vega-statistics
Advanced tools
Comparing version 1.1.1 to 1.1.2
@@ -88,3 +88,3 @@ (function (global, factory) { | ||
} | ||
mu[i] = a / n; | ||
mu[j] = a / n; | ||
} | ||
@@ -91,0 +91,0 @@ |
@@ -1,1 +0,1 @@ | ||
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("d3-array")):"function"==typeof define&&define.amd?define(["exports","d3-array"],n):n(t.vega=t.vega||{},t.d3)}(this,function(t,n){"use strict";function r(t){return null===t?NaN:+t}function e(t){var r=t.length,e=h(t),a=(e[2]-e[0])/1.34;return 1.06*Math.min(Math.sqrt(n.variance(t)),a)*Math.pow(r,-.2)}var a=function(t){var n,r,e,a,o,u,i,f,h=t.maxbins||20,c=t.base||10,l=Math.log(c),d=t.divide||[5,2],s=t.extent[0],M=t.extent[1],p=M-s;if(t.step)n=t.step;else if(t.steps){for(o=p/h,u=0,i=t.steps.length;u<i&&t.steps[u]<o;++u);n=t.steps[Math.max(0,u-1)]}else{for(r=Math.ceil(Math.log(h)/l),e=t.minstep||0,n=Math.max(e,Math.pow(c,Math.round(Math.log(p)/l)-r));Math.ceil(p/n)>h;)n*=c;for(u=0,i=d.length;u<i;++u)o=n/d[u],o>=e&&p/o<=h&&(n=o)}return o=Math.log(n),a=o>=0?0:~~(-o/l)+1,f=Math.pow(c,-a-1),(t.nice||void 0===t.nice)&&(s=Math.min(s,Math.floor(s/n+f)*n),M=Math.ceil(M/n)*n),{start:s,stop:M,step:n}},o=function(t,n){var e,a=[],o=t.length,u=-1;if(null==n)for(;++u<o;)isNaN(e=r(t[u]))||a.push(e);else for(;++u<o;)isNaN(e=r(n(t[u],u,t)))||a.push(e);return a},u=function(t,r,e,a){var u,i,f,h,c=o(t,a),l=c.length,d=r;for(f=0,h=Array(d);f<d;++f){for(u=0,i=0;i<l;++i)u+=c[~~(Math.random()*l)];h[i]=u/l}return[n.quantile(h.sort(n.ascending),e/2),n.quantile(h,1-e/2)]},i=function(t,n){null==n&&(n=t,t=0);var r,e,a,o={};return o.min=function(t){return arguments.length?(r=t||0,a=e-r,o):r},o.max=function(t){return arguments.length?(e=t||0,a=e-r,o):e},o.sample=function(){return r+Math.floor(a*Math.random())},o.pdf=function(t){return t===Math.floor(t)&&t>=r&&t<e?1/a:0},o.cdf=function(t){var n=Math.floor(t);return n<r?0:n>=e?1:(n-r+1)/a},o.icdf=function(t){return t>=0&&t<=1?r-1+Math.floor(t*a):NaN},o.min(t).max(n)},f=function(t,n){var r,e,a=NaN,o={};return o.mean=function(t){return arguments.length?(r=t||0,a=NaN,o):r},o.stdev=function(t){return arguments.length?(e=null==t?1:t,a=NaN,o):e},o.sample=function(){var t,n,o=0,u=0;if(a===a)return o=a,a=NaN,o;do o=2*Math.random()-1,u=2*Math.random()-1,t=o*o+u*u;while(0===t||t>1);return n=Math.sqrt(-2*Math.log(t)/t),a=r+u*n*e,r+o*n*e},o.pdf=function(t){var n=Math.exp(Math.pow(t-r,2)/(-2*Math.pow(e,2)));return 1/(e*Math.sqrt(2*Math.PI))*n},o.cdf=function(t){var n,a=(t-r)/e,o=Math.abs(a);if(o>37)n=0;else{var u,i=Math.exp(-o*o/2);o<7.07106781186547?(u=.0352624965998911*o+.700383064443688,u=u*o+6.37396220353165,u=u*o+33.912866078383,u=u*o+112.079291497871,u=u*o+221.213596169931,u=u*o+220.206867912376,n=i*u,u=.0883883476483184*o+1.75566716318264,u=u*o+16.064177579207,u=u*o+86.7807322029461,u=u*o+296.564248779674,u=u*o+637.333633378831,u=u*o+793.826512519948,u=u*o+440.413735824752,n/=u):(u=o+.65,u=o+4/u,u=o+3/u,u=o+2/u,u=o+1/u,n=i/u/2.506628274631)}return a>0?1-n:n},o.icdf=function(t){if(t<=0||t>=1)return NaN;var n=2*t-1,a=8*(Math.PI-3)/(3*Math.PI*(4-Math.PI)),o=2/(Math.PI*a)+Math.log(1-Math.pow(n,2))/2,u=Math.log(1-n*n)/a,i=(n>0?1:-1)*Math.sqrt(Math.sqrt(o*o-u)-o);return r+e*Math.SQRT2*i},o.mean(t).stdev(n)},h=function(t,r){var e=o(t,r);return[n.quantile(e.sort(n.ascending),.25),n.quantile(e,.5),n.quantile(e,.75)]},c=function(t,n){var r=f(),a={},o=0;return a.data=function(r){return arguments.length?(t=r,o=r?r.length:0,a.bandwidth(n)):t},a.bandwidth=function(r){return arguments.length?(n=r,!n&&t&&(n=e(t)),a):n},a.sample=function(){return t[~~(Math.random()*o)]+n*r.sample()},a.pdf=function(e){for(var a=0,u=0;u<o;++u)a+=r.pdf((e-t[u])/n);return a/n/o},a.cdf=function(e){for(var a=0,u=0;u<o;++u)a+=r.cdf((e-t[u])/n);return a/o},a.icdf=function(){throw Error("KDE icdf not supported.")},a.data(t)},l=function(t,n){function r(t){var n,r=[],e=0;for(n=0;n<o;++n)e+=r[n]=null==t[n]?1:+t[n];for(n=0;n<o;++n)r[n]/=e;return r}var e,a={},o=0;return a.weights=function(t){return arguments.length?(e=r(n=t||[]),a):n},a.distributions=function(r){return arguments.length?(r?(o=r.length,t=r):(o=0,t=[]),a.weights(n)):t},a.sample=function(){for(var n=Math.random(),r=t[o-1],a=e[0],u=0;u<o-1;a+=e[++u])if(n<a){r=t[u];break}return r.sample()},a.pdf=function(n){for(var r=0,a=0;a<o;++a)r+=e[a]*t[a].pdf(n);return r},a.cdf=function(n){for(var r=0,a=0;a<o;++a)r+=e[a]*t[a].cdf(n);return r},a.icdf=function(){throw Error("Mixture icdf not supported.")},a.distributions(t).weights(n)},d=function(t,n){null==n&&(n=null==t?1:t,t=0);var r,e,a,o={};return o.min=function(t){return arguments.length?(r=t||0,a=e-r,o):r},o.max=function(t){return arguments.length?(e=t||0,a=e-r,o):e},o.sample=function(){return r+a*Math.random()},o.pdf=function(t){return t>=r&&t<=e?1/a:0},o.cdf=function(t){return t<r?0:t>e?1:(t-r)/a},o.icdf=function(t){return t>=0&&t<=1?r+t*a:NaN},o.min(t).max(n)};t.bin=a,t.bootstrapCI=u,t.randomInteger=i,t.randomKDE=c,t.randomMixture=l,t.randomNormal=f,t.randomUniform=d,t.quartiles=h,Object.defineProperty(t,"__esModule",{value:!0})}); | ||
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("d3-array")):"function"==typeof define&&define.amd?define(["exports","d3-array"],n):n(t.vega=t.vega||{},t.d3)}(this,function(t,n){"use strict";function r(t){return null===t?NaN:+t}function e(t){var r=t.length,e=h(t),a=(e[2]-e[0])/1.34;return 1.06*Math.min(Math.sqrt(n.variance(t)),a)*Math.pow(r,-.2)}var a=function(t){var n,r,e,a,o,u,i,f,h=t.maxbins||20,c=t.base||10,l=Math.log(c),d=t.divide||[5,2],s=t.extent[0],M=t.extent[1],p=M-s;if(t.step)n=t.step;else if(t.steps){for(o=p/h,u=0,i=t.steps.length;u<i&&t.steps[u]<o;++u);n=t.steps[Math.max(0,u-1)]}else{for(r=Math.ceil(Math.log(h)/l),e=t.minstep||0,n=Math.max(e,Math.pow(c,Math.round(Math.log(p)/l)-r));Math.ceil(p/n)>h;)n*=c;for(u=0,i=d.length;u<i;++u)o=n/d[u],o>=e&&p/o<=h&&(n=o)}return o=Math.log(n),a=o>=0?0:~~(-o/l)+1,f=Math.pow(c,-a-1),(t.nice||void 0===t.nice)&&(s=Math.min(s,Math.floor(s/n+f)*n),M=Math.ceil(M/n)*n),{start:s,stop:M,step:n}},o=function(t,n){var e,a=[],o=t.length,u=-1;if(null==n)for(;++u<o;)isNaN(e=r(t[u]))||a.push(e);else for(;++u<o;)isNaN(e=r(n(t[u],u,t)))||a.push(e);return a},u=function(t,r,e,a){var u,i,f,h,c=o(t,a),l=c.length,d=r;for(f=0,h=Array(d);f<d;++f){for(u=0,i=0;i<l;++i)u+=c[~~(Math.random()*l)];h[f]=u/l}return[n.quantile(h.sort(n.ascending),e/2),n.quantile(h,1-e/2)]},i=function(t,n){null==n&&(n=t,t=0);var r,e,a,o={};return o.min=function(t){return arguments.length?(r=t||0,a=e-r,o):r},o.max=function(t){return arguments.length?(e=t||0,a=e-r,o):e},o.sample=function(){return r+Math.floor(a*Math.random())},o.pdf=function(t){return t===Math.floor(t)&&t>=r&&t<e?1/a:0},o.cdf=function(t){var n=Math.floor(t);return n<r?0:n>=e?1:(n-r+1)/a},o.icdf=function(t){return t>=0&&t<=1?r-1+Math.floor(t*a):NaN},o.min(t).max(n)},f=function(t,n){var r,e,a=NaN,o={};return o.mean=function(t){return arguments.length?(r=t||0,a=NaN,o):r},o.stdev=function(t){return arguments.length?(e=null==t?1:t,a=NaN,o):e},o.sample=function(){var t,n,o=0,u=0;if(a===a)return o=a,a=NaN,o;do o=2*Math.random()-1,u=2*Math.random()-1,t=o*o+u*u;while(0===t||t>1);return n=Math.sqrt(-2*Math.log(t)/t),a=r+u*n*e,r+o*n*e},o.pdf=function(t){var n=Math.exp(Math.pow(t-r,2)/(-2*Math.pow(e,2)));return 1/(e*Math.sqrt(2*Math.PI))*n},o.cdf=function(t){var n,a=(t-r)/e,o=Math.abs(a);if(o>37)n=0;else{var u,i=Math.exp(-o*o/2);o<7.07106781186547?(u=.0352624965998911*o+.700383064443688,u=u*o+6.37396220353165,u=u*o+33.912866078383,u=u*o+112.079291497871,u=u*o+221.213596169931,u=u*o+220.206867912376,n=i*u,u=.0883883476483184*o+1.75566716318264,u=u*o+16.064177579207,u=u*o+86.7807322029461,u=u*o+296.564248779674,u=u*o+637.333633378831,u=u*o+793.826512519948,u=u*o+440.413735824752,n/=u):(u=o+.65,u=o+4/u,u=o+3/u,u=o+2/u,u=o+1/u,n=i/u/2.506628274631)}return a>0?1-n:n},o.icdf=function(t){if(t<=0||t>=1)return NaN;var n=2*t-1,a=8*(Math.PI-3)/(3*Math.PI*(4-Math.PI)),o=2/(Math.PI*a)+Math.log(1-Math.pow(n,2))/2,u=Math.log(1-n*n)/a,i=(n>0?1:-1)*Math.sqrt(Math.sqrt(o*o-u)-o);return r+e*Math.SQRT2*i},o.mean(t).stdev(n)},h=function(t,r){var e=o(t,r);return[n.quantile(e.sort(n.ascending),.25),n.quantile(e,.5),n.quantile(e,.75)]},c=function(t,n){var r=f(),a={},o=0;return a.data=function(r){return arguments.length?(t=r,o=r?r.length:0,a.bandwidth(n)):t},a.bandwidth=function(r){return arguments.length?(n=r,!n&&t&&(n=e(t)),a):n},a.sample=function(){return t[~~(Math.random()*o)]+n*r.sample()},a.pdf=function(e){for(var a=0,u=0;u<o;++u)a+=r.pdf((e-t[u])/n);return a/n/o},a.cdf=function(e){for(var a=0,u=0;u<o;++u)a+=r.cdf((e-t[u])/n);return a/o},a.icdf=function(){throw Error("KDE icdf not supported.")},a.data(t)},l=function(t,n){function r(t){var n,r=[],e=0;for(n=0;n<o;++n)e+=r[n]=null==t[n]?1:+t[n];for(n=0;n<o;++n)r[n]/=e;return r}var e,a={},o=0;return a.weights=function(t){return arguments.length?(e=r(n=t||[]),a):n},a.distributions=function(r){return arguments.length?(r?(o=r.length,t=r):(o=0,t=[]),a.weights(n)):t},a.sample=function(){for(var n=Math.random(),r=t[o-1],a=e[0],u=0;u<o-1;a+=e[++u])if(n<a){r=t[u];break}return r.sample()},a.pdf=function(n){for(var r=0,a=0;a<o;++a)r+=e[a]*t[a].pdf(n);return r},a.cdf=function(n){for(var r=0,a=0;a<o;++a)r+=e[a]*t[a].cdf(n);return r},a.icdf=function(){throw Error("Mixture icdf not supported.")},a.distributions(t).weights(n)},d=function(t,n){null==n&&(n=null==t?1:t,t=0);var r,e,a,o={};return o.min=function(t){return arguments.length?(r=t||0,a=e-r,o):r},o.max=function(t){return arguments.length?(e=t||0,a=e-r,o):e},o.sample=function(){return r+a*Math.random()},o.pdf=function(t){return t>=r&&t<=e?1/a:0},o.cdf=function(t){return t<r?0:t>e?1:(t-r)/a},o.icdf=function(t){return t>=0&&t<=1?r+t*a:NaN},o.min(t).max(n)};t.bin=a,t.bootstrapCI=u,t.randomInteger=i,t.randomKDE=c,t.randomMixture=l,t.randomNormal=f,t.randomUniform=d,t.quartiles=h,Object.defineProperty(t,"__esModule",{value:!0})}); |
{ | ||
"name": "vega-statistics", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"description": "Statistical routines and probability distributions.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -14,3 +14,3 @@ import numbers from './numbers'; | ||
} | ||
mu[i] = a / n; | ||
mu[j] = a / n; | ||
} | ||
@@ -17,0 +17,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package