diff --git a/webdriver-ts-results/.eslintignore b/webdriver-ts-results/.eslintignore index 84639cc43..f0f9a9cb9 100644 --- a/webdriver-ts-results/.eslintignore +++ b/webdriver-ts-results/.eslintignore @@ -1,2 +1,3 @@ webpack.config.js -.eslintrc.js \ No newline at end of file +.eslintrc.js +src/results.ts \ No newline at end of file diff --git a/webdriver-ts-results/src/Common.ts b/webdriver-ts-results/src/Common.ts index 831b1b888..08a046ef1 100644 --- a/webdriver-ts-results/src/Common.ts +++ b/webdriver-ts-results/src/Common.ts @@ -349,7 +349,7 @@ export class ResultTableData { computeFactors(benchmark: Benchmark): Array { - let resultsKey = benchmark.type == BenchmarkType.CPU ? this.cpuDurationMode : DEFAULT_RESULTS_KEY; + const resultsKey = benchmark.type == BenchmarkType.CPU ? this.cpuDurationMode : DEFAULT_RESULTS_KEY; const benchmarkResults = this.frameworksForFactors.map(f => this.results(benchmark, f)); const selectFn = (result: Result|null) => { diff --git a/webdriver-ts-results/src/reducer.ts b/webdriver-ts-results/src/reducer.ts index 11785a42a..0246505a2 100644 --- a/webdriver-ts-results/src/reducer.ts +++ b/webdriver-ts-results/src/reducer.ts @@ -10,10 +10,10 @@ const benchmarks = benchmark_orig.filter(b => b.id !== '32_startup-bt' const jStat = require('jstat').jStat; const results: Result[] = (rawResults as RawResult[]).map(res => { - let values: {[k: string]: ResultValues} = {}; - for (let key of Object.keys(res.v)) { - let r = res.v[key]; - let vals = { + const values: {[k: string]: ResultValues} = {}; + for (const key of Object.keys(res.v)) { + const r = res.v[key]; + const vals = { mean: r ? jStat.mean(r) : Number.NaN, median: r ? jStat.median(r) : Number.NaN, standardDeviation: r ? jStat.stdev(r, true) : Number.NaN, @@ -133,7 +133,7 @@ function extractState(state: any): Partial { } if (state.categories!==undefined) { const newSelectedCategories = new Set(); - for (const f of state?.categories) { + for (const f of state?.categories ?? []) { for (const sc of categories) { if (f === sc.id) newSelectedCategories.add(sc.id); } diff --git a/webdriver-ts-results/src/tables/BoxPlotTable.tsx b/webdriver-ts-results/src/tables/BoxPlotTable.tsx index b2ea83478..b6923efa5 100644 --- a/webdriver-ts-results/src/tables/BoxPlotTable.tsx +++ b/webdriver-ts-results/src/tables/BoxPlotTable.tsx @@ -37,7 +37,7 @@ const BoxPlot = ({traces}: {traces: Array}): JSX.Element => } const RenderBoxPlotsRow = ({frameworks, benchmark, results, currentSortKey, sortBy, cpuDurationMode}: {frameworks: Array; benchmark: Benchmark; results: ResultLookup; currentSortKey: string; sortBy: (name: string) => void, cpuDurationMode: CpuDurationMode}) => { - let resultsValues = (framework: Framework) => results(benchmark, framework)?.results[cpuDurationMode] ?? []; + const resultsValues = (framework: Framework) => results(benchmark, framework)?.results[cpuDurationMode].values ?? []; return @@ -51,7 +51,7 @@ const RenderBoxPlotsRow = ({frameworks, benchmark, results, currentSortKey, sort const RenderBoxPlotsRows = ({frameworks, benchmarks, results, currentSortKey, sortBy, cpuDurationMode}: {frameworks: Array; benchmarks: Array; results: ResultLookup; currentSortKey: string; sortBy: (name: string) => void, cpuDurationMode: CpuDurationMode}) => { return <>{benchmarks.map((benchmark) => - + )} } // {data.frameworks.map(f => {f.name})} diff --git a/webdriver-ts-results/src/tables/CompareRow.tsx b/webdriver-ts-results/src/tables/CompareRow.tsx index 8e83a006e..8c64a00f6 100644 --- a/webdriver-ts-results/src/tables/CompareRow.tsx +++ b/webdriver-ts-results/src/tables/CompareRow.tsx @@ -9,7 +9,7 @@ const CompareRow = ({comparison, compareWith}: {comparison: Array compare: Green means significantly faster, red significantly slower - {comparison.map(result => result == null ? : + {comparison.map((result,idx) => result == null ? : @@ -19,7 +19,7 @@ const CompareRow = ({comparison, compareWith}: {comparison: Array compare: Green means significantly faster, red significantly slower - {comparison.map(result => result == null ? : + {comparison.map((result,idx) => result == null ? : {result.label} { (compareWith === result.framework) ? diff --git a/webdriver-ts-results/src/tables/CpuResultsTable.tsx b/webdriver-ts-results/src/tables/CpuResultsTable.tsx index e46644156..2972a84e4 100644 --- a/webdriver-ts-results/src/tables/CpuResultsTable.tsx +++ b/webdriver-ts-results/src/tables/CpuResultsTable.tsx @@ -16,7 +16,7 @@ const CpuResultsTable = ({data, currentSortKey, sortBy}: {data: ResultTableData;
Duration for... {data.frameworks.map((f,idx) => { - f.frameworkHomeURL ? {f.displayname} : f.displayname + f.frameworkHomeURL ? {f.displayname} : f.displayname } )} @@ -37,7 +37,7 @@ const CpuResultsTable = ({data, currentSortKey, sortBy}: {data: ResultTableData; Implementation link {data.frameworks.map(f => - code + code )} diff --git a/webdriver-ts-results/src/tables/GeomMeanRow.tsx b/webdriver-ts-results/src/tables/GeomMeanRow.tsx index f315d889b..4f4709406 100644 --- a/webdriver-ts-results/src/tables/GeomMeanRow.tsx +++ b/webdriver-ts-results/src/tables/GeomMeanRow.tsx @@ -10,7 +10,7 @@ const GeomMeanRow = ({geomMean, currentSortKey, sortBy, sortbyGeommeanEnum}: {ge return ( of all factors in the table - {geomMean.map(result => result == null ? : + {geomMean.map((result,idx) => result == null ? : {result.mean.toFixed(2)} )} diff --git a/webdriver-ts-results/src/tables/ValueResultRow.tsx b/webdriver-ts-results/src/tables/ValueResultRow.tsx index 22d00ed00..71b10a90e 100644 --- a/webdriver-ts-results/src/tables/ValueResultRow.tsx +++ b/webdriver-ts-results/src/tables/ValueResultRow.tsx @@ -19,7 +19,7 @@ const ValueResultRow = ({benchIdx, resultsForBenchmark, benchmarks, currentSortK
{benchmarks[benchIdx].description}
{resultsForBenchmark && resultsForBenchmark.map((result,idx) => result == null ? : - )} + )} }; diff --git a/webdriver-ts-results/table.html b/webdriver-ts-results/table.html index cb4ecbb2d..084515c91 100644 --- a/webdriver-ts-results/table.html +++ b/webdriver-ts-results/table.html @@ -1,2 +1,2 @@ Interactive Results
\ No newline at end of file +(globalThis.webpackChunkwebdriver_ts_results=globalThis.webpackChunkwebdriver_ts_results||[]).push([[736],{645:e=>{"use strict";e.exports=function(e){var n=[];return n.toString=function(){return this.map((function(n){var t="",r=void 0!==n[5];return n[4]&&(t+="@supports (".concat(n[4],") {")),n[2]&&(t+="@media ".concat(n[2]," {")),r&&(t+="@layer".concat(n[5].length>0?" ".concat(n[5]):""," {")),t+=e(n),r&&(t+="}"),n[2]&&(t+="}"),n[4]&&(t+="}"),t})).join("")},n.i=function(e,t,r,a,o){"string"==typeof e&&(e=[[null,e,void 0]]);var l={};if(r)for(var u=0;u0?" ".concat(s[5]):""," {").concat(s[1],"}")),s[5]=o),t&&(s[2]?(s[1]="@media ".concat(s[2]," {").concat(s[1],"}"),s[2]=t):s[2]=t),a&&(s[4]?(s[1]="@supports (".concat(s[4],") {").concat(s[1],"}"),s[4]=a):s[4]="".concat(a)),n.push(s))}},n}},81:e=>{"use strict";e.exports=function(e){return e[1]}},679:(e,n,t)=>{"use strict";var r=t(864),a={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},o={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},l={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},u={};function i(e){return r.isMemo(e)?l:u[e.$$typeof]||a}u[r.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},u[r.Memo]=l;var c=Object.defineProperty,s=Object.getOwnPropertyNames,f=Object.getOwnPropertySymbols,d=Object.getOwnPropertyDescriptor,p=Object.getPrototypeOf,m=Object.prototype;e.exports=function e(n,t,r){if("string"!=typeof t){if(m){var a=p(t);a&&a!==m&&e(n,a,r)}var l=s(t);f&&(l=l.concat(f(t)));for(var u=i(n),h=i(t),g=0;gt?n:t;return e.pow(10,17-~~(e.log(r>0?r:-r)*e.LOG10E))}var l=Array.isArray||function(e){return"[object Array]"===a.call(e)};function u(e){return"[object Function]"===a.call(e)}function i(e){return"number"==typeof e&&e-e==0}function c(){return new c._init(arguments)}function s(){return 0}function f(){return 1}function d(e,n){return e===n?1:0}c.fn=c.prototype,c._init=function(e){if(l(e[0]))if(l(e[0][0])){u(e[1])&&(e[0]=c.map(e[0],e[1]));for(var n=0;n=0;n--,r++)t[r]=[e[r][n]];return t},c.transpose=function(e){var n,t,r,a,o,u=[];for(l(e[0])||(e=[e]),t=e.length,r=e[0].length,o=0;o0&&(u[r][0]=e[r][0]),i=1;it&&r>0)return[];if(r>0)for(a=e;at;a+=r)o.push(a);return o},c.slice=function(){function e(e,t,r,a){var o,l=[],u=e.length;if(t===n&&r===n&&a===n)return c.copy(e);if(a=a||1,(t=(t=t||0)>=0?t:u+t)===(r=(r=r||e.length)>=0?r:u+r)||0===a)return[];if(tr&&a>0)return[];if(a>0)for(o=t;or;o+=a)l.push(e[o]);return l}return function(n,t){var r,a;return i((t=t||{}).row)?i(t.col)?n[t.row][t.col]:e(c.rowa(n,t.row),(r=t.col||{}).start,r.end,r.step):i(t.col)?e(c.cola(n,t.col),(a=t.row||{}).start,a.end,a.step):(a=t.row||{},r=t.col||{},e(n,a.start,a.end,a.step).map((function(n){return e(n,r.start,r.end,r.step)})))}}(),c.sliceAssign=function(t,r,a){var o,l;if(i(r.row)){if(i(r.col))return t[r.row][r.col]=a;r.col=r.col||{},r.col.start=r.col.start||0,r.col.end=r.col.end||t[0].length,r.col.step=r.col.step||1,o=c.arange(r.col.start,e.min(t.length,r.col.end),r.col.step);var u=r.row;return o.forEach((function(e,n){t[u][e]=a[n]})),t}if(i(r.col)){r.row=r.row||{},r.row.start=r.row.start||0,r.row.end=r.row.end||t.length,r.row.step=r.row.step||1,l=c.arange(r.row.start,e.min(t[0].length,r.row.end),r.row.step);var s=r.col;return l.forEach((function(e,n){t[e][s]=a[n]})),t}return a[0].length===n&&(a=[a]),r.row.start=r.row.start||0,r.row.end=r.row.end||t.length,r.row.step=r.row.step||1,r.col.start=r.col.start||0,r.col.end=r.col.end||t[0].length,r.col.step=r.col.step||1,l=c.arange(r.row.start,e.min(t.length,r.row.end),r.row.step),o=c.arange(r.col.start,e.min(t[0].length,r.col.end),r.col.step),l.forEach((function(e,n){o.forEach((function(r,o){t[e][r]=a[n][o]}))})),t},c.diagonal=function(e){var n=c.zeros(e.length,e.length);return e.forEach((function(e,t){n[t][t]=e})),n},c.copy=function(e){return e.map((function(e){return i(e)?e:e.map((function(e){return e}))}))};var p=c.prototype;return p.length=0,p.push=Array.prototype.push,p.sort=Array.prototype.sort,p.splice=Array.prototype.splice,p.slice=Array.prototype.slice,p.toArray=function(){return this.length>1?r.call(this):r.call(this)[0]},p.map=function(e,n){return c(c.map(this,e,n))},p.cumreduce=function(e,n){return c(c.cumreduce(this,e,n))},p.alter=function(e){return c.alter(this,e),this},function(e){for(var n=0;n=0;)n+=e[t];return n},e.sumsqrd=function(e){for(var n=0,t=e.length;--t>=0;)n+=e[t]*e[t];return n},e.sumsqerr=function(n){for(var t,r=e.mean(n),a=0,o=n.length;--o>=0;)a+=(t=n[o]-r)*t;return a},e.sumrow=function(e){for(var n=0,t=e.length;--t>=0;)n+=e[t];return n},e.product=function(e){for(var n=1,t=e.length;--t>=0;)n*=e[t];return n},e.min=function(e){for(var n=e[0],t=0;++tn&&(n=e[t]);return n},e.unique=function(e){for(var n={},t=[],r=0;rl?(i=[a[n]],l=o,u=0):o===l&&(i.push(a[n]),u++),o=1);return 0===u?i[0]:i},e.range=function(n){return e.max(n)-e.min(n)},e.variance=function(n,t){return e.sumsqerr(n)/(n.length-(t?1:0))},e.pooledvariance=function(n){return n.reduce((function(n,t){return n+e.sumsqerr(t)}),0)/(n.reduce((function(e,n){return e+n.length}),0)-n.length)},e.deviation=function(n){for(var t=e.mean(n),r=n.length,a=new Array(r),o=0;o=0;o--)a.push(n.abs(t[o]-r));return e.mean(a)},e.meddev=function(t){for(var r=e.median(t),a=[],o=t.length-1;o>=0;o--)a.push(n.abs(t[o]-r));return e.median(a)},e.coeffvar=function(n){return e.stdev(n)/e.mean(n)},e.quartiles=function(e){var t=e.length,a=e.slice().sort(r);return[a[n.round(t/4)-1],a[n.round(t/2)-1],a[n.round(3*t/4)-1]]},e.quantiles=function(e,t,o,l){var u,i,c,s,f,d=e.slice().sort(r),p=[t.length],m=e.length;for(void 0===o&&(o=3/8),void 0===l&&(l=3/8),u=0;u1){for(i=!0===r?this:this.transpose();u1){for("sumrow"!==n&&(i=!0===r?this:this.transpose());u1){for(u=u.transpose();l=0;u--)l*=r,l+=c[u];if(o=l/t+.5*n.log(a)+(t-.5)*n.log(t)-t,e<=7)for(u=1;u<=i;u++)o-=n.log(t-1),t-=1;return o},e.gammafn=function(e){var t,r,a,o,l=[-1.716185138865495,24.76565080557592,-379.80425647094563,629.3311553128184,866.9662027904133,-31451.272968848367,-36144.413418691176,66456.14382024054],u=[-30.8402300119739,315.35062697960416,-1015.1563674902192,-3107.771671572311,22538.11842098015,4755.846277527881,-134659.9598649693,-115132.2596755535],i=!1,c=0,s=0,f=0,d=e;if(e>171.6243769536076)return 1/0;if(d<=0){if(!(o=d%1+36e-17))return 1/0;i=(1&d?-1:1)*n.PI/n.sin(n.PI*o),d=1-d}for(a=d,r=d<1?d++:(d-=c=(0|d)-1)-1,t=0;t<8;++t)f=(f+l[t])*r,s=s*r+u[t];if(o=f/s+1,ad)for(t=0;t=1?t:1/t)+.4*t+17);if(r<0||t<=0)return NaN;if(r170||r>170?n.exp(e.combinationln(t,r)):e.factorial(t)/e.factorial(r)/e.factorial(t-r)},e.combinationln=function(n,t){return e.factorialln(n)-e.factorialln(t)-e.factorialln(n-t)},e.permutation=function(n,t){return e.factorial(n)/e.factorial(n-t)},e.betafn=function(t,r){if(!(t<=0||r<=0))return t+r>170?n.exp(e.betaln(t,r)):e.gammafn(t)*e.gammafn(r)/e.gammafn(t+r)},e.betaln=function(n,t){return e.gammaln(n)+e.gammaln(t)-e.gammaln(n+t)},e.betacf=function(e,t,r){var a,o,l,u,i=1e-30,c=1,s=t+r,f=t+1,d=t-1,p=1,m=1-s*e/f;for(n.abs(m)=1)return n.max(100,r+100*n.sqrt(r));if(t<=0)return 0;for(r>1?(i=n.log(f),c=n.exp(f*(i-1)-d),u=t<.5?t:1-t,a=(2.30753+.27061*(o=n.sqrt(-2*n.log(u))))/(1+o*(.99229+.04481*o))-o,t<.5&&(a=-a),a=n.max(.001,r*n.pow(1-1/(9*r)-a/(3*n.sqrt(r)),3))):a=t<(o=1-r*(.253+.12*r))?n.pow(t/o,1/r):1-n.log(1-(t-o)/(1-o));s<12;s++){if(a<=0)return 0;if((a-=o=(l=(e.lowRegGamma(r,a)-t)/(o=r>1?c*n.exp(-(a-f)+f*(n.log(a)-i)):n.exp(-a+f*n.log(a)-d)))/(1-.5*n.min(1,l*((r-1)/a-1))))<=0&&(a=.5*(a+o)),n.abs(o)<1e-8*a)break}return a},e.erf=function(e){var t,r,a,o,l=[-1.3026537197817094,.6419697923564902,.019476473204185836,-.00956151478680863,-.000946595344482036,.000366839497852761,42523324806907e-18,-20278578112534e-18,-1624290004647e-18,130365583558e-17,1.5626441722e-8,-8.5238095915e-8,6.529054439e-9,5.059343495e-9,-9.91364156e-10,-2.27365122e-10,96467911e-18,2394038e-18,-6886027e-18,894487e-18,313092e-18,-112708e-18,381e-18,7106e-18,-1523e-18,-94e-18,121e-18,-28e-18],u=l.length-1,i=!1,c=0,s=0;for(e<0&&(e=-e,i=!0),r=4*(t=2/(2+e))-2;u>0;u--)a=c,c=r*c-s+l[u],s=a;return o=t*n.exp(-e*e+.5*(l[0]+r*c)-s),i?o-1:1-o},e.erfc=function(n){return 1-e.erf(n)},e.erfcinv=function(t){var r,a,o,l,u=0;if(t>=2)return-100;if(t<=0)return 100;for(l=t<1?t:2-t,r=-.70711*((2.30753+.27061*(o=n.sqrt(-2*n.log(l/2))))/(1+o*(.99229+.04481*o))-o);u<2;u++)r+=(a=e.erfc(r)-l)/(1.1283791670955126*n.exp(-r*r)-r*a);return t<1?r:-r},e.ibetainv=function(t,r,a){var o,l,u,i,c,s,f,d,p,m,h=r-1,g=a-1,v=0;if(t<=0)return 0;if(t>=1)return 1;for(r>=1&&a>=1?(u=t<.5?t:1-t,s=(2.30753+.27061*(i=n.sqrt(-2*n.log(u))))/(1+i*(.99229+.04481*i))-i,t<.5&&(s=-s),f=(s*s-3)/6,d=2/(1/(2*r-1)+1/(2*a-1)),p=s*n.sqrt(f+d)/d-(1/(2*a-1)-1/(2*r-1))*(f+5/6-2/(3*d)),s=r/(r+a*n.exp(2*p))):(o=n.log(r/(r+a)),l=n.log(a/(r+a)),s=t<(i=n.exp(r*o)/r)/(p=i+(c=n.exp(a*l)/a))?n.pow(r*p*t,1/r):1-n.pow(a*p*(1-t),1/a)),m=-e.gammaln(r)-e.gammaln(a)+e.gammaln(r+a);v<10;v++){if(0===s||1===s)return s;if((s-=i=(c=(e.ibeta(s,r,a)-t)/(i=n.exp(h*n.log(s)+g*n.log(1-s)+m)))/(1-.5*n.min(1,c*(h/s-g/(1-s)))))<=0&&(s=.5*(s+i)),s>=1&&(s=.5*(s+i+1)),n.abs(i)<1e-8*s&&v>0)break}return s},e.ibeta=function(t,r,a){var o=0===t||1===t?0:n.exp(e.gammaln(r+a)-e.gammaln(r)-e.gammaln(a)+r*n.log(t)+a*n.log(1-t));return!(t<0||t>1)&&(t<(r+1)/(r+a+2)?o*e.betacf(t,r,a)/r:1-o*e.betacf(1-t,a,r)/a)},e.randn=function(t,r){var a,o,l,u,i;if(r||(r=t),t)return e.create(t,r,(function(){return e.randn()}));do{a=e._random_fn(),o=1.7156*(e._random_fn()-.5),i=(l=a-.449871)*l+(u=n.abs(o)+.386595)*(.196*u-.25472*l)}while(i>.27597&&(i>.27846||o*o>-4*n.log(a)*a*a));return o/a},e.randg=function(t,r,a){var o,l,u,i,c,s,f=t;if(a||(a=r),t||(t=1),r)return(s=e.zeros(r,a)).alter((function(){return e.randg(t)})),s;t<1&&(t+=1),o=t-1/3,l=1/n.sqrt(9*o);do{do{i=1+l*(c=e.randn())}while(i<=0);i*=i*i,u=e._random_fn()}while(u>1-.331*n.pow(c,4)&&n.log(u)>.5*c*c+o*(1-i+n.log(i)));if(t==f)return o*i;do{u=e._random_fn()}while(0===u);return n.pow(u,1/f)*o*i},function(n){for(var t=0;ta;)f=i,u=c+(o=-(t+s)*(t+r+s)*e/(t+2*s)/(t+2*s+1))*u,i=(l=i+o*l)+(o=(s+=1)*(r-s)*e/(t+2*s-1)/(t+2*s))*i,l/=c=u+o*c,u/=c,i/=c,c=1;return i/t}function r(t,r,a){var o=[.9815606342467192,.9041172563704749,.7699026741943047,.5873179542866175,.3678314989981802,.1252334085114689],l=[.04717533638651183,.10693932599531843,.16007832854334622,.20316742672306592,.2334925365383548,.24914704581340277],u=.5*t;if(u>=8)return 1;var i,c=2*e.normal.cdf(u,0,1,1,0)-1;c=c>=n.exp(-50/a)?n.pow(c,a):0;for(var s=u,f=(8-u)/(i=t>3?2:3),d=s+f,p=0,m=a-1,h=1;h<=i;h++){for(var g=0,v=.5*(d+s),y=.5*(d-s),b=1;b<=12;b++){var w,k=v+y*(660)break;var x=2*e.normal.cdf(k,0,1,1,0)*.5-2*e.normal.cdf(k,t,1,1,0)*.5;x>=n.exp(-30/m)&&(g+=x=l[w-1]*n.exp(-.5*S)*n.pow(x,m))}p+=g*=2*y*a/n.sqrt(2*n.PI),s=d,d+=f}return(c+=p)<=n.exp(-30/r)?0:(c=n.pow(c,r))>=1?1:c}!function(n){for(var t=0;t1||t<0?0:1==r&&1==a?1:r<512&&a<512?n.pow(t,r-1)*n.pow(1-t,a-1)/e.betafn(r,a):n.exp((r-1)*n.log(t)+(a-1)*n.log(1-t)-e.betaln(r,a))},cdf:function(n,t,r){return n>1||n<0?1*(n>1):e.ibeta(n,t,r)},inv:function(n,t,r){return e.ibetainv(n,t,r)},mean:function(e,n){return e/(e+n)},median:function(n,t){return e.ibetainv(.5,n,t)},mode:function(e,n){return(e-1)/(e+n-2)},sample:function(n,t){var r=e.randg(n);return r/(r+e.randg(t))},variance:function(e,t){return e*t/(n.pow(e+t,2)*(e+t+1))}}),e.extend(e.centralF,{pdf:function(t,r,a){var o;return t<0?0:r<=2?0===t&&r<2?1/0:0===t&&2===r?1:1/e.betafn(r/2,a/2)*n.pow(r/a,r/2)*n.pow(t,r/2-1)*n.pow(1+r/a*t,-(r+a)/2):(o=r*t/(a+t*r),r*(a/(a+t*r))/2*e.binomial.pdf((r-2)/2,(r+a-2)/2,o))},cdf:function(n,t,r){return n<0?0:e.ibeta(t*n/(t*n+r),t/2,r/2)},inv:function(n,t,r){return r/(t*(1/e.ibetainv(n,t/2,r/2)-1))},mean:function(e,n){return n>2?n/(n-2):void 0},mode:function(e,n){return e>2?n*(e-2)/(e*(n+2)):void 0},sample:function(n,t){return 2*e.randg(n/2)/n/(2*e.randg(t/2)/t)},variance:function(e,n){if(!(n<=4))return 2*n*n*(e+n-2)/(e*(n-2)*(n-2)*(n-4))}}),e.extend(e.cauchy,{pdf:function(e,t,r){return r<0?0:r/(n.pow(e-t,2)+n.pow(r,2))/n.PI},cdf:function(e,t,r){return n.atan((e-t)/r)/n.PI+.5},inv:function(e,t,r){return t+r*n.tan(n.PI*(e-.5))},median:function(e){return e},mode:function(e){return e},sample:function(t,r){return e.randn()*n.sqrt(1/(2*e.randg(.5)))*r+t}}),e.extend(e.chisquare,{pdf:function(t,r){return t<0?0:0===t&&2===r?.5:n.exp((r/2-1)*n.log(t)-t/2-r/2*n.log(2)-e.gammaln(r/2))},cdf:function(n,t){return n<0?0:e.lowRegGamma(t/2,n/2)},inv:function(n,t){return 2*e.gammapinv(n,.5*t)},mean:function(e){return e},median:function(e){return e*n.pow(1-2/(9*e),3)},mode:function(e){return e-2>0?e-2:0},sample:function(n){return 2*e.randg(n/2)},variance:function(e){return 2*e}}),e.extend(e.exponential,{pdf:function(e,t){return e<0?0:t*n.exp(-t*e)},cdf:function(e,t){return e<0?0:1-n.exp(-t*e)},inv:function(e,t){return-n.log(1-e)/t},mean:function(e){return 1/e},median:function(e){return 1/e*n.log(2)},mode:function(){return 0},sample:function(t){return-1/t*n.log(e._random_fn())},variance:function(e){return n.pow(e,-2)}}),e.extend(e.gamma,{pdf:function(t,r,a){return t<0?0:0===t&&1===r?1/a:n.exp((r-1)*n.log(t)-t/a-e.gammaln(r)-r*n.log(a))},cdf:function(n,t,r){return n<0?0:e.lowRegGamma(t,n/r)},inv:function(n,t,r){return e.gammapinv(n,t)*r},mean:function(e,n){return e*n},mode:function(e,n){if(e>1)return(e-1)*n},sample:function(n,t){return e.randg(n)*t},variance:function(e,n){return e*n*n}}),e.extend(e.invgamma,{pdf:function(t,r,a){return t<=0?0:n.exp(-(r+1)*n.log(t)-a/t-e.gammaln(r)+r*n.log(a))},cdf:function(n,t,r){return n<=0?0:1-e.lowRegGamma(t,r/n)},inv:function(n,t,r){return r/e.gammapinv(1-n,t)},mean:function(e,n){return e>1?n/(e-1):void 0},mode:function(e,n){return n/(e+1)},sample:function(n,t){return t/e.randg(n)},variance:function(e,n){if(!(e<=2))return n*n/((e-1)*(e-1)*(e-2))}}),e.extend(e.kumaraswamy,{pdf:function(e,t,r){return 0===e&&1===t?r:1===e&&1===r?t:n.exp(n.log(t)+n.log(r)+(t-1)*n.log(e)+(r-1)*n.log(1-n.pow(e,t)))},cdf:function(e,t,r){return e<0?0:e>1?1:1-n.pow(1-n.pow(e,t),r)},inv:function(e,t,r){return n.pow(1-n.pow(1-e,1/r),1/t)},mean:function(n,t){return t*e.gammafn(1+1/n)*e.gammafn(t)/e.gammafn(1+1/n+t)},median:function(e,t){return n.pow(1-n.pow(2,-1/t),1/e)},mode:function(e,t){if(e>=1&&t>=1&&1!==e&&1!==t)return n.pow((e-1)/(e*t-1),1/e)},variance:function(){throw new Error("variance not yet implemented")}}),e.extend(e.lognormal,{pdf:function(e,t,r){return e<=0?0:n.exp(-n.log(e)-.5*n.log(2*n.PI)-n.log(r)-n.pow(n.log(e)-t,2)/(2*r*r))},cdf:function(t,r,a){return t<0?0:.5+.5*e.erf((n.log(t)-r)/n.sqrt(2*a*a))},inv:function(t,r,a){return n.exp(-1.4142135623730951*a*e.erfcinv(2*t)+r)},mean:function(e,t){return n.exp(e+t*t/2)},median:function(e){return n.exp(e)},mode:function(e,t){return n.exp(e-t*t)},sample:function(t,r){return n.exp(e.randn()*r+t)},variance:function(e,t){return(n.exp(t*t)-1)*n.exp(2*e+t*t)}}),e.extend(e.noncentralt,{pdf:function(t,r,a){return n.abs(a)<1e-14?e.studentt.pdf(t,r):n.abs(t)<1e-14?n.exp(e.gammaln((r+1)/2)-a*a/2-.5*n.log(n.PI*r)-e.gammaln(r/2)):r/t*(e.noncentralt.cdf(t*n.sqrt(1+2/r),r+2,a)-e.noncentralt.cdf(t,r,a))},cdf:function(t,r,a){var o=1e-14;if(n.abs(a)o||i>o;)c=i,f>0&&(d*=a*a/(2*f),p*=a*a/(2*(f+.5))),u+=.5*(i=d*e.beta.cdf(s,f+.5,r/2)+p*e.beta.cdf(s,f+1,r/2)),f++;return l?1-u:u}}),e.extend(e.normal,{pdf:function(e,t,r){return n.exp(-.5*n.log(2*n.PI)-n.log(r)-n.pow(e-t,2)/(2*r*r))},cdf:function(t,r,a){return.5*(1+e.erf((t-r)/n.sqrt(2*a*a)))},inv:function(n,t,r){return-1.4142135623730951*r*e.erfcinv(2*n)+t},mean:function(e){return e},median:function(e){return e},mode:function(e){return e},sample:function(n,t){return e.randn()*t+n},variance:function(e,n){return n*n}}),e.extend(e.pareto,{pdf:function(e,t,r){return e1e100?1e100:r,1/(n.sqrt(r)*e.betafn(.5,r/2))*n.pow(1+t*t/r,-(r+1)/2)},cdf:function(t,r){var a=r/2;return e.ibeta((t+n.sqrt(t*t+r))/(2*n.sqrt(t*t+r)),a,a)},inv:function(t,r){var a=e.ibetainv(2*n.min(t,1-t),.5*r,.5);return a=n.sqrt(r*(1-a)/a),t>.5?a:-a},mean:function(e){return e>1?0:void 0},median:function(){return 0},mode:function(){return 0},sample:function(t){return e.randn()*n.sqrt(t/(2*e.randg(t/2)))},variance:function(e){return e>2?e/(e-2):e>1?1/0:void 0}}),e.extend(e.weibull,{pdf:function(e,t,r){return e<0||t<0||r<0?0:r/t*n.pow(e/t,r-1)*n.exp(-n.pow(e/t,r))},cdf:function(e,t,r){return e<0?0:1-n.exp(-n.pow(e/t,r))},inv:function(e,t,r){return t*n.pow(-n.log(1-e),1/r)},mean:function(n,t){return n*e.gammafn(1+1/t)},median:function(e,t){return e*n.pow(n.log(2),1/t)},mode:function(e,t){return t<=1?0:e*n.pow((t-1)/t,1/t)},sample:function(t,r){return t*n.pow(-n.log(e._random_fn()),1/r)},variance:function(t,r){return t*t*e.gammafn(1+2/r)-n.pow(e.weibull.mean(t,r),2)}}),e.extend(e.uniform,{pdf:function(e,n,t){return et?0:1/(t-n)},cdf:function(e,n,t){return e=a)return 1;if(o<0||o>1||a<=0)return NaN;var i=o,c=(r=n.floor(r))+1,s=a-r,f=c+s,d=n.exp(e.gammaln(f)-e.gammaln(s)-e.gammaln(c)+c*n.log(i)+s*n.log(1-i));return l=i<(c+1)/(f+2)?d*t(i,c,s,u):1-d*t(1-i,s,c,u),n.round(1/u*(1-l))/(1/u)}}),e.extend(e.negbin,{pdf:function(t,r,a){return t===t>>>0&&(t<0?0:e.combination(t+r-1,r-1)*n.pow(1-a,t)*n.pow(a,r))},cdf:function(n,t,r){var a=0,o=0;if(n<0)return 0;for(;o<=n;o++)a+=e.negbin.pdf(o,t,r);return a}}),e.extend(e.hypgeom,{pdf:function(t,r,a,o){if(t!=t|0)return!1;if(t<0||to||t>a)return 0;if(2*a>r)return 2*o>r?e.hypgeom.pdf(r-a-o+t,r,r-a,r-o):e.hypgeom.pdf(o-t,r,r-a,o);if(2*o>r)return e.hypgeom.pdf(a-t,r,a,r-o);if(a1&&u=o||t>=a)return 1;if(2*a>r)return 2*o>r?e.hypgeom.cdf(r-a-o+t,r,r-a,r-o):1-e.hypgeom.cdf(o-t-1,r,r-a,o);if(2*o>r)return 1-e.hypgeom.cdf(a-t-1,r,a,r-o);if(a1&&io);return a-1},sampleLarge:function(t){var r,a,o,l,u,i,c,s,f,d,p=t;for(l=n.sqrt(p),u=n.log(p),i=.02483*(c=.931+2.53*l)-.059,s=1.1239+1.1328/(c-3.4),f=.9277-3.6224/(c-2);;){if(a=n.random()-.5,o=n.random(),d=.5-n.abs(a),r=n.floor((2*i/d+c)*a+p+.43),d>=.07&&o<=f)return r;if(!(r<0||d<.013&&o>d)&&n.log(o)+n.log(s)-n.log(i/(d*d)+c)<=r*u-p-e.loggam(r+1))return r}},sample:function(e){return e<10?this.sampleSmall(e):this.sampleLarge(e)}}),e.extend(e.triangular,{pdf:function(e,n,t,r){return t<=n||rt?NaN:et?0:er?NaN:e<=t?0:e>=r?1:e<=a?n.pow(e-t,2)/((r-t)*(a-t)):1-n.pow(r-e,2)/((r-t)*(r-a))},inv:function(e,t,r,a){return r<=t||ar?NaN:e<=(a-t)/(r-t)?t+(r-t)*n.sqrt(e*((a-t)/(r-t))):t+(r-t)*(1-n.sqrt((1-e)*(1-(a-t)/(r-t))))},mean:function(e,n,t){return(e+n+t)/3},median:function(e,t,r){return r<=(e+t)/2?t-n.sqrt((t-e)*(t-r))/n.sqrt(2):r>(e+t)/2?e+n.sqrt((t-e)*(r-e))/n.sqrt(2):void 0},mode:function(e,n,t){return t},sample:function(t,r,a){var o=e._random_fn();return o<(a-t)/(r-t)?t+n.sqrt(o*(r-t)*(a-t)):r-n.sqrt((1-o)*(r-t)*(r-a))},variance:function(e,n,t){return(e*e+n*n+t*t-e*n-e*t-n*t)/18}}),e.extend(e.arcsine,{pdf:function(e,t,r){return r<=t?NaN:e<=t||e>=r?0:2/n.PI*n.pow(n.pow(r-t,2)-n.pow(2*e-t-r,2),-.5)},cdf:function(e,t,r){return e25e3)return r(t,1,l);var c,s=.5*o,f=s*n.log(o)-o*n.log(2)-e.gammaln(s),d=s-1,p=.25*o;c=o<=100?1:o<=800?.5:o<=5e3?.25:.125,f+=n.log(c);for(var m=0,h=1;h<=50;h++){for(var g=0,v=(2*h-1)*c,y=1;y<=16;y++){var b,w;8=-30&&(g+=r(8=1&&g<=1e-14)break;m+=g}if(g>1e-14)throw new Error("tukey.cdf failed to converge");return m>1&&(m=1),m},inv:function(t,r,a){if(a<2||r<2)return NaN;if(t<0||t>1)return NaN;if(0===t)return 0;if(1===t)return 1/0;var o,l=function(e,t,r){var a=.5-.5*e,o=n.sqrt(n.log(1/(a*a))),l=o+((((-453642210148e-16*o-.204231210125)*o-.342242088547)*o-1)*o+.322232421088)/((((.0038560700634*o+.10353775285)*o+.531103462366)*o+.588581570495)*o+.099348462606);r<120&&(l+=(l*l*l+l)/r/4);var u=.8832-.2368*l;return r<120&&(u+=-1.214/r+1.208*l/r),l*(u*n.log(t-1)+1.4142)}(t,r,a),u=e.tukey.cdf(l,r,a)-t;o=u>0?n.max(0,l-1):l+1;for(var i,c=e.tukey.cdf(o,r,a)-t,s=1;s<50;s++)if(i=o-c*(o-l)/(c-u),u=c,l=o,i<0&&(i=0,c=-t),c=e.tukey.cdf(i,r,a)-t,o=i,n.abs(o-l)<1e-4)return i;throw new Error("tukey.inv failed to converge")}})}(n,Math),function(e,n){var t,r,a=Array.prototype.push,o=e.utils.isArray;function l(n){return o(n)||n instanceof e}e.extend({add:function(n,t){return l(t)?(l(t[0])||(t=[t]),e.map(n,(function(e,n,r){return e+t[n][r]}))):e.map(n,(function(e){return e+t}))},subtract:function(n,t){return l(t)?(l(t[0])||(t=[t]),e.map(n,(function(e,n,r){return e-t[n][r]||0}))):e.map(n,(function(e){return e-t}))},divide:function(n,t){return l(t)?(l(t[0])||(t=[t]),e.multiply(n,e.inv(t))):e.map(n,(function(e){return e/t}))},multiply:function(n,t){var r,a,o,u,i,c,s,f;if(void 0===n.length&&void 0===t.length)return n*t;if(i=n.length,c=n[0].length,s=e.zeros(i,o=l(t)?t[0].length:c),f=0,l(t)){for(;fr&&(a[o-1][l-1]=n[o][l])}var u=r%2?-1:1;t+=e(a)*n[0][r]*u}return t},gauss_elimination:function(t,r){var a,o,l,u,i=0,c=0,s=t.length,f=t[0].length,d=1,p=0,m=[];for(a=(t=e.aug(t,r))[0].length,i=0;i=0;i--){for(p=0,c=i+1;c<=s-1;c++)p+=m[c]*t[i][c];m[i]=(t[i][a-1]-p)/t[i][i]}return m},gauss_jordan:function(t,r){var a,o,l,u=e.aug(t,r),i=u.length,c=u[0].length,s=0;for(o=0;on.abs(u[f][o])&&(f=l);var d=u[o];for(u[o]=u[f],u[f]=d,l=o+1;l=0;o--){for(s=u[o][o],l=0;lo-1;a--)u[l][a]-=u[o][a]*u[l][o]/s;for(u[o][o]/=s,a=i;af?(p[s][f]=t[s][f],m[s][f]=h[s][f]=0):so;)l=c,c=e.add(e.multiply(i,l),u),s++;return c},gauss_seidel:function(t,r,a,o){for(var l,u,i,c,s,f=0,d=t.length,p=[],m=[],h=[];fl?(p[f][l]=t[f][l],m[f][l]=h[f][l]=0):fo;)u=s,s=e.add(e.multiply(c,u),i),f+=1;return s},SOR:function(t,r,a,o,l){for(var u,i,c,s,f,d=0,p=t.length,m=[],h=[],g=[];du?(m[d][u]=t[d][u],h[d][u]=g[d][u]=0):do;)i=f,f=e.add(e.multiply(s,i),c),d++;return f},householder:function(t){for(var r,a,o,l,u=t.length,i=t[0].length,c=0,s=[],f=[];c0?-1:1)*n.sqrt(r),a=n.sqrt((r*r-t[c+1][c]*r)/2),(s=e.zeros(u,1))[c+1][0]=(t[c+1][c]-r)/(2*a),o=c+2;o0?n.PI/4:-n.PI/4:n.atan(2*t[o][l]/(t[o][o]-t[l][l]))/2,(c=e.identity(f,f))[o][o]=n.cos(i),c[o][l]=-n.sin(i),c[l][o]=n.sin(i),c[l][l]=n.cos(i),d=e.multiply(d,c),t=e.multiply(e.multiply(e.inv(c),t),c),s=0,r=1;r.001&&(s=1)}for(r=0;r=f;)l=o(e,r+a),u=o(e,r),p[d]=(t[l]-2*t[u]+t[2*u-l])/(a*a),a/=2,d++;for(c=p.length,i=1;1!=c;){for(s=0;sr);a++);return t[a-=1]+(r-n[a])*d[a]+e.sq(r-n[a])*o[a]+(r-n[a])*e.sq(r-n[a])*p[a]},gauss_quadrature:function(){throw new Error("gauss_quadrature not yet implemented")},PCA:function(n){var t,r,a,o,l,u=n.length,i=n[0].length,c=0,s=[],f=[],d=[],p=[],m=[],h=[],g=[];for(c=0;c1||r>1||e<=0||r<=0)throw new Error("Proportions should be greater than 0 and less than 1");var o=(e*t+r*a)/(t+a);return(e-r)/n.sqrt(o*(1-o)*(1/t+1/a))}e.extend({zscore:function(){var n=t.call(arguments);return r(n[1])?(n[0]-n[1])/n[2]:(n[0]-e.mean(n[1]))/e.stdev(n[1],n[2])},ztest:function(){var r,o=t.call(arguments);return a(o[1])?(r=e.zscore(o[0],o[1],o[3]),1===o[2]?e.normal.cdf(-n.abs(r),0,1):2*e.normal.cdf(-n.abs(r),0,1)):o.length>2?(r=e.zscore(o[0],o[1],o[2]),1===o[3]?e.normal.cdf(-n.abs(r),0,1):2*e.normal.cdf(-n.abs(r),0,1)):(r=o[0],1===o[1]?e.normal.cdf(-n.abs(r),0,1):2*e.normal.cdf(-n.abs(r),0,1))}}),e.extend(e.fn,{zscore:function(e,n){return(e-this.mean())/this.stdev(n)},ztest:function(t,r,a){var o=n.abs(this.zscore(t,a));return 1===r?e.normal.cdf(-o,0,1):2*e.normal.cdf(-o,0,1)}}),e.extend({tscore:function(){var r=t.call(arguments);return 4===r.length?(r[0]-r[1])/(r[2]/n.sqrt(r[3])):(r[0]-e.mean(r[1]))/(e.stdev(r[1],!0)/n.sqrt(r[1].length))},ttest:function(){var a,o=t.call(arguments);return 5===o.length?(a=n.abs(e.tscore(o[0],o[1],o[2],o[3])),1===o[4]?e.studentt.cdf(-a,o[3]-1):2*e.studentt.cdf(-a,o[3]-1)):r(o[1])?(a=n.abs(o[0]),1==o[2]?e.studentt.cdf(-a,o[1]-1):2*e.studentt.cdf(-a,o[1]-1)):(a=n.abs(e.tscore(o[0],o[1])),1==o[2]?e.studentt.cdf(-a,o[1].length-1):2*e.studentt.cdf(-a,o[1].length-1))}}),e.extend(e.fn,{tscore:function(e){return(e-this.mean())/(this.stdev(!0)/n.sqrt(this.cols()))},ttest:function(t,r){return 1===r?1-e.studentt.cdf(n.abs(this.tscore(t)),this.cols()-1):2*e.studentt.cdf(-n.abs(this.tscore(t)),this.cols()-1)}}),e.extend({anovafscore:function(){var r,a,o,l,u,i,c,s,f=t.call(arguments);if(1===f.length){for(u=new Array(f[0].length),c=0;c.5?1-r:r)})),s=n.studentt.inv(.975,t.df_resid),f=t.coef.map((function(e,n){var t=s*u[n];return[e-t,e+t]}));return{se:u,t:i,p:c,sigmaHat:l,interval95:f}}return{ols:function(r,a){var o=e(r,a),l=t(o),u=function(e){var t,r,a,o=e.R2/e.df_model/((1-e.R2)/e.df_resid);return{F_statistic:o,pvalue:1-(t=o,r=e.df_model,a=e.df_resid,n.beta.cdf(t/(a/r+t),r/2,a/2))}}(o),i=1-(1-o.R2)*((o.nobs-1)/o.df_resid);return o.t=l,o.f=u,o.adjust_R2=i,o}}}(),n.extend({buildxmatrix:function(){for(var e=new Array(arguments.length),t=0;t1){for(l=[],r=0;r{"use strict";var r=t(294),a=t(840);function o(e){for(var n="https://reactjs.org/docs/error-decoder.html?invariant="+e,t=1;t