@stdlib/stats-wilcoxon 0.0.6 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CITATION.cff ADDED
@@ -0,0 +1,30 @@
1
+ cff-version: 1.2.0
2
+ title: stdlib
3
+ message: >-
4
+ If you use this software, please cite it using the
5
+ metadata from this file.
6
+
7
+ type: software
8
+
9
+ authors:
10
+ - name: The Stdlib Authors
11
+ url: https://github.com/stdlib-js/stdlib/graphs/contributors
12
+
13
+ repository-code: https://github.com/stdlib-js/stdlib
14
+ url: https://stdlib.io
15
+
16
+ abstract: |
17
+ Standard library for JavaScript and Node.js.
18
+
19
+ keywords:
20
+ - JavaScript
21
+ - Node.js
22
+ - TypeScript
23
+ - standard library
24
+ - scientific computing
25
+ - numerical computing
26
+ - statistical computing
27
+
28
+ license: Apache-2.0 AND BSL-1.0
29
+
30
+ date-released: 2016
package/LICENSE CHANGED
@@ -175,307 +175,3 @@
175
175
  of your accepting any such warranty or additional liability.
176
176
 
177
177
  END OF TERMS AND CONDITIONS
178
-
179
-
180
-
181
- Boost Software License - Version 1.0 - August 17th, 2003
182
-
183
- Permission is hereby granted, free of charge, to any person or organization
184
- obtaining a copy of the software and accompanying documentation covered by this
185
- license (the "Software") to use, reproduce, display, distribute, execute, and
186
- transmit the Software, and to prepare derivative works of the Software, and to
187
- permit third-parties to whom the Software is furnished to do so, all subject to
188
- the following:
189
-
190
- The copyright notices in the Software and this entire statement, including the
191
- above license grant, this restriction and the following disclaimer, must be
192
- included in all copies of the Software, in whole or in part, and all derivative
193
- works of the Software, unless such copies or derivative works are solely in the
194
- form of machine-executable object code generated by a source language processor.
195
-
196
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
197
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
198
- FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
199
- COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES
200
- OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
201
- OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
202
-
203
-
204
-
205
-
206
- DEPENDENCIES
207
-
208
- The library links against the following external libraries, which have their own
209
- licenses:
210
-
211
- * OpenBLAS <https://raw.githubusercontent.com/xianyi/OpenBLAS/
212
- def146efed8d5908ea04e22668feeab7099599a0/LICENSE>
213
-
214
- Copyright (c) 2011-2014, The OpenBLAS Project
215
- All rights reserved.
216
-
217
- Redistribution and use in source and binary forms, with or without
218
- modification, are permitted provided that the following conditions are
219
- met:
220
-
221
- 1. Redistributions of source code must retain the above copyright
222
- notice, this list of conditions and the following disclaimer.
223
-
224
- 2. Redistributions in binary form must reproduce the above copyright
225
- notice, this list of conditions and the following disclaimer in
226
- the documentation and/or other materials provided with the
227
- distribution.
228
-
229
- 3. Neither the name of the OpenBLAS project nor the names of
230
- its contributors may be used to endorse or promote products
231
- derived from this software without specific prior written
232
- permission.
233
-
234
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
235
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
236
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
237
- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
238
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
239
- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
240
- GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
241
- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
242
- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
243
- THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
244
-
245
-
246
- * Electron <https://raw.githubusercontent.com/electron/electron/
247
- c4cfb3e7110266b9d7ad80e1ae097c4db564501c/LICENSE>
248
-
249
- Copyright (c) 2013-2017 GitHub Inc.
250
-
251
- Permission is hereby granted, free of charge, to any person obtaining
252
- a copy of this software and associated documentation files (the
253
- "Software"), to deal in the Software without restriction, including
254
- without limitation the rights to use, copy, modify, merge, publish,
255
- distribute, sublicense, and/or sell copies of the Software, and to
256
- permit persons to whom the Software is furnished to do so, subject to
257
- the following conditions:
258
-
259
- The above copyright notice and this permission notice shall be
260
- included in all copies or substantial portions of the Software.
261
-
262
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
263
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
264
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
265
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
266
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
267
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
268
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
269
-
270
-
271
- * Boost <http://www.boost.org/LICENSE_1_0.txt>
272
-
273
- Boost Software License - Version 1.0 - August 17th, 2003
274
-
275
- Permission is hereby granted, free of charge, to any person or organization
276
- obtaining a copy of the software and accompanying documentation covered by
277
- this license (the "Software") to use, reproduce, display, distribute,
278
- execute, and transmit the Software, and to prepare derivative works of the
279
- Software, and to permit third-parties to whom the Software is furnished to
280
- do so, all subject to the following:
281
-
282
- The copyright notices in the Software and this entire statement, including
283
- the above license grant, this restriction and the following disclaimer,
284
- must be included in all copies of the Software, in whole or in part, and
285
- all derivative works of the Software, unless such copies or derivative
286
- works are solely in the form of machine-executable object code generated by
287
- a source language processor.
288
-
289
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
290
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
291
- FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
292
- SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
293
- FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
294
- ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
295
- DEALINGS IN THE SOFTWARE.
296
-
297
-
298
- * Cephes <http://www.netlib.org/cephes/readme>
299
-
300
- Copyright (c) 1984-2000 Stephen L. Moshier
301
-
302
- Some software in this archive may be from the book _Methods and Programs for
303
- Mathematical Functions_ (Prentice-Hall or Simon & Schuster International, 1989)
304
- or from the Cephes Mathematical Library, a commercial product. In either event,
305
- it is copyrighted by the author. What you see here may be used freely but it
306
- comes with no support or guarantee.
307
-
308
- Stephen L. Moshier
309
- moshier@na-net.ornl.gov
310
-
311
-
312
-
313
- ATTRIBUTION
314
-
315
- The library contains implementations from the following external libraries,
316
- which have their own licenses:
317
-
318
- * FreeBSD <https://svnweb.freebsd.org/>
319
-
320
- Copyright (C) 1993-2004 by Sun Microsystems, Inc. All rights reserved.
321
-
322
- Developed at SunPro, a Sun Microsystems, Inc. business.
323
- Permission to use, copy, modify, and distribute this
324
- software is freely granted, provided that this notice
325
- is preserved.
326
-
327
-
328
- * FDLIBM <http://www.netlib.org/fdlibm/>
329
-
330
- Copyright (C) 2004 by Sun Microsystems, Inc. All rights reserved.
331
-
332
- Developed at SunPro, a Sun Microsystems, Inc. business.
333
- Permission to use, copy, modify, and distribute this
334
- software is freely granted, provided that this notice
335
- is preserved.
336
-
337
-
338
- * Go <https://raw.githubusercontent.com/golang/go/master/LICENSE>
339
-
340
- Copyright (c) 2009 The Go Authors. All rights reserved.
341
-
342
- Redistribution and use in source and binary forms, with or without
343
- modification, are permitted provided that the following conditions are
344
- met:
345
-
346
- * Redistributions of source code must retain the above copyright
347
- notice, this list of conditions and the following disclaimer.
348
- * Redistributions in binary form must reproduce the above
349
- copyright notice, this list of conditions and the following disclaimer
350
- in the documentation and/or other materials provided with the
351
- distribution.
352
- * Neither the name of Google Inc. nor the names of its
353
- contributors may be used to endorse or promote products derived from
354
- this software without specific prior written permission.
355
-
356
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
357
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
358
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
359
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
360
- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
361
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
362
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
363
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
364
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
365
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
366
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
367
-
368
-
369
- * SLATEC Common Mathematical Library <http://www.netlib.no/netlib/slatec/>
370
-
371
- Public domain.
372
-
373
-
374
- * ESLint <https://raw.githubusercontent.com/eslint/eslint/master/LICENSE>
375
-
376
- Copyright JS Foundation and other contributors, https://js.foundation
377
-
378
- Permission is hereby granted, free of charge, to any person obtaining a copy
379
- of this software and associated documentation files (the "Software"), to deal
380
- in the Software without restriction, including without limitation the rights
381
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
382
- copies of the Software, and to permit persons to whom the Software is
383
- furnished to do so, subject to the following conditions:
384
-
385
- The above copyright notice and this permission notice shall be included in
386
- all copies or substantial portions of the Software.
387
-
388
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
389
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
390
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
391
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
392
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
393
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
394
- THE SOFTWARE.
395
-
396
-
397
- * StatsFuns.jl <https://raw.githubusercontent.com/JuliaStats/StatsFuns.jl/
398
- e66dd973650c375bc1739c820e5b96bb5bd000a8/LICENSE.md>
399
-
400
- Copyright (c) 2015: Dahua Lin.
401
-
402
- Permission is hereby granted, free of charge, to any person obtaining
403
- a copy of this software and associated documentation files (the
404
- "Software"), to deal in the Software without restriction, including
405
- without limitation the rights to use, copy, modify, merge, publish,
406
- distribute, sublicense, and/or sell copies of the Software, and to
407
- permit persons to whom the Software is furnished to do so, subject to
408
- the following conditions:
409
-
410
- The above copyright notice and this permission notice shall be
411
- included in all copies or substantial portions of the Software.
412
-
413
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
414
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
415
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
416
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
417
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
418
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
419
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
420
-
421
-
422
- * SpecialFunctions.jl <https://raw.githubusercontent.com/JuliaMath/
423
- SpecialFunctions.jl/02a173fbe24a61c4b392aec17a9764ac5727feb1/LICENSE>
424
-
425
- The MIT License (MIT)
426
-
427
- Copyright (c) 2017 Jeff Bezanson, Stefan Karpinski, Viral B. Shah, and others:
428
-
429
- https://github.com/JuliaMath/SpecialFunctions.jl/graphs/contributors
430
-
431
- Permission is hereby granted, free of charge, to any person obtaining a copy
432
- of this software and associated documentation files (the "Software"), to deal
433
- in the Software without restriction, including without limitation the rights
434
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
435
- copies of the Software, and to permit persons to whom the Software is
436
- furnished to do so, subject to the following conditions:
437
-
438
- The above copyright notice and this permission notice shall be included in all
439
- copies or substantial portions of the Software.
440
-
441
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
442
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
443
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
444
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
445
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
446
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
447
- SOFTWARE.
448
-
449
-
450
- * MT19937 <http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/MT2002/CODES/
451
- mt19937ar.c>
452
-
453
- Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura,
454
- All rights reserved.
455
-
456
- Redistribution and use in source and binary forms, with or without
457
- modification, are permitted provided that the following conditions
458
- are met:
459
-
460
- 1. Redistributions of source code must retain the above copyright
461
- notice, this list of conditions and the following disclaimer.
462
-
463
- 2. Redistributions in binary form must reproduce the above copyright
464
- notice, this list of conditions and the following disclaimer in the
465
- documentation and/or other materials provided with the distribution.
466
-
467
- 3. The names of its contributors may not be used to endorse or promote
468
- products derived from this software without specific prior written
469
- permission.
470
-
471
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
472
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
473
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
474
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
475
- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
476
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
477
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
478
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
479
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
480
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
481
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package/NOTICE CHANGED
@@ -1 +1 @@
1
- Copyright (c) 2016-2021 The Stdlib Authors.
1
+ Copyright (c) 2016-2023 The Stdlib Authors.
package/README.md CHANGED
@@ -18,9 +18,20 @@ limitations under the License.
18
18
 
19
19
  -->
20
20
 
21
+
22
+ <details>
23
+ <summary>
24
+ About stdlib...
25
+ </summary>
26
+ <p>We believe in a future in which the web is a preferred environment for numerical computation. To help realize this future, we've built stdlib. stdlib is a standard library, with an emphasis on numerical and scientific computation, written in JavaScript (and C) for execution in browsers and in Node.js.</p>
27
+ <p>The library is fully decomposable, being architected in such a way that you can swap out and mix and match APIs and functionality to cater to your exact preferences and use cases.</p>
28
+ <p>When you use stdlib, you can be absolutely certain that you are using the most thorough, rigorous, well-written, studied, documented, tested, measured, and high-quality code out there.</p>
29
+ <p>To join us in bringing numerical computing to the web, get started by checking us out on <a href="https://github.com/stdlib-js/stdlib">GitHub</a>, and please consider <a href="https://opencollective.com/stdlib">financially supporting stdlib</a>. We greatly appreciate your continued support!</p>
30
+ </details>
31
+
21
32
  # Wilcoxon Signed Rank Test
22
33
 
23
- [![NPM version][npm-image]][npm-url] [![Build Status][test-image]][test-url] [![Coverage Status][coverage-image]][coverage-url] [![dependencies][dependencies-image]][dependencies-url]
34
+ [![NPM version][npm-image]][npm-url] [![Build Status][test-image]][test-url] [![Coverage Status][coverage-image]][coverage-url] <!-- [![dependencies][dependencies-image]][dependencies-url] -->
24
35
 
25
36
  > One-sample and paired Wilcoxon signed rank test.
26
37
 
@@ -380,6 +391,23 @@ table = out.print();
380
391
 
381
392
  <!-- /.examples -->
382
393
 
394
+ <!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
395
+
396
+ <section class="related">
397
+
398
+ * * *
399
+
400
+ ## See Also
401
+
402
+ - <span class="package-name">[`@stdlib/stats-ttest`][@stdlib/stats/ttest]</span><span class="delimiter">: </span><span class="description">one-sample and paired Student's t-Test.</span>
403
+ - <span class="package-name">[`@stdlib/stats-ztest`][@stdlib/stats/ztest]</span><span class="delimiter">: </span><span class="description">one-sample and paired z-Test.</span>
404
+
405
+ </section>
406
+
407
+ <!-- /.related -->
408
+
409
+ <!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
410
+
383
411
 
384
412
  <section class="main-repo" >
385
413
 
@@ -404,7 +432,7 @@ See [LICENSE][stdlib-license].
404
432
 
405
433
  ## Copyright
406
434
 
407
- Copyright &copy; 2016-2021. The Stdlib [Authors][stdlib-authors].
435
+ Copyright &copy; 2016-2023. The Stdlib [Authors][stdlib-authors].
408
436
 
409
437
  </section>
410
438
 
@@ -417,28 +445,48 @@ Copyright &copy; 2016-2021. The Stdlib [Authors][stdlib-authors].
417
445
  [npm-image]: http://img.shields.io/npm/v/@stdlib/stats-wilcoxon.svg
418
446
  [npm-url]: https://npmjs.org/package/@stdlib/stats-wilcoxon
419
447
 
420
- [test-image]: https://github.com/stdlib-js/stats-wilcoxon/actions/workflows/test.yml/badge.svg
421
- [test-url]: https://github.com/stdlib-js/stats-wilcoxon/actions/workflows/test.yml
448
+ [test-image]: https://github.com/stdlib-js/stats-wilcoxon/actions/workflows/test.yml/badge.svg?branch=v0.1.0
449
+ [test-url]: https://github.com/stdlib-js/stats-wilcoxon/actions/workflows/test.yml?query=branch:v0.1.0
422
450
 
423
451
  [coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/stats-wilcoxon/main.svg
424
452
  [coverage-url]: https://codecov.io/github/stdlib-js/stats-wilcoxon?branch=main
425
453
 
454
+ <!--
455
+
426
456
  [dependencies-image]: https://img.shields.io/david/stdlib-js/stats-wilcoxon.svg
427
457
  [dependencies-url]: https://david-dm.org/stdlib-js/stats-wilcoxon/main
428
458
 
459
+ -->
460
+
429
461
  [chat-image]: https://img.shields.io/gitter/room/stdlib-js/stdlib.svg
430
- [chat-url]: https://gitter.im/stdlib-js/stdlib/
462
+ [chat-url]: https://app.gitter.im/#/room/#stdlib-js_stdlib:gitter.im
431
463
 
432
464
  [stdlib]: https://github.com/stdlib-js/stdlib
433
465
 
434
466
  [stdlib-authors]: https://github.com/stdlib-js/stdlib/graphs/contributors
435
467
 
468
+ [umd]: https://github.com/umdjs/umd
469
+ [es-module]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules
470
+
471
+ [deno-url]: https://github.com/stdlib-js/stats-wilcoxon/tree/deno
472
+ [umd-url]: https://github.com/stdlib-js/stats-wilcoxon/tree/umd
473
+ [esm-url]: https://github.com/stdlib-js/stats-wilcoxon/tree/esm
474
+ [branches-url]: https://github.com/stdlib-js/stats-wilcoxon/blob/main/branches.md
475
+
436
476
  [stdlib-license]: https://raw.githubusercontent.com/stdlib-js/stats-wilcoxon/main/LICENSE
437
477
 
438
478
  [mdn-array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array
439
479
 
440
480
  [mdn-typed-array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Typed_arrays
441
481
 
482
+ <!-- <related-links> -->
483
+
484
+ [@stdlib/stats/ttest]: https://www.npmjs.com/package/@stdlib/stats-ttest
485
+
486
+ [@stdlib/stats/ztest]: https://www.npmjs.com/package/@stdlib/stats-ztest
487
+
488
+ <!-- </related-links> -->
489
+
442
490
  </section>
443
491
 
444
492
  <!-- /.links -->
@@ -0,0 +1,3 @@
1
+ /// <reference path="../docs/types/index.d.ts" />
2
+ import wilcoxon from '../docs/types/index';
3
+ export = wilcoxon;
package/dist/index.js ADDED
@@ -0,0 +1,11 @@
1
+ "use strict";var V=function(e,i){return function(){return i||e((i={exports:{}}).exports,i),i.exports}};var H=V(function(Oe,W){
2
+ var N=require('@stdlib/assert-contains/dist'),_=require('@stdlib/assert-is-boolean/dist').isPrimitive,B=require('@stdlib/assert-is-number/dist').isPrimitive,te=require('@stdlib/assert-is-plain-object/dist'),C=require('@stdlib/assert-is-string/dist').isPrimitive,j=require('@stdlib/assert-is-nan/dist'),E=require('@stdlib/assert-has-own-property/dist'),d=require('@stdlib/error-tools-fmtprodmsg/dist'),I=["two-sided","less","greater"],U=["pratt","wilcox","zsplit"];function ne(e,i){if(!te(i))return new TypeError(d('1Lx2V',i));if(E(i,"alpha")){if(e.alpha=i.alpha,!B(e.alpha)||j(e.alpha))return new TypeError(d('1Lx8P',"alpha",e.alpha));if(e.alpha<0||e.alpha>1)return new RangeError(d('1Lx8V',"alpha",e.alpha));}if(E(i,"alternative")){if(e.alternative=i.alternative,!C(e.alternative))return new TypeError(d('1Lx2W',"alternative",e.alternative));if(!N(I,e.alternative))return new Error(d('1Lx4S',"alternative",I.join('", "'),e.alternative));}if(E(i,"correction")&&(e.correction=i.correction,!_(e.correction)||j(e.correction)))return new TypeError(d('1Lx2o',"correction",e.alpha));if(E(i,"exact")&&(e.exact=i.exact,!_(e.exact)||j(e.exact)))return new TypeError(d('1Lx2o',"exact",e.alpha));if(E(i,"mu")&&(e.mu=i.mu,!B(e.mu)||j(e.mu)))return new TypeError(d('1Lx8P',"mu",e.mu));if(E(i,"zeroMethod")){if(e.zeroMethod=i.zeroMethod,!C(e.zeroMethod))return new TypeError(d('1Lx2W',"zeroMethod",e.alternative));if(!N(U,e.zeroMethod))return new Error(d('1Lx4S',"zeroMethod",U.join('", "'),e.zeroMethod));}return null}W.exports=ne
3
+ });var G=V(function(Te,Z){
4
+ function oe(e,i){return e-i}function se(e){var i,o,a,u;for(e=e.slice(),e.sort(oe),i=e.length,a=1,u=0;a<i;a++)o=e[a],e[u]!==o&&(u+=1,e[u]=o);return e.length=u+1,e}Z.exports=se
5
+ });var X=V(function(ze,Q){
6
+ var le=require('@stdlib/assert-is-positive-integer/dist'),ue=require('@stdlib/assert-is-plain-object/dist'),ve=require('@stdlib/assert-is-boolean/dist').isPrimitive,J=require('@stdlib/assert-has-own-property/dist'),K=require('@stdlib/math-base-special-roundn/dist'),D=require('@stdlib/error-tools-fmtprodmsg/dist');function fe(e){var i,o,a;if(o=4,i=!0,arguments.length>0){if(!ue(e))throw new TypeError(D('1Lx3L',e));if(J(e,"digits")){if(!le(e.digits))throw new TypeError(D('1Lx3P',"digits",e.digits));o=e.digits}if(J(e,"decision")){if(!ve(e.decision))throw new TypeError(D('1Lx2o',"decision",e.decision));i=e.decision}}switch(a="",a+=this.method,a+="\n\n",a+="Alternative hypothesis: ",this.method==="Paired Wilcoxon signed rank test"?a+="Median of the difference `x - y` is ":a+="Median of `x` is ",this.alternative){case"less":a+="less than ";break;case"greater":a+="greater than ";break;case"two-sided":default:a+="not equal to ";break}return a+=this.nullValue,a+="\n\n",a+=" pValue: "+K(this.pValue,-o)+"\n",a+=" statistic: "+K(this.statistic,-o)+"\n",a+="\n",i&&(a+="Test Decision: ",this.rejected?a+="Reject null in favor of alternative at "+this.alpha*100+"% significance level":a+="Fail to reject null in favor of alternative at "+this.alpha*100+"% significance level",a+="\n"),a}Q.exports=fe
7
+ });var ae=V(function(Me,ie){
8
+ var Y=require('@stdlib/assert-is-number-array/dist').primitives,$=require('@stdlib/assert-is-typed-array-like/dist'),p=require('@stdlib/utils-define-read-only-property/dist'),ce=require('@stdlib/assert-is-plain-object/dist'),he=require('@stdlib/stats-ranks/dist'),de=require('@stdlib/stats-base-dists-normal-cdf/dist').factory,k=require('@stdlib/stats-base-dists-signrank-cdf/dist'),me=require('@stdlib/utils-tabulate/dist'),ge=require('@stdlib/math-base-special-signum/dist'),pe=require('@stdlib/math-base-special-sqrt/dist'),ee=require('@stdlib/math-base-special-abs/dist'),re=require('@stdlib/array-float64/dist'),L=require('@stdlib/error-tools-fmtprodmsg/dist'),we=H(),be=G(),qe=X(),S=de(0,1);function ye(){var e,i,o,a,u,O,T,l,P,z,m,v,f,w,A,t,F,c,R,q,M,y,n,r,g,x,b,s,h;if(s=arguments[0],!$(s)&&!Y(s))throw new TypeError(L('1Lx8R',s));if(t=s.length,arguments.length>1)if(ce(arguments[1]))o=arguments[1];else{if(h=arguments[1],!$(h)&&!Y(h))throw new TypeError(L('1LxA5',"y",h));if(t!==h.length)throw new Error(format('1Lx1E'));arguments.length>2&&(o=arguments[2])}if(v={},o&&(A=we(v,o),A))throw A;if(q=v.mu||0,v.correction===void 0?e=!0:e=v.correction,v.alpha===void 0?z=.05:z=v.alpha,t<2)throw new Error(L('1LxA2',s));if(w=v.alternative||"two-sided",i=v.zeroMethod||"wilcox",i==="wilcox"){if(n=[],h)for(r=0;r<t;r++)b=s[r]-h[r]-q,b!==0&&n.push(b);else for(r=0;r<t;r++)s[r]!==0&&n.push(s[r]-q);l=s.length-n.length}else if(n=new re(t),l=0,h)for(r=0;r<t;r++)n[r]=s[r]-h[r]-q,n[r]===0&&(l+=1);else for(r=0;r<t;r++)n[r]=s[r]-q,n[r]===0&&(l+=1);if(l===t)throw new Error(format('1Lx1J'));for(t=n.length,R=new re(t),r=0;r<t;r++)R[r]=ee(n[r]);for(g=he(R),T=0,P=0,r=0;r<t;r++)n[r]>0?T+=g[r]:n[r]===0&&(P+=g[r]);if(a=be(g).length!==g.length,i==="zsplit"&&(T+=P/2),x=T,M=t*(t+1)*.25,y=t*(t+1)*(2*t+1),i==="pratt"){for(F=[],r=0;r<t;r++)n[r]!==0&&F.push(g[r]);g=F,M-=l*(l+1)*.25,y-=l*(l+1)*(2*l+1)}for(u=me(g),O=0,r=0;r<u.length;r++)u[r][1]>1&&(b=u[r][1],O+=b*(b*b-1));if(O>0&&(y-=.5*O),y=pe(y/24),t>50&&!v.exact||l>0||a){if(n=0,e)switch(w){case"two-sided":n=.5*ge(x-M);break;case"less":n=-.5;break;default:n=.5;break}f=(x-M-n)/y,w==="two-sided"?m=2*(1-S(ee(f))):w==="greater"?m=1-S(f):m=S(f)}else f=x,w==="two-sided"?f>t*(t+1)/4?m=2*(1-k(f-1,t)):m=2*k(f,t):w==="greater"?m=1-k(f-1,t):m=k(f,t);return c={},p(c,"rejected",m<=z),p(c,"alpha",z),p(c,"pValue",m),p(c,"statistic",x),p(c,"nullValue",q),p(c,"alternative",w),p(c,"method",(h?"Paired":"One-Sample")+" Wilcoxon signed rank test"),p(c,"print",qe),c}ie.exports=ye
9
+ });var Ee=ae();module.exports=Ee;
10
+ /** @license Apache-2.0 */
11
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../lib/validate.js", "../lib/unique.js", "../lib/print.js", "../lib/main.js", "../lib/index.js"],
4
+ "sourcesContent": ["/**\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 contains = require( '@stdlib/assert-contains' );\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 isString = require( '@stdlib/assert-is-string' ).isPrimitive;\nvar isnan = require( '@stdlib/assert-is-nan' );\nvar hasOwnProp = require( '@stdlib/assert-has-own-property' );\nvar format = require( '@stdlib/string-format' );\n\n\n// VARIABLES //\n\nvar ALTERNATIVE_VALUES = [ 'two-sided', 'less', 'greater' ];\nvar ZERO_METHOD_VALUES = [ 'pratt', 'wilcox', 'zsplit' ];\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 {string} [options.alternative] - alternative hypothesis (`two-sided`, `less` or `greater`)\n* @param {boolean} [options.exact] - whether to force using the exact distribution instead of a normal approximation when there are more than fifty data points\n* @param {boolean} [options.correction] - continuity correction adjusting the Wilcoxon rank statistic by 0.5 towards the mean\n* @param {string} [options.zeroMethod] - method governing how zero-differences are handled (`pratt`, `wilcox` or `zsplit`)\n* @param {number} [options.mu] - mean under H0\n* @returns {(null|Error)} null or an error\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]. Option: `%f`.', 'alpha', opts.alpha ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'alternative' ) ) {\n\t\topts.alternative = options.alternative;\n\t\tif ( !isString( opts.alternative ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a string. Option: `%s`.', 'alternative', opts.alternative ) );\n\t\t}\n\t\tif ( !contains( ALTERNATIVE_VALUES, opts.alternative ) ) {\n\t\t\treturn new Error( format( 'invalid option. `%s` option must be one of the following: \"%s\". Option: `%s`.', 'alternative', ALTERNATIVE_VALUES.join( '\", \"' ), opts.alternative ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'correction' ) ) {\n\t\topts.correction = options.correction;\n\t\tif ( !isBoolean( opts.correction ) || isnan( opts.correction ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'correction', opts.alpha ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'exact' ) ) {\n\t\topts.exact = options.exact;\n\t\tif (\n\t\t\t!isBoolean( opts.exact ) ||\n\t\t\tisnan( opts.exact )\n\t\t) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'exact', opts.alpha ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'mu' ) ) {\n\t\topts.mu = options.mu;\n\t\tif ( !isNumber( opts.mu ) || isnan( opts.mu ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a number. Option: `%s`.', 'mu', opts.mu ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'zeroMethod' ) ) {\n\t\topts.zeroMethod = options.zeroMethod;\n\t\tif ( !isString( opts.zeroMethod ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a string. Option: `%s`.', 'zeroMethod', opts.alternative ) );\n\t\t}\n\t\tif ( !contains( ZERO_METHOD_VALUES, opts.zeroMethod ) ) {\n\t\t\treturn new Error( format( 'invalid option. `%s` option must be one of the following: \"%s\". Option: `%s`.', 'zeroMethod', ZERO_METHOD_VALUES.join( '\", \"' ), opts.zeroMethod ) );\n\t\t}\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nmodule.exports = validate;\n", "\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// FUNCTIONS //\n\n/**\n* Comparator function to sort values in ascending order.\n*\n* @private\n* @param {number} a - first value\n* @param {number} b - second value\n* @returns {number} difference between `a` and `b`\n*/\nfunction ascending( a, b ) {\n\treturn a - b;\n}\n\n\n// MAIN //\n\n/**\n* Removes duplicate values from a numeric array.\n*\n* @private\n* @param {NumberArray} arr - array to be deduped\n* @returns {NumberArray} deduped array\n*/\nfunction unique( arr ) {\n\tvar len;\n\tvar val;\n\tvar i;\n\tvar j;\n\n\tarr = arr.slice();\n\tarr.sort( ascending );\n\tlen = arr.length;\n\n\t// Loop through the array, only incrementing a pointer when successive values are different. When a succeeding value is different, move the pointer and set the next value. In the trivial case where all array elements are unique, we incur a slight penalty in resetting the element value for each unique value. In other cases, we simply move a unique value to a new position in the array. The end result is a sorted array with unique values.\n\tfor ( i = 1, j = 0; i < len; i++ ) {\n\t\tval = arr[ i ];\n\t\tif ( arr[ j ] !== val ) {\n\t\t\tj += 1;\n\t\t\tarr[ j ] = val;\n\t\t}\n\t}\n\t// Truncate the array:\n\tarr.length = j + 1;\n\treturn arr;\n}\n\n\n// EXPORTS //\n\nmodule.exports = unique;\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 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 format = require( '@stdlib/string-format' );\n\n\n// MAIN //\n\n/**\n* Pretty-print output of test.\n*\n* @param {Object} [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 print the test decision\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @returns {string} formatted output\n*/\nfunction print( opts ) { // eslint-disable-line stdlib/no-redeclare\n\t/* eslint-disable no-invalid-this */\n\tvar decision;\n\tvar dgts;\n\tvar str;\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. First argument must be 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\tstr = '';\n\tstr += this.method;\n\tstr += '\\n\\n';\n\tstr += 'Alternative hypothesis: ';\n\tif ( this.method === 'Paired Wilcoxon signed rank test' ) {\n\t\tstr += 'Median of the difference `x - y` is ';\n\t} else {\n\t\tstr += 'Median of `x` is ';\n\t}\n\tswitch ( this.alternative ) {\n\tcase 'less':\n\t\tstr += 'less than ';\n\t\tbreak;\n\tcase 'greater':\n\t\tstr += 'greater than ';\n\t\tbreak;\n\tcase 'two-sided':\n\tdefault:\n\t\tstr += 'not equal to ';\n\t\tbreak;\n\t}\n\tstr += this.nullValue;\n\tstr += '\\n\\n';\n\tstr += ' pValue: ' + roundn( this.pValue, -dgts ) + '\\n';\n\tstr += ' statistic: ' + roundn( this.statistic, -dgts ) + '\\n';\n\tstr += '\\n';\n\tif ( decision ) {\n\t\tstr += 'Test Decision: ';\n\t\tif ( this.rejected ) {\n\t\t\tstr += 'Reject null in favor of alternative at ' + (this.alpha*100) + '% significance level';\n\t\t} else {\n\t\t\tstr += 'Fail to reject null in favor of alternative at ' + (this.alpha*100) + '% significance level';\n\t\t}\n\t\tstr += '\\n';\n\t}\n\treturn str;\n}\n\n\n// EXPORTS //\n\nmodule.exports = print;\n", "/* eslint-disable max-statements, max-lines-per-function */\n\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 isNumberArray = require( '@stdlib/assert-is-number-array' ).primitives;\nvar isTypedArrayLike = require( '@stdlib/assert-is-typed-array-like' );\nvar setReadOnly = require( '@stdlib/utils-define-read-only-property' );\nvar isObject = require( '@stdlib/assert-is-plain-object' );\nvar ranks = require( '@stdlib/stats-ranks' );\nvar normalCDF = require( '@stdlib/stats-base-dists-normal-cdf' ).factory;\nvar signrankCDF = require( '@stdlib/stats-base-dists-signrank-cdf' );\nvar tabulate = require( '@stdlib/utils-tabulate' );\nvar signum = require( '@stdlib/math-base-special-signum' );\nvar sqrt = require( '@stdlib/math-base-special-sqrt' );\nvar abs = require( '@stdlib/math-base-special-abs' );\nvar Float64Array = require( '@stdlib/array-float64' );\nvar format = require( '@stdlib/string-format' );\nvar validate = require( './validate.js' );\nvar unique = require( './unique.js' );\nvar print = require( './print.js' ); // eslint-disable-line stdlib/no-redeclare\n\n\n// VARIABLES //\n\nvar pnorm = normalCDF( 0.0, 1.0 );\n\n\n// MAIN //\n\n/**\n* Computes a Wilcoxon signed rank test.\n*\n* @param {NumericArray} x - data array\n* @param {NumericArray} [y] - optional paired data array\n* @param {Options} [options] - function options\n* @param {number} [options.alpha=0.05] - significance level\n* @param {string} [options.alternative='two-sided'] - alternative hypothesis (`two-sided`, `less`, or `greater`)\n* @param {string} [options.zeroMethod='wilcox'] - method governing how zero-differences are handled (`pratt`, `wilcox`, or `zsplit`)\n* @param {boolean} [options.correction=true] - continuity correction adjusting the Wilcoxon rank statistic by 0.5 towards the mean\n* @param {boolean} [options.exact=false] - whether to force using the exact distribution instead of a normal approximation when there are more than fifty data points\n* @param {number} [options.mu=0] - location parameter under H0\n* @throws {TypeError} `x` must be a numeric array\n* @throws {TypeError} `y` must be a numeric array\n* @throws {TypeError} options must be an object\n* @throws {TypeError} `alpha` option has to be a number\n* @throws {RangeError} `alpha` option has to be a number in the interval `[0,1]`\n* @throws {TypeError} `alternative` option has to be a string\n* @throws {Error} `alternative` option must be `two-sided`, `less`, or `greater`\n* @throws {TypeError} `zeroMethod` option has to be a string\n* @throws {Error} `zeroMethod` option must be `pratt`, `wilcox`, or `zsplit`\n* @throws {TypeError} `correction` option has to be a boolean\n* @throws {TypeError} `exact` option has to be a boolean\n* @throws {TypeError} `mu` option has to be a number\n* @returns {Object} test result object\n*\n* @example\n* var x = [ 6, 8, 14, 16, 23, 24, 28, 29, 41, -48, 49, 56, 60, -67, 75 ];\n* var out = wilcoxon( x, {\n* 'mu': 2\n* });\n*\n* @example\n* var x = [ 6, 8, 14, 16, 23, 24, 28, 29, 41, -48, 49, 56, 60, -67, 75 ];\n* var out = wilcoxon( x, {\n* 'alternative': 'greater'\n* });\n*/\nfunction wilcoxon() {\n\tvar correction;\n\tvar zeroMethod;\n\tvar options;\n\tvar hasTies;\n\tvar counts;\n\tvar repsum;\n\tvar rplus;\n\tvar nzero;\n\tvar rzero;\n\tvar alpha;\n\tvar pval;\n\tvar opts;\n\tvar stat;\n\tvar alt;\n\tvar err;\n\tvar len;\n\tvar tmp;\n\tvar out;\n\tvar ad;\n\tvar mu;\n\tvar mn;\n\tvar se;\n\tvar d;\n\tvar i;\n\tvar r;\n\tvar T;\n\tvar v;\n\tvar x;\n\tvar y;\n\n\tx = arguments[ 0 ];\n\tif ( !isTypedArrayLike( x ) && !isNumberArray( x ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a numeric array. Value: `%s`.', x ) );\n\t}\n\tlen = x.length;\n\tif ( arguments.length > 1 ) {\n\t\tif ( isObject( arguments[ 1 ] ) ) {\n\t\t\toptions = arguments[ 1 ];\n\t\t} else {\n\t\t\ty = arguments[ 1 ];\n\t\t\tif ( !isTypedArrayLike( y ) && !isNumberArray( y ) ) {\n\t\t\t\tthrow new TypeError( format( 'invalid argument. `%s` argument must be a numeric array. Value: `%s`.', 'y', y ) );\n\t\t\t}\n\t\t\tif ( len !== y.length ) {\n\t\t\t\tthrow new Error( 'invalid arguments. First and second arguments must have the same length.' );\n\t\t\t}\n\t\t\tif ( arguments.length > 2 ) {\n\t\t\t\toptions = arguments[ 2 ];\n\t\t\t}\n\t\t}\n\t}\n\topts = {};\n\tif ( options ) {\n\t\terr = validate( opts, options );\n\t\tif ( err ) {\n\t\t\tthrow err;\n\t\t}\n\t}\n\tmu = opts.mu || 0.0;\n\tif ( opts.correction === void 0 ) {\n\t\tcorrection = true;\n\t} else {\n\t\tcorrection = opts.correction;\n\t}\n\tif ( opts.alpha === void 0 ) {\n\t\talpha = 0.05;\n\t} else {\n\t\talpha = opts.alpha;\n\t}\n\tif ( len < 2 ) {\n\t\tthrow new Error( format( 'invalid argument. First argument must contain at least two elements. Value: `%s`.', x ) );\n\t}\n\talt = opts.alternative || 'two-sided';\n\tzeroMethod = opts.zeroMethod || 'wilcox';\n\n\tif ( zeroMethod === 'wilcox' ) {\n\t\t// Only keep all non-zero differences:\n\t\td = [];\n\t\tif ( y ) {\n\t\t\tfor ( i = 0; i < len; i++ ) {\n\t\t\t\tv = ( x[ i ] - y[ i ] ) - mu;\n\t\t\t\tif ( v !== 0 ) {\n\t\t\t\t\td.push( v );\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tfor ( i = 0; i < len; i++ ) {\n\t\t\t\tif ( x[ i ] !== 0 ) {\n\t\t\t\t\td.push( x[ i ] - mu );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tnzero = x.length - d.length;\n\t} else {\n\t\td = new Float64Array( len );\n\t\tnzero = 0;\n\t\tif ( y ) {\n\t\t\tfor ( i = 0; i < len; i++ ) {\n\t\t\t\td[ i ] = ( x[ i ] - y[ i ] ) - mu;\n\t\t\t\tif ( d[ i ] === 0 ) {\n\t\t\t\t\tnzero += 1;\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tfor ( i = 0; i < len; i++ ) {\n\t\t\t\td[ i ] = x[ i ] - mu;\n\t\t\t\tif ( d[ i ] === 0 ) {\n\t\t\t\t\tnzero += 1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tif ( nzero === len ) {\n\t\tthrow new Error( '`x` or `x - y` cannot be zero for all elements.' );\n\t}\n\t// Update length after potentially discarding zero values:\n\tlen = d.length;\n\tad = new Float64Array( len );\n\tfor ( i = 0; i < len; i++ ) {\n\t\tad[ i ] = abs( d[ i ] );\n\t}\n\tr = ranks( ad );\n\trplus = 0;\n\trzero = 0;\n\tfor ( i = 0; i < len; i++ ) {\n\t\tif ( d[ i ] > 0 ) {\n\t\t\trplus += r[ i ];\n\t\t}\n\t\telse if ( d[ i ] === 0 ) {\n\t\t\trzero += r[ i ];\n\t\t}\n\t}\n\thasTies = unique( r ).length !== r.length;\n\tif ( zeroMethod === 'zsplit' ) {\n\t\trplus += rzero / 2.0;\n\t}\n\tT = rplus;\n\tmn = len * ( len + 1.0 ) * 0.25;\n\tse = len * ( len + 1.0 ) * ( ( 2.0 * len ) + 1.0 );\n\n\tif ( zeroMethod === 'pratt' ) {\n\t\ttmp = [];\n\t\tfor ( i = 0; i < len; i++ ) {\n\t\t\tif ( d[ i ] !== 0 ) {\n\t\t\t\ttmp.push( r[ i ] );\n\t\t\t}\n\t\t}\n\t\tr = tmp;\n\t\tmn -= nzero * ( nzero + 1.0 ) * 0.25;\n\t\tse -= nzero * ( nzero + 1.0 ) * ( ( 2.0 * nzero ) + 1.0 );\n\t}\n\tcounts = tabulate( r );\n\trepsum = 0;\n\tfor ( i = 0; i < counts.length; i++ ) {\n\t\tif ( counts[ i ][ 1 ] > 1 ) {\n\t\t\tv = counts[ i ][ 1 ];\n\t\t\trepsum += v * ( (v*v) - 1 );\n\t\t}\n\t}\n\tif ( repsum > 0 ) {\n\t\t// Correction for repeated values:\n\t\tse -= 0.5 * repsum;\n\t}\n\tse = sqrt( se / 24.0 );\n\n\tif (\n\t\t( len > 50 && !opts.exact ) ||\n\t\tnzero > 0 ||\n\t\thasTies\n\t) {\n\t\td = 0.0;\n\t\tif ( correction ) {\n\t\t\tswitch ( alt ) {\n\t\t\tcase 'two-sided':\n\t\t\t\td = 0.5 * signum( T - mn );\n\t\t\t\tbreak;\n\t\t\tcase 'less':\n\t\t\t\td = -0.5;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\td = 0.5;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t// Compute test statistic and p-value using normal approximation:\n\t\tstat = ( T - mn - d ) / se;\n\t\tif ( alt === 'two-sided' ) {\n\t\t\tpval = 2.0 * ( 1.0 - pnorm( abs( stat ) ) );\n\t\t} else if ( alt === 'greater' ) {\n\t\t\tpval = 1.0 - pnorm( stat );\n\t\t} else {\n\t\t\tpval = pnorm( stat );\n\t\t}\n\t} else {\n\t\t// Compute test statistic and p-value using exact critical values:\n\t\tstat = T;\n\t\tif ( alt === 'two-sided' ) {\n\t\t\tif ( stat > ( len * ( len+1 ) / 4 ) ) {\n\t\t\t\tpval = 2.0 * ( 1 - signrankCDF( stat - 1, len ) );\n\t\t\t} else {\n\t\t\t\tpval = 2.0 * signrankCDF( stat, len );\n\t\t\t}\n\t\t} else if ( alt === 'greater' ) {\n\t\t\tpval = 1.0 - signrankCDF( stat - 1, len );\n\t\t} else {\n\t\t\tpval = signrankCDF( stat, len );\n\t\t}\n\t}\n\tout = {};\n\tsetReadOnly( out, 'rejected', pval <= alpha );\n\tsetReadOnly( out, 'alpha', alpha );\n\tsetReadOnly( out, 'pValue', pval );\n\tsetReadOnly( out, 'statistic', T );\n\tsetReadOnly( out, 'nullValue', mu );\n\tsetReadOnly( out, 'alternative', alt );\n\tsetReadOnly( out, 'method', ( ( y ) ? 'Paired' : 'One-Sample' ) + ' Wilcoxon signed rank test' );\n\tsetReadOnly( out, 'print', print );\n\treturn out;\n}\n\n\n// EXPORTS //\n\nmodule.exports = wilcoxon;\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* Compute a Wilcoxon signed-rank test.\n*\n* @module @stdlib/stats-wilcoxon\n*\n* @example\n* var normal = require( '@stdlib/random-base-normal' ).factory;\n* var wilcoxon = require( '@stdlib/stats-wilcoxon' );\n*\n* var rnorm;\n* var out;\n* var i;\n* var x;\n* var y;\n*\n* rnorm = normal( 1.0, 2.0, {\n* 'seed': 786\n* });\n*\n* // One-sample Wilcoxon signed rank test:\n* x = new Array( 100 );\n* for ( i = 0; i < x.length; i++ ) {\n* x[ i ] = rnorm();\n* }\n* out = wilcoxon( x );\n*\n* // Paired Wilcoxon signed rank test:\n* x = new Array( 100 );\n* y = new Array( 100 );\n* for ( i = 0; i < x.length; i++ ) {\n* x[ i ] = rnorm();\n* y[ i ] = rnorm();\n* }\n* out = wilcoxon( x, y );\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"],
5
+ "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,GAAAC,EAAA,cAsBA,IAAIC,EAAW,QAAS,yBAA0B,EAC9CC,EAAY,QAAS,2BAA4B,EAAE,YACnDC,EAAW,QAAS,0BAA2B,EAAE,YACjDC,GAAW,QAAS,gCAAiC,EACrDC,EAAW,QAAS,0BAA2B,EAAE,YACjDC,EAAQ,QAAS,uBAAw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EAAOc,CAAK,EAEzBF,EAAOZ,EAAOc,CAAK,CAErB,MAECA,EAAOa,EACFZ,IAAQ,YACPD,EAASG,GAAQA,EAAI,GAAM,EAC/BL,EAAO,GAAQ,EAAItB,EAAawB,EAAO,EAAGG,CAAI,GAE9CL,EAAO,EAAMtB,EAAawB,EAAMG,CAAI,EAE1BF,IAAQ,UACnBH,EAAO,EAAMtB,EAAawB,EAAO,EAAGG,CAAI,EAExCL,EAAOtB,EAAawB,EAAMG,CAAI,EAGhC,OAAAE,EAAM,CAAC,EACPjC,EAAaiC,EAAK,WAAYP,GAAQD,CAAM,EAC5CzB,EAAaiC,EAAK,QAASR,CAAM,EACjCzB,EAAaiC,EAAK,SAAUP,CAAK,EACjC1B,EAAaiC,EAAK,YAAaQ,CAAE,EACjCzC,EAAaiC,EAAK,YAAaE,CAAG,EAClCnC,EAAaiC,EAAK,cAAeJ,CAAI,EACrC7B,EAAaiC,EAAK,UAAcW,EAAM,SAAW,cAAiB,4BAA6B,EAC/F5C,EAAaiC,EAAK,QAASpB,EAAM,EAC1BoB,CACR,CAKApC,GAAO,QAAUkB,KC7PjB,IAAI8B,GAAO,KAKX,OAAO,QAAUA",
6
+ "names": ["require_validate", "__commonJSMin", "exports", "module", "contains", "isBoolean", "isNumber", "isObject", "isString", "isnan", "hasOwnProp", "format", "ALTERNATIVE_VALUES", "ZERO_METHOD_VALUES", "validate", "opts", "options", "require_unique", "__commonJSMin", "exports", "module", "ascending", "a", "b", "unique", "arr", "len", "val", "i", "j", "require_print", "__commonJSMin", "exports", "module", "isPositiveInteger", "isObject", "isBoolean", "hasOwnProp", "roundn", "format", "print", "opts", "decision", "dgts", "str", "require_main", "__commonJSMin", "exports", "module", "isNumberArray", "isTypedArrayLike", "setReadOnly", "isObject", "ranks", "normalCDF", "signrankCDF", "tabulate", "signum", "sqrt", "abs", "Float64Array", "format", "validate", "unique", "print", "pnorm", "wilcoxon", "correction", "zeroMethod", "options", "hasTies", "counts", "repsum", "rplus", "nzero", "rzero", "alpha", "pval", "opts", "stat", "alt", "err", "len", "tmp", "out", "ad", "mu", "mn", "se", "d", "i", "r", "T", "v", "x", "y", "main"]
7
+ }
@@ -16,7 +16,7 @@
16
16
  * limitations under the License.
17
17
  */
18
18
 
19
- // TypeScript Version: 2.0
19
+ // TypeScript Version: 4.1
20
20
 
21
21
  /// <reference types="@stdlib/types"/>
22
22
 
package/lib/index.js CHANGED
@@ -56,9 +56,9 @@
56
56
 
57
57
  // MODULES //
58
58
 
59
- var wilcoxon = require( './main.js' );
59
+ var main = require( './main.js' );
60
60
 
61
61
 
62
62
  // EXPORTS //
63
63
 
64
- module.exports = wilcoxon;
64
+ module.exports = main;
package/lib/main.js CHANGED
@@ -34,6 +34,7 @@ var signum = require( '@stdlib/math-base-special-signum' );
34
34
  var sqrt = require( '@stdlib/math-base-special-sqrt' );
35
35
  var abs = require( '@stdlib/math-base-special-abs' );
36
36
  var Float64Array = require( '@stdlib/array-float64' );
37
+ var format = require( '@stdlib/string-format' );
37
38
  var validate = require( './validate.js' );
38
39
  var unique = require( './unique.js' );
39
40
  var print = require( './print.js' ); // eslint-disable-line stdlib/no-redeclare
@@ -60,16 +61,16 @@ var pnorm = normalCDF( 0.0, 1.0 );
60
61
  * @param {number} [options.mu=0] - location parameter under H0
61
62
  * @throws {TypeError} `x` must be a numeric array
62
63
  * @throws {TypeError} `y` must be a numeric array
63
- * @throws {TypeError} options has to be simple object
64
- * @throws {TypeError} `alpha` option has to be a number primitive
64
+ * @throws {TypeError} options must be an object
65
+ * @throws {TypeError} `alpha` option has to be a number
65
66
  * @throws {RangeError} `alpha` option has to be a number in the interval `[0,1]`
66
- * @throws {TypeError} `alternative` option has to be a string primitive
67
+ * @throws {TypeError} `alternative` option has to be a string
67
68
  * @throws {Error} `alternative` option must be `two-sided`, `less`, or `greater`
68
- * @throws {TypeError} `zeroMethod` option has to be a string primitive
69
+ * @throws {TypeError} `zeroMethod` option has to be a string
69
70
  * @throws {Error} `zeroMethod` option must be `pratt`, `wilcox`, or `zsplit`
70
- * @throws {TypeError} `correction` option has to be a boolean primitive
71
- * @throws {TypeError} `exact` option has to be a boolean primitive
72
- * @throws {TypeError} `mu` option has to be a number primitive
71
+ * @throws {TypeError} `correction` option has to be a boolean
72
+ * @throws {TypeError} `exact` option has to be a boolean
73
+ * @throws {TypeError} `mu` option has to be a number
73
74
  * @returns {Object} test result object
74
75
  *
75
76
  * @example
@@ -117,7 +118,7 @@ function wilcoxon() {
117
118
 
118
119
  x = arguments[ 0 ];
119
120
  if ( !isTypedArrayLike( x ) && !isNumberArray( x ) ) {
120
- throw new TypeError( 'invalid argument. First argument must be a numeric array. Value: `' + x + '`.' );
121
+ throw new TypeError( format( 'invalid argument. First argument must be a numeric array. Value: `%s`.', x ) );
121
122
  }
122
123
  len = x.length;
123
124
  if ( arguments.length > 1 ) {
@@ -126,10 +127,10 @@ function wilcoxon() {
126
127
  } else {
127
128
  y = arguments[ 1 ];
128
129
  if ( !isTypedArrayLike( y ) && !isNumberArray( y ) ) {
129
- throw new TypeError( 'invalid argument. `y` argument must be a numeric array. Value: `' + y + '`.' );
130
+ throw new TypeError( format( 'invalid argument. `%s` argument must be a numeric array. Value: `%s`.', 'y', y ) );
130
131
  }
131
132
  if ( len !== y.length ) {
132
- throw new Error( 'invalid arguments. The first and second arguments must have the same length.' );
133
+ throw new Error( 'invalid arguments. First and second arguments must have the same length.' );
133
134
  }
134
135
  if ( arguments.length > 2 ) {
135
136
  options = arguments[ 2 ];
@@ -155,7 +156,7 @@ function wilcoxon() {
155
156
  alpha = opts.alpha;
156
157
  }
157
158
  if ( len < 2 ) {
158
- throw new Error( 'invalid argument. First argument must contain at least two elements. Value: `' + x + '`' );
159
+ throw new Error( format( 'invalid argument. First argument must contain at least two elements. Value: `%s`.', x ) );
159
160
  }
160
161
  alt = opts.alternative || 'two-sided';
161
162
  zeroMethod = opts.zeroMethod || 'wilcox';
package/lib/print.js CHANGED
@@ -25,6 +25,7 @@ var isObject = require( '@stdlib/assert-is-plain-object' );
25
25
  var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive;
26
26
  var hasOwnProp = require( '@stdlib/assert-has-own-property' );
27
27
  var roundn = require( '@stdlib/math-base-special-roundn' );
28
+ var format = require( '@stdlib/string-format' );
28
29
 
29
30
 
30
31
  // MAIN //
@@ -49,17 +50,17 @@ function print( opts ) { // eslint-disable-line stdlib/no-redeclare
49
50
  decision = true;
50
51
  if ( arguments.length > 0 ) {
51
52
  if ( !isObject( opts ) ) {
52
- throw new TypeError( 'invalid argument. First argument must be an options object. Value: `' + opts + '`.' );
53
+ throw new TypeError( format( 'invalid argument. First argument must be an object. Value: `%s`.', opts ) );
53
54
  }
54
55
  if ( hasOwnProp( opts, 'digits' ) ) {
55
56
  if ( !isPositiveInteger( opts.digits ) ) {
56
- throw new TypeError( 'invalid option. `digits` option must be a positive integer. Option: `' + opts.digits + '`.' );
57
+ throw new TypeError( format( 'invalid option. `%s` option must be a positive integer. Option: `%s`.', 'digits', opts.digits ) );
57
58
  }
58
59
  dgts = opts.digits;
59
60
  }
60
61
  if ( hasOwnProp( opts, 'decision' ) ) {
61
62
  if ( !isBoolean( opts.decision ) ) {
62
- throw new TypeError( 'invalid option. `decision` option must be a boolean primitive. Option: `' + opts.decision + '`.' );
63
+ throw new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'decision', opts.decision ) );
63
64
  }
64
65
  decision = opts.decision;
65
66
  }
@@ -74,16 +75,16 @@ function print( opts ) { // eslint-disable-line stdlib/no-redeclare
74
75
  str += 'Median of `x` is ';
75
76
  }
76
77
  switch ( this.alternative ) {
77
- case 'two-sided':
78
- default:
79
- str += 'not equal to ';
80
- break;
81
78
  case 'less':
82
79
  str += 'less than ';
83
80
  break;
84
81
  case 'greater':
85
82
  str += 'greater than ';
86
83
  break;
84
+ case 'two-sided':
85
+ default:
86
+ str += 'not equal to ';
87
+ break;
87
88
  }
88
89
  str += this.nullValue;
89
90
  str += '\n\n';
package/lib/validate.js CHANGED
@@ -27,6 +27,7 @@ var isObject = require( '@stdlib/assert-is-plain-object' );
27
27
  var isString = require( '@stdlib/assert-is-string' ).isPrimitive;
28
28
  var isnan = require( '@stdlib/assert-is-nan' );
29
29
  var hasOwnProp = require( '@stdlib/assert-has-own-property' );
30
+ var format = require( '@stdlib/string-format' );
30
31
 
31
32
 
32
33
  // VARIABLES //
@@ -53,30 +54,30 @@ var ZERO_METHOD_VALUES = [ 'pratt', 'wilcox', 'zsplit' ];
53
54
  */
54
55
  function validate( opts, options ) {
55
56
  if ( !isObject( options ) ) {
56
- return new TypeError( 'invalid argument. Options argument must be an object. Value: `' + options + '`.' );
57
+ return new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );
57
58
  }
58
59
  if ( hasOwnProp( options, 'alpha' ) ) {
59
60
  opts.alpha = options.alpha;
60
61
  if ( !isNumber( opts.alpha ) || isnan( opts.alpha ) ) {
61
- return new TypeError( 'invalid option. `alpha` option must be a number primitive. Option: `' + opts.alpha + '`.' );
62
+ return new TypeError( format( 'invalid option. `%s` option must be a number. Option: `%s`.', 'alpha', opts.alpha ) );
62
63
  }
63
64
  if ( opts.alpha < 0.0 || opts.alpha > 1.0 ) {
64
- return new RangeError( 'invalid argument. Option `alpha` must be a number in the range 0 to 1. Value: `' + opts.alpha + '`.' );
65
+ return new RangeError( format( 'invalid option. `%s` option must be a number on the interval: [0, 1]. Option: `%f`.', 'alpha', opts.alpha ) );
65
66
  }
66
67
  }
67
68
  if ( hasOwnProp( options, 'alternative' ) ) {
68
69
  opts.alternative = options.alternative;
69
70
  if ( !isString( opts.alternative ) ) {
70
- return new TypeError( 'invalid option. `alternative` option must be a string primitive. Option: `' + opts.alternative + '`.' );
71
+ return new TypeError( format( 'invalid option. `%s` option must be a string. Option: `%s`.', 'alternative', opts.alternative ) );
71
72
  }
72
73
  if ( !contains( ALTERNATIVE_VALUES, opts.alternative ) ) {
73
- return new Error( 'invalid option. `alternative` option must be one of '+ALTERNATIVE_VALUES.join( ', ' )+'. Option: `' + opts.alternative + '`.' );
74
+ return new Error( format( 'invalid option. `%s` option must be one of the following: "%s". Option: `%s`.', 'alternative', ALTERNATIVE_VALUES.join( '", "' ), opts.alternative ) );
74
75
  }
75
76
  }
76
77
  if ( hasOwnProp( options, 'correction' ) ) {
77
78
  opts.correction = options.correction;
78
79
  if ( !isBoolean( opts.correction ) || isnan( opts.correction ) ) {
79
- return new TypeError( 'invalid option. `correction` option must be a boolean primitive. Option: `' + opts.alpha + '`.' );
80
+ return new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'correction', opts.alpha ) );
80
81
  }
81
82
  }
82
83
  if ( hasOwnProp( options, 'exact' ) ) {
@@ -85,22 +86,22 @@ function validate( opts, options ) {
85
86
  !isBoolean( opts.exact ) ||
86
87
  isnan( opts.exact )
87
88
  ) {
88
- return new TypeError( 'invalid option. `exact` option must be a boolean primitive. Option: `' + opts.alpha + '`.' );
89
+ return new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'exact', opts.alpha ) );
89
90
  }
90
91
  }
91
92
  if ( hasOwnProp( options, 'mu' ) ) {
92
93
  opts.mu = options.mu;
93
94
  if ( !isNumber( opts.mu ) || isnan( opts.mu ) ) {
94
- return new TypeError( 'invalid option. `mu` option must be a number primitive. Option: `' + opts.mu + '`.' );
95
+ return new TypeError( format( 'invalid option. `%s` option must be a number. Option: `%s`.', 'mu', opts.mu ) );
95
96
  }
96
97
  }
97
98
  if ( hasOwnProp( options, 'zeroMethod' ) ) {
98
99
  opts.zeroMethod = options.zeroMethod;
99
100
  if ( !isString( opts.zeroMethod ) ) {
100
- return new TypeError( 'invalid option. `zeroMethod` option must be a string primitive. Option: `' + opts.alternative + '`.' );
101
+ return new TypeError( format( 'invalid option. `%s` option must be a string. Option: `%s`.', 'zeroMethod', opts.alternative ) );
101
102
  }
102
103
  if ( !contains( ZERO_METHOD_VALUES, opts.zeroMethod ) ) {
103
- return new Error( 'invalid option. `zeroMethod` option must be one of '+ZERO_METHOD_VALUES.join( ', ' )+'. Option: `' + opts.zeroMethod + '`.' );
104
+ return new Error( format( 'invalid option. `%s` option must be one of the following: "%s". Option: `%s`.', 'zeroMethod', ZERO_METHOD_VALUES.join( '", "' ), opts.zeroMethod ) );
104
105
  }
105
106
  }
106
107
  return null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stdlib/stats-wilcoxon",
3
- "version": "0.0.6",
3
+ "version": "0.1.0",
4
4
  "description": "Wilcoxon signed rank test.",
5
5
  "license": "Apache-2.0",
6
6
  "author": {
@@ -37,37 +37,39 @@
37
37
  "url": "https://github.com/stdlib-js/stdlib/issues"
38
38
  },
39
39
  "dependencies": {
40
- "@stdlib/array-float64": "^0.0.x",
41
- "@stdlib/assert-contains": "^0.0.x",
42
- "@stdlib/assert-has-own-property": "^0.0.x",
43
- "@stdlib/assert-is-boolean": "^0.0.x",
44
- "@stdlib/assert-is-nan": "^0.0.x",
45
- "@stdlib/assert-is-number": "^0.0.x",
46
- "@stdlib/assert-is-number-array": "^0.0.x",
47
- "@stdlib/assert-is-plain-object": "^0.0.x",
48
- "@stdlib/assert-is-positive-integer": "^0.0.x",
49
- "@stdlib/assert-is-string": "^0.0.x",
50
- "@stdlib/assert-is-typed-array-like": "^0.0.x",
51
- "@stdlib/math-base-special-abs": "^0.0.x",
52
- "@stdlib/math-base-special-roundn": "^0.0.x",
53
- "@stdlib/math-base-special-signum": "^0.0.x",
54
- "@stdlib/math-base-special-sqrt": "^0.0.x",
55
- "@stdlib/stats-base-dists-normal-cdf": "^0.0.x",
56
- "@stdlib/stats-base-dists-signrank-cdf": "^0.0.x",
57
- "@stdlib/stats-ranks": "^0.0.x",
58
- "@stdlib/types": "^0.0.x",
59
- "@stdlib/utils-define-read-only-property": "^0.0.x",
60
- "@stdlib/utils-tabulate": "^0.0.x"
40
+ "@stdlib/array-float64": "^0.1.0",
41
+ "@stdlib/assert-contains": "^0.1.0",
42
+ "@stdlib/assert-has-own-property": "^0.1.0",
43
+ "@stdlib/assert-is-boolean": "^0.1.0",
44
+ "@stdlib/assert-is-nan": "^0.1.0",
45
+ "@stdlib/assert-is-number": "^0.1.0",
46
+ "@stdlib/assert-is-number-array": "^0.1.0",
47
+ "@stdlib/assert-is-plain-object": "^0.1.0",
48
+ "@stdlib/assert-is-positive-integer": "^0.1.0",
49
+ "@stdlib/assert-is-string": "^0.1.0",
50
+ "@stdlib/assert-is-typed-array-like": "^0.1.0",
51
+ "@stdlib/math-base-special-abs": "^0.1.0",
52
+ "@stdlib/math-base-special-roundn": "^0.1.0",
53
+ "@stdlib/math-base-special-signum": "^0.1.0",
54
+ "@stdlib/math-base-special-sqrt": "^0.1.0",
55
+ "@stdlib/stats-base-dists-normal-cdf": "^0.1.0",
56
+ "@stdlib/stats-base-dists-signrank-cdf": "^0.1.0",
57
+ "@stdlib/stats-ranks": "^0.1.0",
58
+ "@stdlib/string-format": "^0.1.0",
59
+ "@stdlib/types": "^0.1.0",
60
+ "@stdlib/utils-define-read-only-property": "^0.1.0",
61
+ "@stdlib/utils-tabulate": "^0.1.0",
62
+ "@stdlib/error-tools-fmtprodmsg": "^0.1.0"
61
63
  },
62
64
  "devDependencies": {
63
- "@stdlib/assert-is-object": "^0.0.x",
64
- "@stdlib/bench": "^0.0.x",
65
- "@stdlib/constants-float64-eps": "^0.0.x",
66
- "@stdlib/random-base-discrete-uniform": "^0.0.x",
67
- "@stdlib/random-base-randu": "^0.0.x",
65
+ "@stdlib/assert-is-object": "^0.1.0",
66
+ "@stdlib/bench": "^0.1.0",
67
+ "@stdlib/constants-float64-eps": "^0.1.0",
68
+ "@stdlib/random-base-discrete-uniform": "^0.0.6",
69
+ "@stdlib/random-base-randu": "^0.0.8",
68
70
  "tape": "git+https://github.com/kgryte/tape.git#fix/globby",
69
71
  "istanbul": "^0.4.1",
70
- "tap-spec": "5.x.x"
72
+ "tap-min": "git+https://github.com/Planeshifter/tap-min.git"
71
73
  },
72
74
  "engines": {
73
75
  "node": ">=0.10.0",
@@ -103,7 +105,7 @@
103
105
  "hypothesis"
104
106
  ],
105
107
  "funding": {
106
- "type": "patreon",
107
- "url": "https://www.patreon.com/athan"
108
+ "type": "opencollective",
109
+ "url": "https://opencollective.com/stdlib"
108
110
  }
109
111
  }
package/docs/repl.txt DELETED
@@ -1,182 +0,0 @@
1
-
2
- {{alias}}( x[, y][, options] )
3
- Computes a one-sample or paired Wilcoxon signed rank test.
4
-
5
- When no `y` is supplied, the function performs a one-sample Wilcoxon signed
6
- rank test for the null hypothesis that the data is drawn from a symmetric
7
- distribution around zero.
8
-
9
- When `y` is supplied, the function tests whether the
10
- differences `x - y` come from a symmetric distribution around zero.
11
-
12
- If `x` has less than fifty elements, an exact p-value is computed if there
13
- are no zero values or ties. Otherwise, a normal approximation is used.
14
-
15
- The returned object comes with a `.print()` method which when invoked will
16
- print a formatted output of the results of the hypothesis test.
17
-
18
- Parameters
19
- ----------
20
- x: Array<number>|TypedArray
21
- Data array.
22
-
23
- y: Array<number>|TypedArray (optional)
24
- Paired data array.
25
-
26
- options: Object (optional)
27
- Options.
28
-
29
- options.alpha: number (optional)
30
- Number in the interval `[0,1]` giving the significance level of the
31
- hypothesis test. Default: `0.05`.
32
-
33
- options.alternative: string (optional)
34
- Indicates whether the alternative hypothesis is that the mean of `x` is
35
- larger than `mu` (`greater`), smaller than `mu` (`less`), or equal to
36
- `mu` (`two-sided`). Default: `'two-sided'`.
37
-
38
- options.correction: boolean (optional)
39
- Determines whether to apply continuity correction adjusting the Wilcoxon
40
- rank statistic by 0.5 towards the mean when using the normal
41
- approximation. Default: `true`.
42
-
43
- options.exact: boolean (optional)
44
- Determines whether to force use of the exact distribution instead of a
45
- normal approximation when there are more than fifty data points.
46
- Default: `false`.
47
-
48
- options.mu: number (optional)
49
- Hypothesized true location under the null hypothesis. Set this option to
50
- test whether the data comes from a distribution with the specified `mu`.
51
- Default: `0`.
52
-
53
- options.zeroMethod: string (optional)
54
- Method governing how zero-differences are handled (`pratt`, `wilcox`, or
55
- `zsplit`). When set to `pratt`, differences of zero are used to
56
- calculate ranks but their ranks are then dropped. When set to `wilcox`,
57
- all zero-differences are discarded. When set to `zsplit`, differences of
58
- zero are used to rank and their ranks are then split between positive
59
- and negative ones. Default: `'wilcox'`.
60
-
61
- Returns
62
- -------
63
- out: Object
64
- Test result object.
65
-
66
- out.alpha: number
67
- Used significance level.
68
-
69
- out.rejected: boolean
70
- Test decision.
71
-
72
- out.pValue: number
73
- p-value of the test.
74
-
75
- out.statistic: number
76
- Value of test statistic.
77
-
78
- out.nullValue: number
79
- Assumed location parameter under H0.
80
-
81
- out.alternative: string
82
- Alternative hypothesis (`two-sided`, `less` or `greater`).
83
-
84
- out.method: string
85
- Name of test.
86
-
87
- out.print: Function
88
- Function to print formatted output.
89
-
90
- Examples
91
- --------
92
- // One-sample test:
93
- > var arr = [ 6, 8, 14, 16, 23, 24, 28, 29, 41, -48, 49, 56, 60, -67, 75 ];
94
- > var out = {{alias}}( x )
95
- {
96
- 'rejected': true,
97
- 'alpha': 0.05,
98
- 'pValue': 0.04125976562499978,
99
- 'statistic': 96
100
- // ...
101
- }
102
-
103
- // Paired test:
104
- > runif = {{alias:@stdlib/random/base/discrete-uniform}}.factory( 1, 5, { 'seed': 786 });
105
- > var x = new Array( 100 );
106
- > var y = new Array( 100 );
107
- > for ( i = 0; i < x.length; i++ ) {
108
- ... x[ i ] = runif();
109
- ... y[ i ] = runif();
110
- ... }
111
- > out = {{alias}}( x, y )
112
- {
113
- 'rejected': false,
114
- 'alpha': 0.05,
115
- 'pValue': 0.21759090963694638,
116
- 'statistic': 2702.5,
117
- // ...
118
- }
119
-
120
- // Print formatted output:
121
- > var table = out.print()
122
- Paired Wilcoxon signed rank test
123
-
124
- Alternative hypothesis: Median of the difference `x - y` is not equal to 0
125
-
126
- pValue: 0.2176
127
- statistic: 2702.5
128
-
129
- Test Decision: Fail to reject null in favor of alternative at 5% significance level
130
-
131
-
132
- // Choose custom significance level:
133
- > out = {{alias}}( arr, { 'alpha': 0.01 });
134
- > table = out.print()
135
- One-Sample Wilcoxon signed rank test
136
-
137
- Alternative hypothesis: Median of `x` is not equal to 0
138
-
139
- pValue: 0.0413
140
- statistic: 96
141
-
142
- Test Decision: Fail to reject null in favor of alternative at 1% significance level
143
-
144
-
145
- // Test for a median equal to ten:
146
- > out = {{alias}}( arr, { 'mu': 10 })
147
- {
148
- 'rejected': false,
149
- 'alpha': 0.05,
150
- 'pValue': 0.11169650413134602,
151
- 'statistic': 88.5,
152
- 'nullValue': 10,
153
- // ...
154
- }
155
-
156
- // Perform one-sided tests:
157
- > out = {{alias}}( arr, { 'alternative': 'less' });
158
- > table = out.print()
159
- One-Sample Wilcoxon signed rank test
160
-
161
- Alternative hypothesis: Median of `x` is less than 0
162
-
163
- pValue: 0.9823
164
- statistic: 96
165
-
166
- Test Decision: Fail to reject null in favor of alternative at 5% significance level
167
-
168
-
169
- > out = {{alias}}( arr, { 'alternative': 'greater' });
170
- > table = out.print()
171
- One-Sample Wilcoxon signed rank test
172
-
173
- Alternative hypothesis: Median of `x` is greater than 0
174
-
175
- pValue: 0.0206
176
- statistic: 96
177
-
178
- Test Decision: Reject null in favor of alternative at 5% significance level
179
-
180
- See Also
181
- --------
182
-
@@ -1,165 +0,0 @@
1
- /*
2
- * @license Apache-2.0
3
- *
4
- * Copyright (c) 2021 The Stdlib Authors.
5
- *
6
- * Licensed under the Apache License, Version 2.0 (the "License");
7
- * you may not use this file except in compliance with the License.
8
- * You may obtain a copy of the License at
9
- *
10
- * http://www.apache.org/licenses/LICENSE-2.0
11
- *
12
- * Unless required by applicable law or agreed to in writing, software
13
- * distributed under the License is distributed on an "AS IS" BASIS,
14
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- * See the License for the specific language governing permissions and
16
- * limitations under the License.
17
- */
18
-
19
- import wilcoxon = require( './index' );
20
-
21
-
22
- // TESTS //
23
-
24
- // The function returns an object with ordered x-values and fitted values...
25
- {
26
- const arr = [ 6, 8, 14, 16, 23, 24, 28, 29, 41, -48, 49, 56, 60, -67, 75 ];
27
- wilcoxon( arr ); // $ExpectType Results
28
- wilcoxon( arr, { 'mu': 2 } ); // $ExpectType Results
29
- const x = [ 1.83, 0.50, 1.62, 2.48, 1.68, 1.88, 1.55, 3.06, 1.30 ];
30
- const y = [ 0.878, 0.647, 0.598, 2.05, 1.06, 1.29, 1.06, 3.14, 1.29 ];
31
- wilcoxon( x, y, { 'correction': false } ); // $ExpectType Results
32
- }
33
-
34
- // The function does not compile if provided a first argument that is not an array of numbers...
35
- {
36
- const y = [ 0.878, 0.647, 0.598, 2.05, 1.06, 1.29, 1.06, 3.14, 1.29 ];
37
- wilcoxon( 'abc' ); // $ExpectError
38
- wilcoxon( true ); // $ExpectError
39
- wilcoxon( false ); // $ExpectError
40
- wilcoxon( null ); // $ExpectError
41
- wilcoxon( undefined ); // $ExpectError
42
- wilcoxon( 5 ); // $ExpectError
43
- wilcoxon( {} ); // $ExpectError
44
- wilcoxon( ( x: number ): number => x ); // $ExpectError
45
-
46
- wilcoxon( 'abc', y ); // $ExpectError
47
- wilcoxon( true, y ); // $ExpectError
48
- wilcoxon( false, y ); // $ExpectError
49
- wilcoxon( null, y ); // $ExpectError
50
- wilcoxon( undefined, y ); // $ExpectError
51
- wilcoxon( 5, y ); // $ExpectError
52
- wilcoxon( {}, y ); // $ExpectError
53
- wilcoxon( ( x: number ): number => x, y ); // $ExpectError
54
- }
55
-
56
- // The function does not compile if provided a second argument that is not an array of numbers or options object...
57
- {
58
- const x = [ 6, 8, 14, 16, 23, 24, 28, 29, 41, -48, 49, 56, 60, -67, 75 ];
59
- wilcoxon( x, 'abc' ); // $ExpectError
60
- wilcoxon( x, true ); // $ExpectError
61
- wilcoxon( x, false ); // $ExpectError
62
- wilcoxon( x, null ); // $ExpectError
63
- wilcoxon( x, 5 ); // $ExpectError
64
- wilcoxon( x, ( x: number ): number => x ); // $ExpectError
65
- }
66
-
67
- // The compiler throws an error if the function is provided a third argument which is not an options object...
68
- {
69
- const x = [ 1.83, 0.50, 1.62, 2.48, 1.68, 1.88, 1.55, 3.06, 1.30 ];
70
- const y = [ 0.878, 0.647, 0.598, 2.05, 1.06, 1.29, 1.06, 3.14, 1.29 ];
71
- wilcoxon( x, y, true ); // $ExpectError
72
- wilcoxon( x, y, false ); // $ExpectError
73
- wilcoxon( x, y, null ); // $ExpectError
74
- wilcoxon( x, y, 5 ); // $ExpectError
75
- wilcoxon( x, y, 'abc' ); // $ExpectError
76
- wilcoxon( x, y, ( x: number ): number => x ); // $ExpectError
77
- }
78
-
79
- // The compiler throws an error if the function is provided an `alpha` option which is not a number...
80
- {
81
- const x = [ 1.83, 0.50, 1.62, 2.48, 1.68, 1.88, 1.55, 3.06, 1.30 ];
82
- const y = [ 0.878, 0.647, 0.598, 2.05, 1.06, 1.29, 1.06, 3.14, 1.29 ];
83
- wilcoxon( x, y, { 'alpha': 'abc' } ); // $ExpectError
84
- wilcoxon( x, y, { 'alpha': true } ); // $ExpectError
85
- wilcoxon( x, y, { 'alpha': false } ); // $ExpectError
86
- wilcoxon( x, y, { 'alpha': null } ); // $ExpectError
87
- wilcoxon( x, y, { 'alpha': [] } ); // $ExpectError
88
- wilcoxon( x, y, { 'alpha': {} } ); // $ExpectError
89
- wilcoxon( x, y, { 'alpha': ( x: number ): number => x } ); // $ExpectError
90
- }
91
-
92
- // The compiler throws an error if the function is provided a `alternative` option which is not a recognized alternative...
93
- {
94
- const x = [ 1.83, 0.50, 1.62, 2.48, 1.68, 1.88, 1.55, 3.06, 1.30 ];
95
- const y = [ 0.878, 0.647, 0.598, 2.05, 1.06, 1.29, 1.06, 3.14, 1.29 ];
96
- wilcoxon( x, y, { 'alternative': 'abc' } ); // $ExpectError
97
- wilcoxon( x, y, { 'alternative': 123 } ); // $ExpectError
98
- wilcoxon( x, y, { 'alternative': true } ); // $ExpectError
99
- wilcoxon( x, y, { 'alternative': false } ); // $ExpectError
100
- wilcoxon( x, y, { 'alternative': null } ); // $ExpectError
101
- wilcoxon( x, y, { 'alternative': [] } ); // $ExpectError
102
- wilcoxon( x, y, { 'alternative': {} } ); // $ExpectError
103
- wilcoxon( x, y, { 'alternative': ( x: number ): number => x } ); // $ExpectError
104
- }
105
-
106
- // The compiler throws an error if the function is provided a `zeroMethod` option which is not a recognized method...
107
- {
108
- const x = [ 1.83, 0.50, 1.62, 2.48, 1.68, 1.88, 1.55, 3.06, 1.30 ];
109
- const y = [ 0.878, 0.647, 0.598, 2.05, 1.06, 1.29, 1.06, 3.14, 1.29 ];
110
- wilcoxon( x, y, { 'zeroMethod': 'abc' } ); // $ExpectError
111
- wilcoxon( x, y, { 'zeroMethod': 123 } ); // $ExpectError
112
- wilcoxon( x, y, { 'zeroMethod': true } ); // $ExpectError
113
- wilcoxon( x, y, { 'zeroMethod': false } ); // $ExpectError
114
- wilcoxon( x, y, { 'zeroMethod': null } ); // $ExpectError
115
- wilcoxon( x, y, { 'zeroMethod': [] } ); // $ExpectError
116
- wilcoxon( x, y, { 'zeroMethod': {} } ); // $ExpectError
117
- wilcoxon( x, y, { 'zeroMethod': ( x: number ): number => x } ); // $ExpectError
118
- }
119
-
120
- // The compiler throws an error if the function is provided a `correction` option which is not a boolean...
121
- {
122
- const x = [ 1.83, 0.50, 1.62, 2.48, 1.68, 1.88, 1.55, 3.06, 1.30 ];
123
- const y = [ 0.878, 0.647, 0.598, 2.05, 1.06, 1.29, 1.06, 3.14, 1.29 ];
124
- wilcoxon( x, y, { 'correction': 'abc' } ); // $ExpectError
125
- wilcoxon( x, y, { 'correction': '123' } ); // $ExpectError
126
- wilcoxon( x, y, { 'correction': 123 } ); // $ExpectError
127
- wilcoxon( x, y, { 'correction': null } ); // $ExpectError
128
- wilcoxon( x, y, { 'correction': [] } ); // $ExpectError
129
- wilcoxon( x, y, { 'correction': {} } ); // $ExpectError
130
- wilcoxon( x, y, { 'correction': ( x: number ): number => x } ); // $ExpectError
131
- }
132
-
133
- // The compiler throws an error if the function is provided an `exact` option which is not a boolean...
134
- {
135
- const x = [ 1.83, 0.50, 1.62, 2.48, 1.68, 1.88, 1.55, 3.06, 1.30 ];
136
- const y = [ 0.878, 0.647, 0.598, 2.05, 1.06, 1.29, 1.06, 3.14, 1.29 ];
137
- wilcoxon( x, y, { 'exact': 'abc' } ); // $ExpectError
138
- wilcoxon( x, y, { 'exact': '123' } ); // $ExpectError
139
- wilcoxon( x, y, { 'exact': 123 } ); // $ExpectError
140
- wilcoxon( x, y, { 'exact': null } ); // $ExpectError
141
- wilcoxon( x, y, { 'exact': [] } ); // $ExpectError
142
- wilcoxon( x, y, { 'exact': {} } ); // $ExpectError
143
- wilcoxon( x, y, { 'exact': ( x: number ): number => x } ); // $ExpectError
144
- }
145
-
146
- // The compiler throws an error if the function is provided a `mu` option which is not a number...
147
- {
148
- const x = [ 1.83, 0.50, 1.62, 2.48, 1.68, 1.88, 1.55, 3.06, 1.30 ];
149
- const y = [ 0.878, 0.647, 0.598, 2.05, 1.06, 1.29, 1.06, 3.14, 1.29 ];
150
- wilcoxon( x, y, { 'mu': 'abc' } ); // $ExpectError
151
- wilcoxon( x, y, { 'mu': true } ); // $ExpectError
152
- wilcoxon( x, y, { 'mu': false } ); // $ExpectError
153
- wilcoxon( x, y, { 'mu': null } ); // $ExpectError
154
- wilcoxon( x, y, { 'mu': [] } ); // $ExpectError
155
- wilcoxon( x, y, { 'mu': {} } ); // $ExpectError
156
- wilcoxon( x, y, { 'mu': ( x: number ): number => x } ); // $ExpectError
157
- }
158
-
159
- // The function does not compile if provided an invalid number of arguments...
160
- {
161
- const x = [ 1.83, 0.50, 1.62, 2.48, 1.68, 1.88, 1.55, 3.06, 1.30 ];
162
- const y = [ 0.878, 0.647, 0.598, 2.05, 1.06, 1.29, 1.06, 3.14, 1.29 ];
163
- wilcoxon(); // $ExpectError
164
- wilcoxon( x, y, {}, {} ); // $ExpectError
165
- }