diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index 1644bef..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2025-02-02T14:58:54.442Z diff --git a/.gitignore b/.gitignore index 4fdc97c..16b03f7 100644 --- a/.gitignore +++ b/.gitignore @@ -188,3 +188,7 @@ jsconfig.json # Other editor files # ###################### .idea/ + +# Cursor # +########## +.cursorignore diff --git a/CHANGELOG.md b/CHANGELOG.md index 1e019d1..b0be898 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@
-## Unreleased (2025-02-02) +## Unreleased (2025-02-19)
@@ -12,6 +12,7 @@
+- [`333db47`](https://github.com/stdlib-js/stdlib/commit/333db47fbaf71f768a5d27c2a29b11656093f561) - **refactor:** update paths _(by Aayush Khanna)_ - [`ff97e29`](https://github.com/stdlib-js/stdlib/commit/ff97e29be19b90e74565d410af768774bf96bf2e) - **chore:** update wording from non-negative to nonnegative _(by Philipp Burckhardt)_
@@ -24,8 +25,9 @@ ### Contributors -A total of 1 person contributed to this release. Thank you to this contributor: +A total of 2 people contributed to this release. Thank you to the following contributors: +- Aayush Khanna - Philipp Burckhardt
diff --git a/CONTRIBUTORS b/CONTRIBUTORS index aedb148..c6297ff 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -35,9 +35,12 @@ Dominik Moritz Dorrin Sotoudeh EuniceSim142 <77243938+EuniceSim142@users.noreply.github.com> Frank Kovacs +GK Bishnoi +Gaurav Golden Kumar <103646877+AuenKr@users.noreply.github.com> Gunj Joshi -Gururaj Gurram <143020143+gururaj1512@users.noreply.github.com> +Gururaj Gurram +Harsh <149176984+hrshya@users.noreply.github.com> HarshaNP <96897754+GittyHarsha@users.noreply.github.com> Harshita Kalani Hridyanshu <124202756+HRIDYANSHU054@users.noreply.github.com> @@ -63,6 +66,7 @@ Marcus Fantham Matt Cochrane Mihir Pandit <129577900+MSP20086@users.noreply.github.com> Milan Raj +Mohammad Bin Aftab <48010758+MohammadBinAftab@users.noreply.github.com> Mohammad Kaif Momtchil Momtchev Muhammad Haris @@ -100,6 +104,7 @@ Sai Srikar Dumpeti <80447788+the-r3aper7@users.noreply.github.com> Sarthak Paandey <145528240+SarthakPaandey@users.noreply.github.com> Saurabh Singh Seyyed Parsa Neshaei +Shabareesh Shetty <139731143+ShabiShett07@users.noreply.github.com> Shashank Shekhar Singh Shivam Ahir <11shivam00@gmail.com> Shraddheya Shendre @@ -110,6 +115,7 @@ Snehil Shah Soumajit Chatterjee <121816890+soumajit23@users.noreply.github.com> Spandan Barve Stephannie Jiménez Gacha +Suhaib Ilahi Suraj Kumar <125961509+kumarsuraj212003@users.noreply.github.com> Tirtadwipa Manunggal Tudor Pagu <104032457+tudor-pagu@users.noreply.github.com> @@ -124,6 +130,9 @@ Vivek Maurya Xiaochuan Ye Yaswanth Kosuru <116426380+yaswanthkosuru@users.noreply.github.com> Yernar Yergaziyev +Yuvi Mittal <128018763+yuvi-mittal@users.noreply.github.com> +ekambains olenkabilonizhka <62379231+olenkabilonizhka@users.noreply.github.com> +pranav-1720 <123018993+pranav-1720@users.noreply.github.com> rainn <88160429+AmCodesLame@users.noreply.github.com> rei2hu diff --git a/dist/index.js b/dist/index.js index a0c6cde..d4f94fe 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1,4 +1,4 @@ -"use strict";var q=function(r,e){return function(){return e||r((e={exports:{}}).exports,e),e.exports}};var T=q(function(br,V){"use strict";function L(){return{alpha:.05,correct:!0}}V.exports=L});var F=q(function(_r,S){"use strict";var x=require("@stdlib/assert-is-boolean").isPrimitive,z=require("@stdlib/assert-is-number").isPrimitive,G=require("@stdlib/assert-is-plain-object"),H=require("@stdlib/assert-is-nan"),N=require("@stdlib/assert-has-own-property"),w=require("@stdlib/string-format");function K(r,e){if(!G(e))return new TypeError(w("invalid argument. Options argument must be an object. Value: `%s`.",e));if(N(e,"alpha")){if(r.alpha=e.alpha,!z(r.alpha)||H(r.alpha))return new TypeError(w("invalid option. `%s` option must be a number. Option: `%s`.","alpha",r.alpha));if(r.alpha<0||r.alpha>1)return new RangeError(w("invalid option. `%s` option must be a number on the interval: [0, 1]. Value: `%s`.","alpha",r.alpha))}return N(e,"correct")&&(r.correct=e.correct,!x(r.correct))?new TypeError(w("invalid option. `%s` option must be a boolean. Option: `%s`.","correct",r.simulate)):null}S.exports=K});var C=q(function(jr,k){"use strict";var Q=require("@stdlib/assert-is-positive-integer"),U=require("@stdlib/assert-is-plain-object"),W=require("@stdlib/assert-is-boolean").isPrimitive,P=require("@stdlib/assert-has-own-property"),R=require("@stdlib/math-base-special-roundn"),j=require("@stdlib/utils-define-nonenumerable-read-only-property"),g=require("@stdlib/utils-define-nonenumerable-read-only-accessor"),X=require("@stdlib/ndarray-base-to-array"),_=require("@stdlib/string-format");function d(r,e,t,i,a){return this instanceof d?(this._pValue=r,this._alpha=e,this._statistic=t,this._df=i,this._expected=a,this):new d(r,e,t,i,a)}g(d.prototype,"alpha",function(){return this._alpha});g(d.prototype,"df",function(){return this._df});g(d.prototype,"expected",function(){return this._expected});j(d.prototype,"method","Chi-square independence test");g(d.prototype,"pValue",function(){return this._pValue});g(d.prototype,"rejected",function(){return this._pValue<=this._alpha});g(d.prototype,"statistic",function(){return this._statistic});j(d.prototype,"toString",function(e){var t,i,a;if(i=4,t=!0,arguments.length>0){if(!U(e))throw new TypeError(_("invalid argument. Must provide an object. Value: `%s`.",e));if(P(e,"digits")){if(!Q(e.digits))throw new TypeError(_("invalid option. `%s` option must be a positive integer. Option: `%s`.","digits",e.digits));i=e.digits}if(P(e,"decision")){if(!W(e.decision))throw new TypeError(_("invalid option. `%s` option must be a boolean. Option: `%s`.","decision",e.decision));t=e.decision}}return a=[this.method,"","","Null hypothesis: the two variables are independent","",""," pValue: "+R(this._pValue,-i)," statistic: "+R(this._statistic,-i)," degrees of freedom: "+this._df,""],t&&(a.push("Test Decision: "+(this.rejected?"Reject":"Fail to reject")+" null in favor of alternative at "+this._alpha*100+"% significance level"),a.push("")),a.join("\n")});j(d.prototype,"toJSON",function(){var e=this._expected;return{rejected:this.rejected,alpha:this._alpha,pValue:this._pValue,df:this._df,statistic:this._statistic,expected:X(e.data,e.shape,e.strides,e.offset,e.order),method:this.method}});k.exports=d});var J=q(function(Or,A){"use strict";var B=require("@stdlib/assert-is-nonnegative-integer").isPrimitive,Y=require("@stdlib/assert-is-ndarray-like"),Z=require("@stdlib/assert-is-collection"),$=require("@stdlib/array-base-flatten2d-by").assign,y=require("@stdlib/array-float64"),rr=require("@stdlib/array-shape"),er=require("@stdlib/ndarray-ctor"),D=require("@stdlib/ndarray-base-numel"),tr=require("@stdlib/ndarray-base-vind2bind"),ir=require("@stdlib/ndarray-base-ind2sub"),O=require("@stdlib/blas-ext-base-dsumpw"),ar=require("@stdlib/blas-base-dscal"),nr=require("@stdlib/blas-ext-base-dapx"),or=require("@stdlib/stats-base-dmin"),sr=require("@stdlib/math-base-special-abs"),ur=require("@stdlib/math-base-special-min"),m=require("@stdlib/string-format"),vr=require("@stdlib/stats-base-dists-chisquare-cdf"),lr=T(),dr=F(),hr=C(),I="throw";function fr(r,e){if(!B(r))throw new TypeError(m("invalid argument. First argument must contain nonnegative integers. Indices: (%s). Value: `%s`.",e.join(", "),String(r)));return r}function cr(r,e){var t,i,a,v,n,o,s,l,u;for(i=r.data,v=r.order,n=r.strides,o=r.offset,s=D(e),t=new y(s),u=0;u1&&(u=dr(o,e),u))throw u;return p=h[0],f=h[1],E=O(p*f,c,1),v=M(c,p,f,0),a=M(c,p,f,1),n=pr(v,a),n=ar(n.length,1/E,n,1),i=gr(c,n),p===2&&f===2&&o.correct&&(t=ur(.5,or(i.length,i,1)),nr(i.length,-t,i,1)),l=mr(i,n),b=(p-1)*(f-1),s=1-vr(l,b),n=new er("float64",n,[p,f],[f,1],0,"row-major",{readonly:!0}),new hr(s,o.alpha,l,b,n)}A.exports=yr});var qr=J();module.exports=qr; +"use strict";var q=function(r,e){return function(){return e||r((e={exports:{}}).exports,e),e.exports}};var T=q(function(br,V){"use strict";function L(){return{alpha:.05,correct:!0}}V.exports=L});var F=q(function(_r,S){"use strict";var x=require("@stdlib/assert-is-boolean").isPrimitive,z=require("@stdlib/assert-is-number").isPrimitive,G=require("@stdlib/assert-is-plain-object"),H=require("@stdlib/assert-is-nan"),N=require("@stdlib/assert-has-own-property"),w=require("@stdlib/string-format");function K(r,e){if(!G(e))return new TypeError(w("invalid argument. Options argument must be an object. Value: `%s`.",e));if(N(e,"alpha")){if(r.alpha=e.alpha,!z(r.alpha)||H(r.alpha))return new TypeError(w("invalid option. `%s` option must be a number. Option: `%s`.","alpha",r.alpha));if(r.alpha<0||r.alpha>1)return new RangeError(w("invalid option. `%s` option must be a number on the interval: [0, 1]. Value: `%s`.","alpha",r.alpha))}return N(e,"correct")&&(r.correct=e.correct,!x(r.correct))?new TypeError(w("invalid option. `%s` option must be a boolean. Option: `%s`.","correct",r.simulate)):null}S.exports=K});var C=q(function(jr,k){"use strict";var Q=require("@stdlib/assert-is-positive-integer"),U=require("@stdlib/assert-is-plain-object"),W=require("@stdlib/assert-is-boolean").isPrimitive,P=require("@stdlib/assert-has-own-property"),R=require("@stdlib/math-base-special-roundn"),j=require("@stdlib/utils-define-nonenumerable-read-only-property"),g=require("@stdlib/utils-define-nonenumerable-read-only-accessor"),X=require("@stdlib/ndarray-base-to-array"),_=require("@stdlib/string-format");function d(r,e,t,i,a){return this instanceof d?(this._pValue=r,this._alpha=e,this._statistic=t,this._df=i,this._expected=a,this):new d(r,e,t,i,a)}g(d.prototype,"alpha",function(){return this._alpha});g(d.prototype,"df",function(){return this._df});g(d.prototype,"expected",function(){return this._expected});j(d.prototype,"method","Chi-square independence test");g(d.prototype,"pValue",function(){return this._pValue});g(d.prototype,"rejected",function(){return this._pValue<=this._alpha});g(d.prototype,"statistic",function(){return this._statistic});j(d.prototype,"toString",function(e){var t,i,a;if(i=4,t=!0,arguments.length>0){if(!U(e))throw new TypeError(_("invalid argument. Must provide an object. Value: `%s`.",e));if(P(e,"digits")){if(!Q(e.digits))throw new TypeError(_("invalid option. `%s` option must be a positive integer. Option: `%s`.","digits",e.digits));i=e.digits}if(P(e,"decision")){if(!W(e.decision))throw new TypeError(_("invalid option. `%s` option must be a boolean. Option: `%s`.","decision",e.decision));t=e.decision}}return a=[this.method,"","","Null hypothesis: the two variables are independent","",""," pValue: "+R(this._pValue,-i)," statistic: "+R(this._statistic,-i)," degrees of freedom: "+this._df,""],t&&(a.push("Test Decision: "+(this.rejected?"Reject":"Fail to reject")+" null in favor of alternative at "+this._alpha*100+"% significance level"),a.push("")),a.join("\n")});j(d.prototype,"toJSON",function(){var e=this._expected;return{rejected:this.rejected,alpha:this._alpha,pValue:this._pValue,df:this._df,statistic:this._statistic,expected:X(e.data,e.shape,e.strides,e.offset,e.order),method:this.method}});k.exports=d});var J=q(function(Or,A){"use strict";var B=require("@stdlib/assert-is-nonnegative-integer").isPrimitive,Y=require("@stdlib/assert-is-ndarray-like"),Z=require("@stdlib/assert-is-collection"),$=require("@stdlib/array-base-flatten2d-by").assign,y=require("@stdlib/array-float64"),rr=require("@stdlib/array-shape"),er=require("@stdlib/ndarray-ctor"),D=require("@stdlib/ndarray-base-numel"),tr=require("@stdlib/ndarray-base-vind2bind"),ir=require("@stdlib/ndarray-base-ind2sub"),O=require("@stdlib/blas-ext-base-dsumpw"),ar=require("@stdlib/blas-base-dscal"),nr=require("@stdlib/blas-ext-base-dapx"),or=require("@stdlib/stats-strided-dmin"),sr=require("@stdlib/math-base-special-abs"),ur=require("@stdlib/math-base-special-min"),m=require("@stdlib/string-format"),vr=require("@stdlib/stats-base-dists-chisquare-cdf"),lr=T(),dr=F(),hr=C(),I="throw";function fr(r,e){if(!B(r))throw new TypeError(m("invalid argument. First argument must contain nonnegative integers. Indices: (%s). Value: `%s`.",e.join(", "),String(r)));return r}function cr(r,e){var t,i,a,v,n,o,s,l,u;for(i=r.data,v=r.order,n=r.strides,o=r.offset,s=D(e),t=new y(s),u=0;u1&&(u=dr(o,e),u))throw u;return p=h[0],f=h[1],E=O(p*f,c,1),v=M(c,p,f,0),a=M(c,p,f,1),n=pr(v,a),n=ar(n.length,1/E,n,1),i=gr(c,n),p===2&&f===2&&o.correct&&(t=ur(.5,or(i.length,i,1)),nr(i.length,-t,i,1)),l=mr(i,n),b=(p-1)*(f-1),s=1-vr(l,b),n=new er("float64",n,[p,f],[f,1],0,"row-major",{readonly:!0}),new hr(s,o.alpha,l,b,n)}A.exports=yr});var qr=J();module.exports=qr; /** * @license Apache-2.0 * diff --git a/dist/index.js.map b/dist/index.js.map index c8e7928..10a5d5c 100644 --- a/dist/index.js.map +++ b/dist/index.js.map @@ -1,7 +1,7 @@ { "version": 3, "sources": ["../lib/defaults.js", "../lib/validate.js", "../lib/results.js", "../lib/main.js", "../lib/index.js"], - "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Returns default options.\n*\n* @private\n* @returns {Object} default options\n*/\nfunction defaults() {\n\treturn {\n\t\t'alpha': 0.05,\n\t\t'correct': true\n\t};\n}\n\n\n// EXPORTS //\n\nmodule.exports = defaults;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2020 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive;\nvar isNumber = require( '@stdlib/assert-is-number' ).isPrimitive;\nvar isObject = require( '@stdlib/assert-is-plain-object' );\nvar isnan = require( '@stdlib/assert-is-nan' );\nvar hasOwnProp = require( '@stdlib/assert-has-own-property' );\nvar format = require( '@stdlib/string-format' );\n\n\n// MAIN //\n\n/**\n* Validates function options.\n*\n* @private\n* @param {Object} opts - destination for validated options\n* @param {Options} options - function options\n* @param {number} [options.alpha] - significance level\n* @param {boolean} [options.correct] - boolean indicating whether to use Yates' continuity correction when provided a 2x2 contingency table\n* @returns {(null|Error)} null or an error\n*\n* @example\n* var opts = {};\n* var options = {\n* 'alpha': 0.01,\n* 'correct': true\n* };\n* var err = validate( opts, options );\n* if ( err ) {\n* throw err;\n* }\n*/\nfunction validate( opts, options ) {\n\tif ( !isObject( options ) ) {\n\t\treturn new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );\n\t}\n\tif ( hasOwnProp( options, 'alpha' ) ) {\n\t\topts.alpha = options.alpha;\n\t\tif ( !isNumber( opts.alpha ) || isnan( opts.alpha ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a number. Option: `%s`.', 'alpha', opts.alpha ) );\n\t\t}\n\t\tif ( opts.alpha < 0.0 || opts.alpha > 1.0 ) {\n\t\t\treturn new RangeError( format( 'invalid option. `%s` option must be a number on the interval: [0, 1]. Value: `%s`.', 'alpha', opts.alpha ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'correct' ) ) {\n\t\topts.correct = options.correct;\n\t\tif ( !isBoolean( opts.correct ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'correct', opts.simulate ) );\n\t\t}\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nmodule.exports = validate;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n/* eslint-disable no-invalid-this, no-restricted-syntax */\n\n'use strict';\n\n// MODULES //\n\nvar isPositiveInteger = require( '@stdlib/assert-is-positive-integer' );\nvar isObject = require( '@stdlib/assert-is-plain-object' );\nvar isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive;\nvar hasOwnProp = require( '@stdlib/assert-has-own-property' );\nvar roundn = require( '@stdlib/math-base-special-roundn' );\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar setReadOnlyAccessor = require( '@stdlib/utils-define-nonenumerable-read-only-accessor' );\nvar ndarray2array = require( '@stdlib/ndarray-base-to-array' );\nvar format = require( '@stdlib/string-format' );\n\n\n// MAIN //\n\n/**\n* Returns a results object.\n*\n* @private\n* @constructor\n* @param {number} pValue - p-value\n* @param {number} alpha - significance\n* @param {number} statistic - test statistic\n* @param {number} df - degrees of freedom\n* @param {ndarray} expected - expected frequencies\n* @returns {Results} results object\n*\n* @example\n* var array = require( '@stdlib/ndarray-array' );\n*\n* var expected = array([\n* [ 10.0, 15.0 ],\n* [ 21.0, 12.0 ]\n* ]);\n* var res = new Results( 0.0719, 0.1, 3.24, 1, expected );\n* // returns \n*/\nfunction Results( pValue, alpha, statistic, df, expected ) {\n\tif ( !(this instanceof Results) ) {\n\t\treturn new Results( pValue, alpha, statistic, df, expected );\n\t}\n\tthis._pValue = pValue;\n\tthis._alpha = alpha;\n\tthis._statistic = statistic;\n\tthis._df = df;\n\tthis._expected = expected;\n\treturn this;\n}\n\n/**\n* Significance level.\n*\n* @private\n* @name alpha\n* @memberof Results.prototype\n* @type {number}\n*\n* @example\n* var array = require( '@stdlib/ndarray-array' );\n*\n* var expected = array([\n* [ 10.0, 15.0 ],\n* [ 21.0, 12.0 ]\n* ]);\n* var res = new Results( 0.0719, 0.1, 3.24, 1, expected );\n*\n* var alpha = res.alpha;\n* // returns 0.1\n*/\nsetReadOnlyAccessor( Results.prototype, 'alpha', function get() {\n\treturn this._alpha;\n});\n\n/**\n* Degrees of freedom.\n*\n* @private\n* @name df\n* @memberof Results.prototype\n* @type {number}\n*\n* @example\n* var array = require( '@stdlib/ndarray-array' );\n*\n* var expected = array([\n* [ 10.0, 15.0 ],\n* [ 21.0, 12.0 ]\n* ]);\n* var res = new Results( 0.0719, 0.1, 3.24, 1, expected );\n*\n* var df = res.df;\n* // returns 1\n*/\nsetReadOnlyAccessor( Results.prototype, 'df', function get() {\n\treturn this._df;\n});\n\n/**\n* Expected frequencies.\n*\n* @private\n* @name expected\n* @memberof Results.prototype\n* @type {ndarray}\n*\n* @example\n* var array = require( '@stdlib/ndarray-array' );\n*\n* var expected = array([\n* [ 10.0, 15.0 ],\n* [ 21.0, 12.0 ]\n* ]);\n* var res = new Results( 0.0719, 0.1, 3.24, 1, expected );\n*\n* var expected = res.expected;\n* // returns \n*/\nsetReadOnlyAccessor( Results.prototype, 'expected', function get() {\n\treturn this._expected;\n});\n\n/**\n* Test name.\n*\n* @private\n* @name method\n* @memberof Results.prototype\n* @type {string}\n*\n* @example\n* var array = require( '@stdlib/ndarray-array' );\n*\n* var expected = array([\n* [ 10.0, 15.0 ],\n* [ 21.0, 12.0 ]\n* ]);\n* var res = new Results( 0.0719, 0.1, 3.24, 1, expected );\n*\n* var method = res.method;\n* // returns 'Chi-square independence test'\n*/\nsetReadOnly( Results.prototype, 'method', 'Chi-square independence test' );\n\n/**\n* Test p-value.\n*\n* @private\n* @name pValue\n* @memberof Results.prototype\n* @type {number}\n*\n* @example\n* var array = require( '@stdlib/ndarray-array' );\n*\n* var expected = array([\n* [ 10.0, 15.0 ],\n* [ 21.0, 12.0 ]\n* ]);\n* var res = new Results( 0.0719, 0.1, 3.24, 1, expected );\n*\n* var pval = res.pValue;\n* // returns 0.0719\n*/\nsetReadOnlyAccessor( Results.prototype, 'pValue', function get() {\n\treturn this._pValue;\n});\n\n/**\n* Boolean indicating the test decision.\n*\n* @private\n* @name rejected\n* @memberof Results.prototype\n* @type {boolean}\n*\n* @example\n* var array = require( '@stdlib/ndarray-array' );\n*\n* var expected = array([\n* [ 10.0, 15.0 ],\n* [ 21.0, 12.0 ]\n* ]);\n* var res = new Results( 0.0719, 0.1, 3.24, 1, expected );\n*\n* var bool = res.rejected;\n* // returns true\n*/\nsetReadOnlyAccessor( Results.prototype, 'rejected', function get() {\n\treturn ( this._pValue <= this._alpha );\n});\n\n/**\n* Test statistic.\n*\n* @private\n* @name statistic\n* @memberof Results.prototype\n* @type {number}\n*\n* @example\n* var array = require( '@stdlib/ndarray-array' );\n*\n* var expected = array([\n* [ 10.0, 15.0 ],\n* [ 21.0, 12.0 ]\n* ]);\n* var res = new Results( 0.0719, 0.1, 3.24, 1, expected );\n*\n* var stat = res.statistic;\n* // returns 3.24\n*/\nsetReadOnlyAccessor( Results.prototype, 'statistic', function get() {\n\treturn this._statistic;\n});\n\n/**\n* Serializes a results object as a string.\n*\n* ## Notes\n*\n* - Example output:\n*\n* ```text\n*\n* Chi-square independence test\n*\n* Null hypothesis: the two variables are independent\n*\n* pValue: 0.0719\n* statistic: 3.24\n* degrees of freedom: 1\n*\n* Test Decision: Reject null in favor of alternative at 10% significance level\n*\n* ```\n*\n* @private\n* @name toString\n* @memberof Results.prototype\n* @type {Function}\n* @param {Options} [opts] - options object\n* @param {PositiveInteger} [opts.digits=4] - number of digits after the decimal point\n* @param {boolean} [opts.decision=true] - boolean indicating whether to show the test decision\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @returns {string} serialized results\n*\n* @example\n* var array = require( '@stdlib/ndarray-array' );\n*\n* var expected = array([\n* [ 10.0, 15.0 ],\n* [ 21.0, 12.0 ]\n* ]);\n* var res = new Results( 0.0719, 0.1, 3.24, 1, expected );\n*\n* var str = res.toString();\n* // returns \n*/\nsetReadOnly( Results.prototype, 'toString', function toString( opts ) {\n\tvar decision;\n\tvar dgts;\n\tvar out;\n\n\tdgts = 4;\n\tdecision = true;\n\tif ( arguments.length > 0 ) {\n\t\tif ( !isObject( opts ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Must provide an object. Value: `%s`.', opts ) );\n\t\t}\n\t\tif ( hasOwnProp( opts, 'digits' ) ) {\n\t\t\tif ( !isPositiveInteger( opts.digits ) ) {\n\t\t\t\tthrow new TypeError( format( 'invalid option. `%s` option must be a positive integer. Option: `%s`.', 'digits', opts.digits ) );\n\t\t\t}\n\t\t\tdgts = opts.digits;\n\t\t}\n\t\tif ( hasOwnProp( opts, 'decision' ) ) {\n\t\t\tif ( !isBoolean( opts.decision ) ) {\n\t\t\t\tthrow new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'decision', opts.decision ) );\n\t\t\t}\n\t\t\tdecision = opts.decision;\n\t\t}\n\t}\n\tout = [\n\t\tthis.method,\n\t\t'',\n\t\t'',\n\t\t'Null hypothesis: the two variables are independent',\n\t\t'',\n\t\t'',\n\t\t' pValue: ' + roundn( this._pValue, -dgts ),\n\t\t' statistic: ' + roundn( this._statistic, -dgts ),\n\t\t' degrees of freedom: ' + this._df,\n\t\t''\n\t];\n\tif ( decision ) {\n\t\tout.push( 'Test Decision: ' + ( ( this.rejected ) ? 'Reject' : 'Fail to reject' ) + ' null in favor of alternative at ' + (this._alpha*100.0) + '% significance level' );\n\t\tout.push( '' );\n\t}\n\treturn out.join( '\\n' );\n});\n\n/**\n* Serializes a results object as a JSON object.\n*\n* ## Notes\n*\n* - `JSON.stringify()` implicitly calls this method when stringifying a `Results` instance.\n*\n* @private\n* @name toJSON\n* @memberof Results.prototype\n* @type {Function}\n* @returns {Object} serialized object\n*\n* @example\n* var array = require( '@stdlib/ndarray-array' );\n*\n* var expected = array([\n* [ 10.0, 15.0 ],\n* [ 21.0, 12.0 ]\n* ]);\n* var res = new Results( 0.0719, 0.1, 3.24, 1, expected );\n*\n* var o = res.toJSON();\n* // returns { 'rejected': true, 'alpha': 0.1, 'pValue': 0.0719, 'df': 1, ... }\n*/\nsetReadOnly( Results.prototype, 'toJSON', function toJSON() {\n\tvar x = this._expected;\n\treturn {\n\t\t'rejected': this.rejected,\n\t\t'alpha': this._alpha,\n\t\t'pValue': this._pValue,\n\t\t'df': this._df,\n\t\t'statistic': this._statistic,\n\t\t'expected': ndarray2array( x.data, x.shape, x.strides, x.offset, x.order ),\n\t\t'method': this.method\n\t};\n});\n\n\n// EXPORTS //\n\nmodule.exports = Results;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2020 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' ).isPrimitive;\nvar isndarrayLike = require( '@stdlib/assert-is-ndarray-like' );\nvar isCollection = require( '@stdlib/assert-is-collection' );\nvar flatten2dBy = require( '@stdlib/array-base-flatten2d-by' ).assign;\nvar Float64Array = require( '@stdlib/array-float64' );\nvar arrayShape = require( '@stdlib/array-shape' );\nvar ndarray = require( '@stdlib/ndarray-ctor' );\nvar numel = require( '@stdlib/ndarray-base-numel' );\nvar vind2bind = require( '@stdlib/ndarray-base-vind2bind' );\nvar ind2sub = require( '@stdlib/ndarray-base-ind2sub' );\nvar dsumpw = require( '@stdlib/blas-ext-base-dsumpw' );\nvar dscal = require( '@stdlib/blas-base-dscal' );\nvar dapx = require( '@stdlib/blas-ext-base-dapx' );\nvar dmin = require( '@stdlib/stats-base-dmin' );\nvar abs = require( '@stdlib/math-base-special-abs' );\nvar min = require( '@stdlib/math-base-special-min' );\nvar format = require( '@stdlib/string-format' );\nvar chisqCDF = require( '@stdlib/stats-base-dists-chisquare-cdf' );\nvar defaults = require( './defaults.js' );\nvar validate = require( './validate.js' );\nvar Results = require( './results.js' );\n\n\n// VARIABLES //\n\nvar MODE = 'throw';\n\n\n// FUNCTIONS //\n\n/**\n* Callback invoked upon flattening an array-like object.\n*\n* @private\n* @param {NonNegativeInteger} value - nested array element\n* @param {NonNegativeIntegerArray} indices - element indices\n* @param {Collection} arr - input array\n* @throws {TypeError} first argument must be a nonnegative integer\n* @returns {NonNegativeInteger} nested array element\n*/\nfunction flattenClbk( value, indices ) {\n\tif ( !isNonNegativeInteger( value ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must contain nonnegative integers. Indices: (%s). Value: `%s`.', indices.join( ', ' ), String( value ) ) );\n\t}\n\treturn value;\n}\n\n/**\n* Copies ndarray data to a new data buffer.\n*\n* @private\n* @param {ndarrayLike} x - input ndarray-like object\n* @param {NonNegativeIntegerArray} shape - array shape\n* @throws {TypeError} first argument must contain nonnegative integers\n* @returns {Float64Array} data buffer\n*/\nfunction copy2buffer( x, shape ) {\n\tvar out;\n\tvar buf;\n\tvar idx;\n\tvar ord;\n\tvar sx;\n\tvar ox;\n\tvar N;\n\tvar v;\n\tvar i;\n\n\t// Cache ndarray meta data:\n\tbuf = x.data;\n\tord = x.order;\n\tsx = x.strides;\n\tox = x.offset;\n\n\t// Compute the number of array elements:\n\tN = numel( shape );\n\n\t// Allocate a data buffer:\n\tout = new Float64Array( N );\n\n\t// Iterate over the ndarray and copy elements to a new buffer...\n\tfor ( i = 0; i < N; i++ ) {\n\t\tidx = vind2bind( shape, sx, ox, ord, i, MODE );\n\t\tv = buf[ idx ];\n\t\tif ( !isNonNegativeInteger( v ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. First argument must contain nonnegative integers. Indices: (%s). Value: `%s`.', ind2sub( shape, sx, ox, ord, i, MODE ), String( v ) ) );\n\t\t}\n\t\tout[ i ] = v;\n\t}\n\treturn out;\n}\n\n/**\n* Computes a sum along an axis.\n*\n* @private\n* @param {Float64Array} x - strided array\n* @param {NonNegativeInteger} nrows - number of rows\n* @param {NonNegativeInteger} ncols - number of columns\n* @param {NonNegativeInteger} axis - axis (0: sum across the rows; 1: sum down the columns)\n* @returns {Float64Array} results\n*\n* @example\n* var Float64Array = require( '@stdlib/array-float64' );\n*\n* // 2x3: [ [ 1.0, 2.0, 3.0 ], [ 4.0, 5.0, 6.0 ] ]\n* var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] );\n*\n* var rsums = axisSum( x, 2, 3, 0 );\n* // returns [ 6.0, 15.0 ]\n*\n* var csums = axisSum( x, 2, 3, 1 );\n* // returns [ 5.0, 7.0, 9.0 ]\n*/\nfunction axisSum( x, nrows, ncols, axis ) {\n\tvar offset;\n\tvar out;\n\tvar dx0;\n\tvar dx1;\n\tvar S0;\n\tvar S1;\n\tvar i1;\n\n\t// Resolve loop variables...\n\tif ( axis === 0 ) {\n\t\t// Sum across rows...\n\t\tS0 = ncols;\n\t\tS1 = nrows;\n\t\tdx0 = 1;\n\t\tdx1 = ncols;\n\t} else { // axis === 1\n\t\t// Sum down columns...\n\t\tS0 = nrows;\n\t\tS1 = ncols;\n\t\tdx0 = ncols;\n\t\tdx1 = 1;\n\t}\n\tout = new Float64Array( S1 );\n\toffset = 0;\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tout[ i1 ] = dsumpw.ndarray( S0, x, dx0, offset );\n\t\toffset += dx1;\n\t}\n\treturn out;\n}\n\n/**\n* Computes the outer product.\n*\n* @private\n* @param {Float64Array} x - first input array\n* @param {Float64Array} y - second input array\n* @returns {Float64Array} results\n*/\nfunction outer( x, y ) {\n\tvar out;\n\tvar io;\n\tvar M;\n\tvar N;\n\tvar v;\n\tvar i;\n\tvar j;\n\n\tM = x.length;\n\tN = y.length;\n\n\tout = new Float64Array( M*N );\n\tio = 0;\n\tfor ( i = 0; i < M; i++ ) {\n\t\tv = x[ i ];\n\t\tfor ( j = 0; j < N; j++ ) {\n\t\t\tout[ io ] = v * y[ j ];\n\t\t\tio += 1;\n\t\t}\n\t}\n\treturn out;\n}\n\n/**\n* Computes the element-wise absolute difference.\n*\n* @private\n* @param {Float64Array} x - first input array\n* @param {Float64Array} y - second input array\n* @returns {Float64Array} results\n*/\nfunction absdiff( x, y ) {\n\tvar out;\n\tvar i;\n\n\tout = new Float64Array( x.length );\n\tfor ( i = 0; i < x.length; i++ ) {\n\t\tout[ i ] = abs( x[ i ] - y[ i ] );\n\t}\n\treturn out;\n}\n\n/**\n* Computes the test statistic.\n*\n* ## Notes\n*\n* - Mutates the first input array.\n*\n* @private\n* @param {Float64Array} x - absolute differences\n* @param {Float64Array} m - expected frequencies\n* @returns {number} test statistic\n*/\nfunction testStatistic( x, m ) {\n\tvar i;\n\tfor ( i = 0; i < x.length; i++ ) {\n\t\tx[ i ] = ( x[i]*x[i] ) / m[ i ];\n\t}\n\treturn dsumpw( x.length, x, 1 );\n}\n\n\n// MAIN //\n\n/**\n* Performs a chi-square independence test.\n*\n* @param {(MatrixLike|Collection)} x - two-way table of observed frequencies\n* @param {Options} [options] - function options\n* @param {number} [options.alpha=0.05] - significance level\n* @param {boolean} [options.correct=true] - boolean indicating whether to use Yates' continuity correction when provided a 2x2 contingency table\n* @throws {TypeError} first argument must be an array of arrays or a two-dimensional ndarray-like object\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {RangeError} significance level must be a number on the interval `[0,1]`\n* @returns {Object} test results\n*\n* @example\n* var x = [ [ 20, 30 ], [ 30, 20 ] ];\n*\n* var out = chi2test( x );\n*\n* var o = out.toJSON();\n* // returns { 'rejected': false, 'alpha': 0.05, 'pValue': ~0.072, ... }\n*/\nfunction chi2test( x, options ) {\n\tvar correction;\n\tvar diffs;\n\tvar csums;\n\tvar rsums;\n\tvar means;\n\tvar opts;\n\tvar pval;\n\tvar stat;\n\tvar err;\n\tvar cnt;\n\tvar buf;\n\tvar dof;\n\tvar sh;\n\tvar M;\n\tvar N;\n\n\tif ( isndarrayLike( x ) ) {\n\t\tsh = x.shape;\n\t\tif ( sh.length !== 2 ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. First argument must be an array of arrays or a two-dimensional ndarray-like object. Number of input array dimensions: %u.', sh.length ) );\n\t\t}\n\t\tbuf = copy2buffer( x, sh );\n\t} else if ( isCollection( x ) ) {\n\t\tsh = arrayShape( x );\n\t\tif ( sh.length !== 2 ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. First argument must be an array of arrays or a two-dimensional ndarray-like object. Number of input array dimensions: %u.', sh.length ) );\n\t\t}\n\t\tbuf = new Float64Array( numel( sh ) );\n\t\tflatten2dBy( x, sh, false, buf, 1, 0, flattenClbk );\n\t} else {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be an array of arrays or a two-dimensional ndarray-like object. Value: `%s`.', x ) );\n\t}\n\t// NOTE: `buf` is now a single-segment contiguous `Float64Array` containing nonnegative integer values...\n\n\topts = defaults();\n\tif ( arguments.length > 1 ) {\n\t\terr = validate( opts, options );\n\t\tif ( err ) {\n\t\t\tthrow err;\n\t\t}\n\t}\n\t// Extract the array dimensions:\n\tM = sh[ 0 ]; // number of rows\n\tN = sh[ 1 ]; // number of columns\n\n\t// Compute the total number of observations:\n\tcnt = dsumpw( M*N, buf, 1 );\n\n\t// Compute marginal sums:\n\trsums = axisSum( buf, M, N, 0 ); // sum across the rows (length: M)\n\tcsums = axisSum( buf, M, N, 1 ); // sum down the columns (length: N)\n\n\t// Compute the outer product:\n\tmeans = outer( rsums, csums ); // MxN\n\n\t// Compute the expected frequencies:\n\tmeans = dscal( means.length, 1.0/cnt, means, 1 );\n\n\t// Compute the absolute differences between the observed and expected frequencies:\n\tdiffs = absdiff( buf, means );\n\n\t// Apply Yates' continuity correction...\n\tif ( M === 2 && N === 2 && opts.correct ) {\n\t\tcorrection = min( 0.5, dmin( diffs.length, diffs, 1 ) );\n\t\tdapx( diffs.length, -correction, diffs, 1 );\n\t}\n\n\t// Compute the test statistic:\n\tstat = testStatistic( diffs, means );\n\n\t// Compute the number of degrees of freedom:\n\tdof = ( M-1 ) * ( N-1 );\n\n\t// Compute the p-value:\n\tpval = 1 - chisqCDF( stat, dof );\n\n\t// Return test results:\n\tmeans = new ndarray( 'float64', means, [ M, N ], [ N, 1 ], 0, 'row-major', {\n\t\t'readonly': true\n\t});\n\treturn new Results( pval, opts.alpha, stat, dof, means );\n}\n\n\n// EXPORTS //\n\nmodule.exports = chi2test;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2020 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Chi-square independence test.\n*\n* @module @stdlib/stats-chi2test\n*\n* @example\n* var chi2test = require( '@stdlib/stats-chi2test' );\n*\n* var x = [ [ 20, 30 ], [ 30, 20 ] ];\n*\n* var out = chi2test( x );\n*\n* var o = out.toJSON();\n* // returns { 'rejected': false, 'alpha': 0.05, 'pValue': ~0.072, ... }\n*/\n\n// MODULES //\n\nvar chi2test = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = chi2test;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,GAAAC,EAAA,cA4BA,SAAS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YAAa,CAC1E,SAAY,EACb,CAAC,EACM,IAAId,GAAS2C,EAAMD,EAAK,MAAOE,EAAMG,EAAKN,CAAM,CACxD,CAKA9D,EAAO,QAAUwD,KCvTjB,IAAIc,GAAW,IAKf,OAAO,QAAUA", + "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Returns default options.\n*\n* @private\n* @returns {Object} default options\n*/\nfunction defaults() {\n\treturn {\n\t\t'alpha': 0.05,\n\t\t'correct': true\n\t};\n}\n\n\n// EXPORTS //\n\nmodule.exports = defaults;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2020 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive;\nvar isNumber = require( '@stdlib/assert-is-number' ).isPrimitive;\nvar isObject = require( '@stdlib/assert-is-plain-object' );\nvar isnan = require( '@stdlib/assert-is-nan' );\nvar hasOwnProp = require( '@stdlib/assert-has-own-property' );\nvar format = require( '@stdlib/string-format' );\n\n\n// MAIN //\n\n/**\n* Validates function options.\n*\n* @private\n* @param {Object} opts - destination for validated options\n* @param {Options} options - function options\n* @param {number} [options.alpha] - significance level\n* @param {boolean} [options.correct] - boolean indicating whether to use Yates' continuity correction when provided a 2x2 contingency table\n* @returns {(null|Error)} null or an error\n*\n* @example\n* var opts = {};\n* var options = {\n* 'alpha': 0.01,\n* 'correct': true\n* };\n* var err = validate( opts, options );\n* if ( err ) {\n* throw err;\n* }\n*/\nfunction validate( opts, options ) {\n\tif ( !isObject( options ) ) {\n\t\treturn new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );\n\t}\n\tif ( hasOwnProp( options, 'alpha' ) ) {\n\t\topts.alpha = options.alpha;\n\t\tif ( !isNumber( opts.alpha ) || isnan( opts.alpha ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a number. Option: `%s`.', 'alpha', opts.alpha ) );\n\t\t}\n\t\tif ( opts.alpha < 0.0 || opts.alpha > 1.0 ) {\n\t\t\treturn new RangeError( format( 'invalid option. `%s` option must be a number on the interval: [0, 1]. Value: `%s`.', 'alpha', opts.alpha ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'correct' ) ) {\n\t\topts.correct = options.correct;\n\t\tif ( !isBoolean( opts.correct ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'correct', opts.simulate ) );\n\t\t}\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nmodule.exports = validate;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n/* eslint-disable no-invalid-this, no-restricted-syntax */\n\n'use strict';\n\n// MODULES //\n\nvar isPositiveInteger = require( '@stdlib/assert-is-positive-integer' );\nvar isObject = require( '@stdlib/assert-is-plain-object' );\nvar isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive;\nvar hasOwnProp = require( '@stdlib/assert-has-own-property' );\nvar roundn = require( '@stdlib/math-base-special-roundn' );\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar setReadOnlyAccessor = require( '@stdlib/utils-define-nonenumerable-read-only-accessor' );\nvar ndarray2array = require( '@stdlib/ndarray-base-to-array' );\nvar format = require( '@stdlib/string-format' );\n\n\n// MAIN //\n\n/**\n* Returns a results object.\n*\n* @private\n* @constructor\n* @param {number} pValue - p-value\n* @param {number} alpha - significance\n* @param {number} statistic - test statistic\n* @param {number} df - degrees of freedom\n* @param {ndarray} expected - expected frequencies\n* @returns {Results} results object\n*\n* @example\n* var array = require( '@stdlib/ndarray-array' );\n*\n* var expected = array([\n* [ 10.0, 15.0 ],\n* [ 21.0, 12.0 ]\n* ]);\n* var res = new Results( 0.0719, 0.1, 3.24, 1, expected );\n* // returns \n*/\nfunction Results( pValue, alpha, statistic, df, expected ) {\n\tif ( !(this instanceof Results) ) {\n\t\treturn new Results( pValue, alpha, statistic, df, expected );\n\t}\n\tthis._pValue = pValue;\n\tthis._alpha = alpha;\n\tthis._statistic = statistic;\n\tthis._df = df;\n\tthis._expected = expected;\n\treturn this;\n}\n\n/**\n* Significance level.\n*\n* @private\n* @name alpha\n* @memberof Results.prototype\n* @type {number}\n*\n* @example\n* var array = require( '@stdlib/ndarray-array' );\n*\n* var expected = array([\n* [ 10.0, 15.0 ],\n* [ 21.0, 12.0 ]\n* ]);\n* var res = new Results( 0.0719, 0.1, 3.24, 1, expected );\n*\n* var alpha = res.alpha;\n* // returns 0.1\n*/\nsetReadOnlyAccessor( Results.prototype, 'alpha', function get() {\n\treturn this._alpha;\n});\n\n/**\n* Degrees of freedom.\n*\n* @private\n* @name df\n* @memberof Results.prototype\n* @type {number}\n*\n* @example\n* var array = require( '@stdlib/ndarray-array' );\n*\n* var expected = array([\n* [ 10.0, 15.0 ],\n* [ 21.0, 12.0 ]\n* ]);\n* var res = new Results( 0.0719, 0.1, 3.24, 1, expected );\n*\n* var df = res.df;\n* // returns 1\n*/\nsetReadOnlyAccessor( Results.prototype, 'df', function get() {\n\treturn this._df;\n});\n\n/**\n* Expected frequencies.\n*\n* @private\n* @name expected\n* @memberof Results.prototype\n* @type {ndarray}\n*\n* @example\n* var array = require( '@stdlib/ndarray-array' );\n*\n* var expected = array([\n* [ 10.0, 15.0 ],\n* [ 21.0, 12.0 ]\n* ]);\n* var res = new Results( 0.0719, 0.1, 3.24, 1, expected );\n*\n* var expected = res.expected;\n* // returns \n*/\nsetReadOnlyAccessor( Results.prototype, 'expected', function get() {\n\treturn this._expected;\n});\n\n/**\n* Test name.\n*\n* @private\n* @name method\n* @memberof Results.prototype\n* @type {string}\n*\n* @example\n* var array = require( '@stdlib/ndarray-array' );\n*\n* var expected = array([\n* [ 10.0, 15.0 ],\n* [ 21.0, 12.0 ]\n* ]);\n* var res = new Results( 0.0719, 0.1, 3.24, 1, expected );\n*\n* var method = res.method;\n* // returns 'Chi-square independence test'\n*/\nsetReadOnly( Results.prototype, 'method', 'Chi-square independence test' );\n\n/**\n* Test p-value.\n*\n* @private\n* @name pValue\n* @memberof Results.prototype\n* @type {number}\n*\n* @example\n* var array = require( '@stdlib/ndarray-array' );\n*\n* var expected = array([\n* [ 10.0, 15.0 ],\n* [ 21.0, 12.0 ]\n* ]);\n* var res = new Results( 0.0719, 0.1, 3.24, 1, expected );\n*\n* var pval = res.pValue;\n* // returns 0.0719\n*/\nsetReadOnlyAccessor( Results.prototype, 'pValue', function get() {\n\treturn this._pValue;\n});\n\n/**\n* Boolean indicating the test decision.\n*\n* @private\n* @name rejected\n* @memberof Results.prototype\n* @type {boolean}\n*\n* @example\n* var array = require( '@stdlib/ndarray-array' );\n*\n* var expected = array([\n* [ 10.0, 15.0 ],\n* [ 21.0, 12.0 ]\n* ]);\n* var res = new Results( 0.0719, 0.1, 3.24, 1, expected );\n*\n* var bool = res.rejected;\n* // returns true\n*/\nsetReadOnlyAccessor( Results.prototype, 'rejected', function get() {\n\treturn ( this._pValue <= this._alpha );\n});\n\n/**\n* Test statistic.\n*\n* @private\n* @name statistic\n* @memberof Results.prototype\n* @type {number}\n*\n* @example\n* var array = require( '@stdlib/ndarray-array' );\n*\n* var expected = array([\n* [ 10.0, 15.0 ],\n* [ 21.0, 12.0 ]\n* ]);\n* var res = new Results( 0.0719, 0.1, 3.24, 1, expected );\n*\n* var stat = res.statistic;\n* // returns 3.24\n*/\nsetReadOnlyAccessor( Results.prototype, 'statistic', function get() {\n\treturn this._statistic;\n});\n\n/**\n* Serializes a results object as a string.\n*\n* ## Notes\n*\n* - Example output:\n*\n* ```text\n*\n* Chi-square independence test\n*\n* Null hypothesis: the two variables are independent\n*\n* pValue: 0.0719\n* statistic: 3.24\n* degrees of freedom: 1\n*\n* Test Decision: Reject null in favor of alternative at 10% significance level\n*\n* ```\n*\n* @private\n* @name toString\n* @memberof Results.prototype\n* @type {Function}\n* @param {Options} [opts] - options object\n* @param {PositiveInteger} [opts.digits=4] - number of digits after the decimal point\n* @param {boolean} [opts.decision=true] - boolean indicating whether to show the test decision\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @returns {string} serialized results\n*\n* @example\n* var array = require( '@stdlib/ndarray-array' );\n*\n* var expected = array([\n* [ 10.0, 15.0 ],\n* [ 21.0, 12.0 ]\n* ]);\n* var res = new Results( 0.0719, 0.1, 3.24, 1, expected );\n*\n* var str = res.toString();\n* // returns \n*/\nsetReadOnly( Results.prototype, 'toString', function toString( opts ) {\n\tvar decision;\n\tvar dgts;\n\tvar out;\n\n\tdgts = 4;\n\tdecision = true;\n\tif ( arguments.length > 0 ) {\n\t\tif ( !isObject( opts ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Must provide an object. Value: `%s`.', opts ) );\n\t\t}\n\t\tif ( hasOwnProp( opts, 'digits' ) ) {\n\t\t\tif ( !isPositiveInteger( opts.digits ) ) {\n\t\t\t\tthrow new TypeError( format( 'invalid option. `%s` option must be a positive integer. Option: `%s`.', 'digits', opts.digits ) );\n\t\t\t}\n\t\t\tdgts = opts.digits;\n\t\t}\n\t\tif ( hasOwnProp( opts, 'decision' ) ) {\n\t\t\tif ( !isBoolean( opts.decision ) ) {\n\t\t\t\tthrow new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'decision', opts.decision ) );\n\t\t\t}\n\t\t\tdecision = opts.decision;\n\t\t}\n\t}\n\tout = [\n\t\tthis.method,\n\t\t'',\n\t\t'',\n\t\t'Null hypothesis: the two variables are independent',\n\t\t'',\n\t\t'',\n\t\t' pValue: ' + roundn( this._pValue, -dgts ),\n\t\t' statistic: ' + roundn( this._statistic, -dgts ),\n\t\t' degrees of freedom: ' + this._df,\n\t\t''\n\t];\n\tif ( decision ) {\n\t\tout.push( 'Test Decision: ' + ( ( this.rejected ) ? 'Reject' : 'Fail to reject' ) + ' null in favor of alternative at ' + (this._alpha*100.0) + '% significance level' );\n\t\tout.push( '' );\n\t}\n\treturn out.join( '\\n' );\n});\n\n/**\n* Serializes a results object as a JSON object.\n*\n* ## Notes\n*\n* - `JSON.stringify()` implicitly calls this method when stringifying a `Results` instance.\n*\n* @private\n* @name toJSON\n* @memberof Results.prototype\n* @type {Function}\n* @returns {Object} serialized object\n*\n* @example\n* var array = require( '@stdlib/ndarray-array' );\n*\n* var expected = array([\n* [ 10.0, 15.0 ],\n* [ 21.0, 12.0 ]\n* ]);\n* var res = new Results( 0.0719, 0.1, 3.24, 1, expected );\n*\n* var o = res.toJSON();\n* // returns { 'rejected': true, 'alpha': 0.1, 'pValue': 0.0719, 'df': 1, ... }\n*/\nsetReadOnly( Results.prototype, 'toJSON', function toJSON() {\n\tvar x = this._expected;\n\treturn {\n\t\t'rejected': this.rejected,\n\t\t'alpha': this._alpha,\n\t\t'pValue': this._pValue,\n\t\t'df': this._df,\n\t\t'statistic': this._statistic,\n\t\t'expected': ndarray2array( x.data, x.shape, x.strides, x.offset, x.order ),\n\t\t'method': this.method\n\t};\n});\n\n\n// EXPORTS //\n\nmodule.exports = Results;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2020 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' ).isPrimitive;\nvar isndarrayLike = require( '@stdlib/assert-is-ndarray-like' );\nvar isCollection = require( '@stdlib/assert-is-collection' );\nvar flatten2dBy = require( '@stdlib/array-base-flatten2d-by' ).assign;\nvar Float64Array = require( '@stdlib/array-float64' );\nvar arrayShape = require( '@stdlib/array-shape' );\nvar ndarray = require( '@stdlib/ndarray-ctor' );\nvar numel = require( '@stdlib/ndarray-base-numel' );\nvar vind2bind = require( '@stdlib/ndarray-base-vind2bind' );\nvar ind2sub = require( '@stdlib/ndarray-base-ind2sub' );\nvar dsumpw = require( '@stdlib/blas-ext-base-dsumpw' );\nvar dscal = require( '@stdlib/blas-base-dscal' );\nvar dapx = require( '@stdlib/blas-ext-base-dapx' );\nvar dmin = require( '@stdlib/stats-strided-dmin' );\nvar abs = require( '@stdlib/math-base-special-abs' );\nvar min = require( '@stdlib/math-base-special-min' );\nvar format = require( '@stdlib/string-format' );\nvar chisqCDF = require( '@stdlib/stats-base-dists-chisquare-cdf' );\nvar defaults = require( './defaults.js' );\nvar validate = require( './validate.js' );\nvar Results = require( './results.js' );\n\n\n// VARIABLES //\n\nvar MODE = 'throw';\n\n\n// FUNCTIONS //\n\n/**\n* Callback invoked upon flattening an array-like object.\n*\n* @private\n* @param {NonNegativeInteger} value - nested array element\n* @param {NonNegativeIntegerArray} indices - element indices\n* @param {Collection} arr - input array\n* @throws {TypeError} first argument must be a nonnegative integer\n* @returns {NonNegativeInteger} nested array element\n*/\nfunction flattenClbk( value, indices ) {\n\tif ( !isNonNegativeInteger( value ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must contain nonnegative integers. Indices: (%s). Value: `%s`.', indices.join( ', ' ), String( value ) ) );\n\t}\n\treturn value;\n}\n\n/**\n* Copies ndarray data to a new data buffer.\n*\n* @private\n* @param {ndarrayLike} x - input ndarray-like object\n* @param {NonNegativeIntegerArray} shape - array shape\n* @throws {TypeError} first argument must contain nonnegative integers\n* @returns {Float64Array} data buffer\n*/\nfunction copy2buffer( x, shape ) {\n\tvar out;\n\tvar buf;\n\tvar idx;\n\tvar ord;\n\tvar sx;\n\tvar ox;\n\tvar N;\n\tvar v;\n\tvar i;\n\n\t// Cache ndarray meta data:\n\tbuf = x.data;\n\tord = x.order;\n\tsx = x.strides;\n\tox = x.offset;\n\n\t// Compute the number of array elements:\n\tN = numel( shape );\n\n\t// Allocate a data buffer:\n\tout = new Float64Array( N );\n\n\t// Iterate over the ndarray and copy elements to a new buffer...\n\tfor ( i = 0; i < N; i++ ) {\n\t\tidx = vind2bind( shape, sx, ox, ord, i, MODE );\n\t\tv = buf[ idx ];\n\t\tif ( !isNonNegativeInteger( v ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. First argument must contain nonnegative integers. Indices: (%s). Value: `%s`.', ind2sub( shape, sx, ox, ord, i, MODE ), String( v ) ) );\n\t\t}\n\t\tout[ i ] = v;\n\t}\n\treturn out;\n}\n\n/**\n* Computes a sum along an axis.\n*\n* @private\n* @param {Float64Array} x - strided array\n* @param {NonNegativeInteger} nrows - number of rows\n* @param {NonNegativeInteger} ncols - number of columns\n* @param {NonNegativeInteger} axis - axis (0: sum across the rows; 1: sum down the columns)\n* @returns {Float64Array} results\n*\n* @example\n* var Float64Array = require( '@stdlib/array-float64' );\n*\n* // 2x3: [ [ 1.0, 2.0, 3.0 ], [ 4.0, 5.0, 6.0 ] ]\n* var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] );\n*\n* var rsums = axisSum( x, 2, 3, 0 );\n* // returns [ 6.0, 15.0 ]\n*\n* var csums = axisSum( x, 2, 3, 1 );\n* // returns [ 5.0, 7.0, 9.0 ]\n*/\nfunction axisSum( x, nrows, ncols, axis ) {\n\tvar offset;\n\tvar out;\n\tvar dx0;\n\tvar dx1;\n\tvar S0;\n\tvar S1;\n\tvar i1;\n\n\t// Resolve loop variables...\n\tif ( axis === 0 ) {\n\t\t// Sum across rows...\n\t\tS0 = ncols;\n\t\tS1 = nrows;\n\t\tdx0 = 1;\n\t\tdx1 = ncols;\n\t} else { // axis === 1\n\t\t// Sum down columns...\n\t\tS0 = nrows;\n\t\tS1 = ncols;\n\t\tdx0 = ncols;\n\t\tdx1 = 1;\n\t}\n\tout = new Float64Array( S1 );\n\toffset = 0;\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tout[ i1 ] = dsumpw.ndarray( S0, x, dx0, offset );\n\t\toffset += dx1;\n\t}\n\treturn out;\n}\n\n/**\n* Computes the outer product.\n*\n* @private\n* @param {Float64Array} x - first input array\n* @param {Float64Array} y - second input array\n* @returns {Float64Array} results\n*/\nfunction outer( x, y ) {\n\tvar out;\n\tvar io;\n\tvar M;\n\tvar N;\n\tvar v;\n\tvar i;\n\tvar j;\n\n\tM = x.length;\n\tN = y.length;\n\n\tout = new Float64Array( M*N );\n\tio = 0;\n\tfor ( i = 0; i < M; i++ ) {\n\t\tv = x[ i ];\n\t\tfor ( j = 0; j < N; j++ ) {\n\t\t\tout[ io ] = v * y[ j ];\n\t\t\tio += 1;\n\t\t}\n\t}\n\treturn out;\n}\n\n/**\n* Computes the element-wise absolute difference.\n*\n* @private\n* @param {Float64Array} x - first input array\n* @param {Float64Array} y - second input array\n* @returns {Float64Array} results\n*/\nfunction absdiff( x, y ) {\n\tvar out;\n\tvar i;\n\n\tout = new Float64Array( x.length );\n\tfor ( i = 0; i < x.length; i++ ) {\n\t\tout[ i ] = abs( x[ i ] - y[ i ] );\n\t}\n\treturn out;\n}\n\n/**\n* Computes the test statistic.\n*\n* ## Notes\n*\n* - Mutates the first input array.\n*\n* @private\n* @param {Float64Array} x - absolute differences\n* @param {Float64Array} m - expected frequencies\n* @returns {number} test statistic\n*/\nfunction testStatistic( x, m ) {\n\tvar i;\n\tfor ( i = 0; i < x.length; i++ ) {\n\t\tx[ i ] = ( x[i]*x[i] ) / m[ i ];\n\t}\n\treturn dsumpw( x.length, x, 1 );\n}\n\n\n// MAIN //\n\n/**\n* Performs a chi-square independence test.\n*\n* @param {(MatrixLike|Collection)} x - two-way table of observed frequencies\n* @param {Options} [options] - function options\n* @param {number} [options.alpha=0.05] - significance level\n* @param {boolean} [options.correct=true] - boolean indicating whether to use Yates' continuity correction when provided a 2x2 contingency table\n* @throws {TypeError} first argument must be an array of arrays or a two-dimensional ndarray-like object\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {RangeError} significance level must be a number on the interval `[0,1]`\n* @returns {Object} test results\n*\n* @example\n* var x = [ [ 20, 30 ], [ 30, 20 ] ];\n*\n* var out = chi2test( x );\n*\n* var o = out.toJSON();\n* // returns { 'rejected': false, 'alpha': 0.05, 'pValue': ~0.072, ... }\n*/\nfunction chi2test( x, options ) {\n\tvar correction;\n\tvar diffs;\n\tvar csums;\n\tvar rsums;\n\tvar means;\n\tvar opts;\n\tvar pval;\n\tvar stat;\n\tvar err;\n\tvar cnt;\n\tvar buf;\n\tvar dof;\n\tvar sh;\n\tvar M;\n\tvar N;\n\n\tif ( isndarrayLike( x ) ) {\n\t\tsh = x.shape;\n\t\tif ( sh.length !== 2 ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. First argument must be an array of arrays or a two-dimensional ndarray-like object. Number of input array dimensions: %u.', sh.length ) );\n\t\t}\n\t\tbuf = copy2buffer( x, sh );\n\t} else if ( isCollection( x ) ) {\n\t\tsh = arrayShape( x );\n\t\tif ( sh.length !== 2 ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. First argument must be an array of arrays or a two-dimensional ndarray-like object. Number of input array dimensions: %u.', sh.length ) );\n\t\t}\n\t\tbuf = new Float64Array( numel( sh ) );\n\t\tflatten2dBy( x, sh, false, buf, 1, 0, flattenClbk );\n\t} else {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be an array of arrays or a two-dimensional ndarray-like object. Value: `%s`.', x ) );\n\t}\n\t// NOTE: `buf` is now a single-segment contiguous `Float64Array` containing nonnegative integer values...\n\n\topts = defaults();\n\tif ( arguments.length > 1 ) {\n\t\terr = validate( opts, options );\n\t\tif ( err ) {\n\t\t\tthrow err;\n\t\t}\n\t}\n\t// Extract the array dimensions:\n\tM = sh[ 0 ]; // number of rows\n\tN = sh[ 1 ]; // number of columns\n\n\t// Compute the total number of observations:\n\tcnt = dsumpw( M*N, buf, 1 );\n\n\t// Compute marginal sums:\n\trsums = axisSum( buf, M, N, 0 ); // sum across the rows (length: M)\n\tcsums = axisSum( buf, M, N, 1 ); // sum down the columns (length: N)\n\n\t// Compute the outer product:\n\tmeans = outer( rsums, csums ); // MxN\n\n\t// Compute the expected frequencies:\n\tmeans = dscal( means.length, 1.0/cnt, means, 1 );\n\n\t// Compute the absolute differences between the observed and expected frequencies:\n\tdiffs = absdiff( buf, means );\n\n\t// Apply Yates' continuity correction...\n\tif ( M === 2 && N === 2 && opts.correct ) {\n\t\tcorrection = min( 0.5, dmin( diffs.length, diffs, 1 ) );\n\t\tdapx( diffs.length, -correction, diffs, 1 );\n\t}\n\n\t// Compute the test statistic:\n\tstat = testStatistic( diffs, means );\n\n\t// Compute the number of degrees of freedom:\n\tdof = ( M-1 ) * ( N-1 );\n\n\t// Compute the p-value:\n\tpval = 1 - chisqCDF( stat, dof );\n\n\t// Return test results:\n\tmeans = new ndarray( 'float64', means, [ M, N ], [ N, 1 ], 0, 'row-major', {\n\t\t'readonly': true\n\t});\n\treturn new Results( pval, opts.alpha, stat, dof, means );\n}\n\n\n// EXPORTS //\n\nmodule.exports = chi2test;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2020 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Chi-square independence test.\n*\n* @module @stdlib/stats-chi2test\n*\n* @example\n* var chi2test = require( '@stdlib/stats-chi2test' );\n*\n* var x = [ [ 20, 30 ], [ 30, 20 ] ];\n*\n* var out = chi2test( x );\n*\n* var o = out.toJSON();\n* // returns { 'rejected': false, 'alpha': 0.05, 'pValue': ~0.072, ... }\n*/\n\n// MODULES //\n\nvar chi2test = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = chi2test;\n"], + "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,GAAAC,EAAA,cA4BA,SAASC,GAAW,CACnB,MAAO,CACN,MAAS,IACT,QAAW,EACZ,CACD,CAKAD,EAAO,QAAUC,ICtCjB,IAAAC,EAAAC,EAAA,SAAAC,GAAAC,EAAA,cAsBA,IAAIC,EAAY,QAAS,2BAA4B,EAAE,YACnDC,EAAW,QAAS,0BAA2B,EAAE,YACjDC,EAAW,QAAS,gCAAiC,EACrDC,EAAQ,QAAS,uBAAwB,EACzCC,EAAa,QAAS,iCAAkC,EACxDC,EAAS,QAAS,uBAAwB,EA0B9C,SAASC,EA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,OAAM,IAAI,UAAWN,EAAQ,qHAAsHU,CAAE,CAAE,EAKxJ,GADAoC,EAAO5C,GAAS,EACX,UAAU,OAAS,IACvB+C,EAAM9C,GAAU2C,EAAMN,CAAQ,EACzBS,GACJ,MAAMA,EAIR,OAAAf,EAAIkB,EAAI,CAAE,EACVlC,EAAIkC,EAAI,CAAE,EAGVF,EAAMxD,EAAQwC,EAAEhB,EAAGL,EAAK,CAAE,EAG1B+B,EAAQvB,EAASR,EAAKqB,EAAGhB,EAAG,CAAE,EAC9ByB,EAAQtB,EAASR,EAAKqB,EAAGhB,EAAG,CAAE,EAG9B2B,EAAQd,GAAOa,EAAOD,CAAM,EAG5BE,EAAQlD,GAAOkD,EAAM,OAAQ,EAAIK,EAAKL,EAAO,CAAE,EAG/CH,EAAQN,GAASvB,EAAKgC,CAAM,EAGvBX,IAAM,GAAKhB,IAAM,GAAK4B,EAAK,UAC/BL,EAAa1C,GAAK,GAAKF,GAAM6C,EAAM,OAAQA,EAAO,CAAE,CAAE,EACtD9C,GAAM8C,EAAM,OAAQ,CAACD,EAAYC,EAAO,CAAE,GAI3CM,EAAOX,GAAeK,EAAOG,CAAM,EAGnCM,GAAQjB,EAAE,IAAQhB,EAAE,GAGpB6B,EAAO,EAAI9C,GAAU+C,EAAMG,CAAI,EAG/BN,EAAQ,IAAIvD,GAAS,UAAWuD,EAAO,CAAEX,EAAGhB,CAAE,EAAG,CAAEA,EAAG,CAAE,EAAG,EAAG,YAAa,CAC1E,SAAY,EACb,CAAC,EACM,IAAId,GAAS2C,EAAMD,EAAK,MAAOE,EAAMG,EAAKN,CAAM,CACxD,CAKA9D,EAAO,QAAUwD,KCvTjB,IAAIc,GAAW,IAKf,OAAO,QAAUA", "names": ["require_defaults", "__commonJSMin", "exports", "module", "defaults", "require_validate", "__commonJSMin", "exports", "module", "isBoolean", "isNumber", "isObject", "isnan", "hasOwnProp", "format", "validate", "opts", "options", "require_results", "__commonJSMin", "exports", "module", "isPositiveInteger", "isObject", "isBoolean", "hasOwnProp", "roundn", "setReadOnly", "setReadOnlyAccessor", "ndarray2array", "format", "Results", "pValue", "alpha", "statistic", "df", "expected", "opts", "decision", "dgts", "out", "x", "require_main", "__commonJSMin", "exports", "module", "isNonNegativeInteger", "isndarrayLike", "isCollection", "flatten2dBy", "Float64Array", "arrayShape", "ndarray", "numel", "vind2bind", "ind2sub", "dsumpw", "dscal", "dapx", "dmin", "abs", "min", "format", "chisqCDF", "defaults", "validate", "Results", "MODE", "flattenClbk", "value", "indices", "copy2buffer", "x", "shape", "out", "buf", "idx", "ord", "sx", "ox", "N", "v", "i", "axisSum", "nrows", "ncols", "axis", "offset", "dx0", "dx1", "S0", "S1", "i1", "outer", "y", "io", "M", "j", "absdiff", "testStatistic", "m", "chi2test", "options", "correction", "diffs", "csums", "rsums", "means", "opts", "pval", "stat", "err", "cnt", "dof", "sh", "chi2test"] } diff --git a/lib/main.js b/lib/main.js index e0be0a9..5b156ad 100644 --- a/lib/main.js +++ b/lib/main.js @@ -33,7 +33,7 @@ var ind2sub = require( '@stdlib/ndarray-base-ind2sub' ); var dsumpw = require( '@stdlib/blas-ext-base-dsumpw' ); var dscal = require( '@stdlib/blas-base-dscal' ); var dapx = require( '@stdlib/blas-ext-base-dapx' ); -var dmin = require( '@stdlib/stats-base-dmin' ); +var dmin = require( '@stdlib/stats-strided-dmin' ); var abs = require( '@stdlib/math-base-special-abs' ); var min = require( '@stdlib/math-base-special-min' ); var format = require( '@stdlib/string-format' ); diff --git a/package.json b/package.json index c9ea49d..d660f7a 100644 --- a/package.json +++ b/package.json @@ -61,7 +61,7 @@ "@stdlib/ndarray-base-vind2bind": "^0.2.2", "@stdlib/ndarray-ctor": "^0.2.2", "@stdlib/stats-base-dists-chisquare-cdf": "^0.2.2", - "@stdlib/stats-base-dmin": "^0.2.2", + "@stdlib/stats-strided-dmin": "github:stdlib-js/stats-strided-dmin#main", "@stdlib/string-format": "^0.2.2", "@stdlib/types": "^0.4.3", "@stdlib/utils-define-nonenumerable-read-only-accessor": "^0.2.3",