@stdlib/stats-kruskal-test 0.0.7 → 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 +30 -0
- package/LICENSE +0 -304
- package/NOTICE +1 -1
- package/README.md +22 -10
- package/dist/index.d.ts +3 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +7 -0
- package/docs/types/index.d.ts +1 -1
- package/lib/index.js +2 -2
- package/lib/main.js +8 -7
- package/lib/print.js +4 -3
- package/lib/validate.js +4 -3
- package/package.json +32 -30
- package/docs/repl.txt +0 -68
- package/docs/types/test.ts +0 -89
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-
|
|
1
|
+
Copyright (c) 2016-2023 The Stdlib Authors.
|
package/README.md
CHANGED
|
@@ -18,6 +18,17 @@ 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
|
# kruskalTest
|
|
22
33
|
|
|
23
34
|
[![NPM version][npm-image]][npm-url] [![Build Status][test-image]][test-url] [![Coverage Status][coverage-image]][coverage-url] <!-- [![dependencies][dependencies-image]][dependencies-url] -->
|
|
@@ -241,7 +252,7 @@ See [LICENSE][stdlib-license].
|
|
|
241
252
|
|
|
242
253
|
## Copyright
|
|
243
254
|
|
|
244
|
-
Copyright © 2016-
|
|
255
|
+
Copyright © 2016-2023. The Stdlib [Authors][stdlib-authors].
|
|
245
256
|
|
|
246
257
|
</section>
|
|
247
258
|
|
|
@@ -254,8 +265,8 @@ Copyright © 2016-2022. The Stdlib [Authors][stdlib-authors].
|
|
|
254
265
|
[npm-image]: http://img.shields.io/npm/v/@stdlib/stats-kruskal-test.svg
|
|
255
266
|
[npm-url]: https://npmjs.org/package/@stdlib/stats-kruskal-test
|
|
256
267
|
|
|
257
|
-
[test-image]: https://github.com/stdlib-js/stats-kruskal-test/actions/workflows/test.yml/badge.svg
|
|
258
|
-
[test-url]: https://github.com/stdlib-js/stats-kruskal-test/actions/workflows/test.yml
|
|
268
|
+
[test-image]: https://github.com/stdlib-js/stats-kruskal-test/actions/workflows/test.yml/badge.svg?branch=v0.1.0
|
|
269
|
+
[test-url]: https://github.com/stdlib-js/stats-kruskal-test/actions/workflows/test.yml?query=branch:v0.1.0
|
|
259
270
|
|
|
260
271
|
[coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/stats-kruskal-test/main.svg
|
|
261
272
|
[coverage-url]: https://codecov.io/github/stdlib-js/stats-kruskal-test?branch=main
|
|
@@ -267,19 +278,20 @@ Copyright © 2016-2022. The Stdlib [Authors][stdlib-authors].
|
|
|
267
278
|
|
|
268
279
|
-->
|
|
269
280
|
|
|
281
|
+
[chat-image]: https://img.shields.io/gitter/room/stdlib-js/stdlib.svg
|
|
282
|
+
[chat-url]: https://app.gitter.im/#/room/#stdlib-js_stdlib:gitter.im
|
|
283
|
+
|
|
284
|
+
[stdlib]: https://github.com/stdlib-js/stdlib
|
|
285
|
+
|
|
286
|
+
[stdlib-authors]: https://github.com/stdlib-js/stdlib/graphs/contributors
|
|
287
|
+
|
|
270
288
|
[umd]: https://github.com/umdjs/umd
|
|
271
289
|
[es-module]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules
|
|
272
290
|
|
|
273
291
|
[deno-url]: https://github.com/stdlib-js/stats-kruskal-test/tree/deno
|
|
274
292
|
[umd-url]: https://github.com/stdlib-js/stats-kruskal-test/tree/umd
|
|
275
293
|
[esm-url]: https://github.com/stdlib-js/stats-kruskal-test/tree/esm
|
|
276
|
-
|
|
277
|
-
[chat-image]: https://img.shields.io/gitter/room/stdlib-js/stdlib.svg
|
|
278
|
-
[chat-url]: https://gitter.im/stdlib-js/stdlib/
|
|
279
|
-
|
|
280
|
-
[stdlib]: https://github.com/stdlib-js/stdlib
|
|
281
|
-
|
|
282
|
-
[stdlib-authors]: https://github.com/stdlib-js/stdlib/graphs/contributors
|
|
294
|
+
[branches-url]: https://github.com/stdlib-js/stats-kruskal-test/blob/main/branches.md
|
|
283
295
|
|
|
284
296
|
[stdlib-license]: https://raw.githubusercontent.com/stdlib-js/stats-kruskal-test/main/LICENSE
|
|
285
297
|
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";var j=function(a,i){return function(){return i||a((i={exports:{}}).exports,i),i.exports}};var I=j(function(ur,F){
|
|
2
|
+
var A=require('@stdlib/assert-is-array/dist'),W=require('@stdlib/assert-is-number/dist').isPrimitive,z=require('@stdlib/assert-is-plain-object/dist'),G=require('@stdlib/assert-is-nan/dist'),R=require('@stdlib/assert-has-own-property/dist'),T=require('@stdlib/error-tools-fmtprodmsg/dist');function H(a,i){return z(i)?R(i,"alpha")&&(a.alpha=i.alpha,!W(a.alpha)||G(a.alpha))?new TypeError(T('1Lb8P',"alpha",a.alpha)):R(i,"groups")&&(a.groups=i.groups,!A(a.groups))?new TypeError(T('1Lb8Z',"groups",a.groups)):null:new TypeError(T('1Lb2V',i));}F.exports=H
|
|
3
|
+
});var C=j(function(or,B){
|
|
4
|
+
var J=require('@stdlib/assert-is-positive-integer/dist'),L=require('@stdlib/assert-is-plain-object/dist'),Q=require('@stdlib/assert-is-boolean/dist').isPrimitive,N=require('@stdlib/assert-has-own-property/dist'),S=require('@stdlib/math-base-special-roundn/dist'),k=require('@stdlib/error-tools-fmtprodmsg/dist');function U(a){var i,s,e;if(s=4,i=!0,arguments.length>0){if(!L(a))throw new TypeError(k('1Lb3L',a));if(N(a,"digits")){if(!J(a.digits))throw new TypeError(k('1Lb3P',"digits",a.digits));s=a.digits}if(N(a,"decision")){if(!Q(a.decision))throw new TypeError(k('1Lb2o',"decision",a.decision));i=a.decision}}return e="",e+=this.method,e+="\n\n",e+="Null hypothesis: the medians of all groups are the same",e+="\n\n",e+=" pValue: "+S(this.pValue,-s)+"\n",e+=" statistic: "+S(this.statistic,-s),e+=" df: "+this.df,e+="\n\n",i&&(e+="Test Decision: ",this.rejected?e+="Reject null in favor of alternative at "+this.alpha*100+"% significance level":e+="Fail to reject null in favor of alternative at "+this.alpha*100+"% significance level",e+="\n"),e}B.exports=U
|
|
5
|
+
});var M=j(function(lr,K){
|
|
6
|
+
var X=require('@stdlib/assert-is-collection/dist'),Y=require('@stdlib/assert-is-plain-object/dist'),g=require('@stdlib/utils-define-read-only-property/dist'),Z=require('@stdlib/utils-count-by/dist'),D=require('@stdlib/utils-keys/dist'),_=require('@stdlib/stats-ranks/dist'),V=require('@stdlib/math-base-special-pow/dist'),$=require('@stdlib/stats-base-dists-chisquare-cdf/dist'),rr=require('@stdlib/utils-identity-function/dist'),er=require('@stdlib/array-base-incrspace/dist'),d=require('@stdlib/error-tools-fmtprodmsg/dist'),ar=I(),ir=C();function tr(){var a,i,s,e,P,h,l,w,x,b,u,y,v,f,o,E,c,t,r,q,m,p,n,O;if(e=arguments.length,u={},Y(arguments[e-1])&&(P=arguments[e-1],e-=1,E=ar(u,P),E))throw E;if(i={},m={},u.groups){if(n=arguments[0],n.length!==u.groups.length)throw new RangeError(d('1Lb9p',"opts.groups"));for(m=Z(u.groups,rr),h=D(m),e=h.length,r=0;r<e;r++)c=h[r],i[c]=0;if(e<2)throw new Error(d('1Lb8W',"groups",h));a=u.groups}else{if(n=[],a=[],e<2)throw new Error(d('1Lb9q',o));for(r=0;r<e;r++){if(o=arguments[r],!X(o))throw new TypeError(d('1Lb8X',o));if(o.length===0)throw new Error(d('1Lb8Y',o));for(m[r]=o.length,i[r]=0,q=0;q<m[r];q++)a.push(r),n.push(o[q])}h=er(0,e,1)}if(u.alpha===void 0?l=.05:l=u.alpha,l<0||l>1)throw new RangeError(d('1Lb9r',"alpha",l));for(p=n.length,x=_(n),f={},r=0;r<p;r++)i[a[r]]+=x[r],n[r]in f?f[n[r]]+=1:f[n[r]]=1;for(v=0,r=0;r<e;r++)c=h[r],v+=V(i[c],2)/m[c];for(v=12/(p*(p+1))*v-3*(p+1),s=0,b=D(f),r=0;r<b.length;r++)O=f[b[r]],s+=V(O,3)-O;return v/=1-s/(V(p,3)-p),w=e-1,y=1-$(v,w),t={},g(t,"rejected",y<=l),g(t,"alpha",l),g(t,"df",w),g(t,"pValue",y),g(t,"statistic",v),g(t,"method","Kruskal-Wallis Test"),g(t,"print",ir),t}K.exports=tr
|
|
7
|
+
});var nr=M();module.exports=nr;
|
|
8
|
+
/** @license Apache-2.0 */
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../lib/validate.js", "../lib/print.js", "../lib/main.js", "../lib/index.js"],
|
|
4
|
+
"sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 isArray = require( '@stdlib/assert-is-array' );\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 {Array} [options.groups] - array of group indicators\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}\n\tif ( hasOwnProp( options, 'groups' ) ) {\n\t\topts.groups = options.groups;\n\t\tif ( !isArray( opts.groups ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be an array. Option: `%s`.', 'groups', opts.groups ) );\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) 2018 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\n\tstr = '';\n\tstr += this.method;\n\tstr += '\\n\\n';\n\tstr += 'Null hypothesis: the medians of all groups are the same';\n\tstr += '\\n\\n';\n\tstr += ' pValue: ' + roundn( this.pValue, -dgts ) + '\\n';\n\tstr += ' statistic: ' + roundn( this.statistic, -dgts );\n\tstr += ' df: ' + this.df;\n\tstr += '\\n\\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", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 isCollection = require( '@stdlib/assert-is-collection' );\nvar isPlainObject = require( '@stdlib/assert-is-plain-object' );\nvar setReadOnly = require( '@stdlib/utils-define-read-only-property' );\nvar countBy = require( '@stdlib/utils-count-by' );\nvar objectKeys = require( '@stdlib/utils-keys' );\nvar rank = require( '@stdlib/stats-ranks' );\nvar pow = require( '@stdlib/math-base-special-pow' );\nvar chisqCDF = require( '@stdlib/stats-base-dists-chisquare-cdf' );\nvar identity = require( '@stdlib/utils-identity-function' );\nvar incrspace = require( '@stdlib/array-base-incrspace' );\nvar format = require( '@stdlib/string-format' );\nvar validate = require( './validate.js' );\nvar print = require( './print.js' ); // eslint-disable-line stdlib/no-redeclare\n\n\n// MAIN //\n\n/**\n* Computes the Kruskal-Wallis test for equality of medians.\n*\n* @param {...NumberArray} arguments - either two or more number arrays or a single numeric array if an array of group indicators is supplied as an option\n* @param {Options} [options] - function options\n* @param {number} [options.alpha=0.05] - significance level\n* @param {Array} [options.groups] - array of group indicators\n* @throws {Error} must provide at least two array-like arguments if `groups` is not set\n* @throws {TypeError} must provide array-like arguments\n* @throws {TypeError} options must be an object\n* @throws {TypeError} must provide valid options\n* @throws {RangeError} alpha option has to be a number in the interval `[0,1]`\n* @returns {Object} test results\n*\n* @example\n* // Data from Hollander & Wolfe (1973), p. 116:\n* var x = [ 2.9, 3.0, 2.5, 2.6, 3.2 ];\n* var y = [ 3.8, 2.7, 4.0, 2.4 ];\n* var z = [ 2.8, 3.4, 3.7, 2.2, 2.0 ];\n*\n* var out = kruskal( x, y, z );\n* // returns {...}\n*/\nfunction kruskal() {\n\tvar groupsIndicators;\n\tvar groupRankSums;\n\tvar tieSumTerm;\n\tvar ngroups;\n\tvar options;\n\tvar levels;\n\tvar alpha;\n\tvar param;\n\tvar ranks;\n\tvar vals;\n\tvar opts;\n\tvar pval;\n\tvar stat;\n\tvar ties;\n\tvar arg;\n\tvar err;\n\tvar key;\n\tvar out;\n\tvar i;\n\tvar j;\n\tvar n;\n\tvar N;\n\tvar x;\n\tvar v;\n\n\tngroups = arguments.length;\n\topts = {};\n\tif ( isPlainObject( arguments[ ngroups - 1 ] ) ) {\n\t\toptions = arguments[ ngroups - 1 ];\n\t\tngroups -= 1;\n\t\terr = validate( opts, options );\n\t\tif ( err ) {\n\t\t\tthrow err;\n\t\t}\n\t}\n\tgroupRankSums = {};\n\tn = {};\n\tif ( opts.groups ) {\n\t\tx = arguments[ 0 ];\n\t\tif ( x.length !== opts.groups.length ) {\n\t\t\tthrow new RangeError( format( 'invalid arguments. First argument and `%s` must be arrays having the same length.', 'opts.groups' ) );\n\t\t}\n\t\tn = countBy( opts.groups, identity );\n\t\tlevels = objectKeys( n );\n\t\tngroups = levels.length;\n\t\tfor ( i = 0; i < ngroups; i++ ) {\n\t\t\tkey = levels[ i ];\n\t\t\tgroupRankSums[ key ] = 0;\n\t\t}\n\t\tif ( ngroups < 2 ) {\n\t\t\tthrow new Error( format( 'invalid option. `%s` option must be an array containing at least two unique elements. Option: `%s`.', 'groups', levels ) );\n\t\t}\n\t\tgroupsIndicators = opts.groups;\n\t} else {\n\t\tx = [];\n\t\tgroupsIndicators = [];\n\t\tif ( ngroups < 2 ) {\n\t\t\tthrow new Error( format( 'invalid invocation. Incorrect number of arguments. Must provide at least two array-like arguments. Value: `%s`.', arg ) );\n\t\t}\n\t\tfor ( i = 0; i < ngroups; i++ ) {\n\t\t\targ = arguments[ i ];\n\t\t\tif ( !isCollection( arg ) ) {\n\t\t\t\tthrow new TypeError( format( 'invalid argument. Must provide array-like arguments. Value: `%s`.', arg ) );\n\t\t\t}\n\t\t\tif ( arg.length === 0 ) {\n\t\t\t\tthrow new Error( format( 'invalid argument. Supplied arrays cannot be empty. Value: `%s`.', arg ) );\n\t\t\t} else {\n\t\t\t\tn[ i ] = arg.length;\n\t\t\t}\n\t\t\tgroupRankSums[ i ] = 0;\n\t\t\tfor ( j = 0; j < n[ i ]; j++ ) {\n\t\t\t\tgroupsIndicators.push( i );\n\t\t\t\tx.push( arg[ j ] );\n\t\t\t}\n\t\t}\n\t\tlevels = incrspace( 0, ngroups, 1 );\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 ( alpha < 0.0 || alpha > 1.0 ) {\n\t\tthrow new RangeError( format( 'invalid option. `%s` must be a number on the interval: [0, 1]. Value: `%f`.', 'alpha', alpha ) );\n\t}\n\n\tN = x.length;\n\tranks = rank( x );\n\n\t// Calculate # ties for each value & rank sums per group:\n\tties = {};\n\tfor ( i = 0; i < N; i++ ) {\n\t\tgroupRankSums[ groupsIndicators[ i ] ] += ranks[ i ];\n\t\tif ( x[ i ] in ties ) {\n\t\t\tties[ x[ i ] ] += 1;\n\t\t} else {\n\t\t\tties[ x[ i ] ] = 1;\n\t\t}\n\t}\n\n\t// Calculate test statistic using short-cut formula:\n\tstat = 0.0;\n\tfor ( i = 0; i < ngroups; i++ ) {\n\t\tkey = levels[ i ];\n\t\tstat += pow( groupRankSums[ key ], 2.0 ) / n[ key ];\n\t}\n\tstat = ( ( 12.0 / ( N * (N+1) ) ) * stat ) - ( 3.0 * (N+1) );\n\n\t// Correction for ties:\n\ttieSumTerm = 0;\n\tvals = objectKeys( ties );\n\tfor ( i = 0; i < vals.length; i++ ) {\n\t\tv = ties[ vals[ i ] ];\n\t\ttieSumTerm += pow( v, 3.0 ) - v;\n\t}\n\n\tstat /= 1.0 - ( ( tieSumTerm ) / ( pow( N, 3 ) - N ) );\n\tparam = ngroups - 1;\n\tpval = 1.0 - chisqCDF( stat, param );\n\n\tout = {};\n\tsetReadOnly( out, 'rejected', pval <= alpha );\n\tsetReadOnly( out, 'alpha', alpha );\n\tsetReadOnly( out, 'df', param );\n\tsetReadOnly( out, 'pValue', pval );\n\tsetReadOnly( out, 'statistic', stat );\n\tsetReadOnly( out, 'method', 'Kruskal-Wallis Test' );\n\tsetReadOnly( out, 'print', print );\n\treturn out;\n}\n\n\n// EXPORTS //\n\nmodule.exports = kruskal;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 the Kruskal-Wallis test for equal medians.\n*\n* @module @stdlib/stats-kruskal-test\n*\n* @example\n* var kruskalTest = require( '@stdlib/stats-kruskal-test' );\n*\n* // Data from Hollander & Wolfe (1973), p. 116:\n* var x = [ 2.9, 3.0, 2.5, 2.6, 3.2 ];\n* var y = [ 3.8, 2.7, 4.0, 2.4 ];\n* var z = [ 2.8, 3.4, 3.7, 2.2, 2.0 ];\n*\n*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CvB,EAAa6B,EAAK,YAAaL,CAAK,EACpCxB,EAAa6B,EAAK,SAAU,qBAAsB,EAClD7B,EAAa6B,EAAK,QAASnB,EAAM,EAC1BmB,CACR,CAKAhC,EAAO,QAAUc,KC9JjB,IAAIyB,GAAO,IAKX,OAAO,QAAUA",
|
|
6
|
+
"names": ["require_validate", "__commonJSMin", "exports", "module", "isArray", "isNumber", "isObject", "isnan", "hasOwnProp", "format", "validate", "opts", "options", "require_print", "__commonJSMin", "exports", "module", "isPositiveInteger", "isObject", "isBoolean", "hasOwnProp", "roundn", "format", "print", "opts", "decision", "dgts", "str", "require_main", "__commonJSMin", "exports", "module", "isCollection", "isPlainObject", "setReadOnly", "countBy", "objectKeys", "rank", "pow", "chisqCDF", "identity", "incrspace", "format", "validate", "print", "kruskal", "groupsIndicators", "groupRankSums", "tieSumTerm", "ngroups", "options", "levels", "alpha", "param", "ranks", "vals", "opts", "pval", "stat", "ties", "arg", "err", "key", "out", "i", "j", "n", "N", "x", "v", "main"]
|
|
7
|
+
}
|
package/docs/types/index.d.ts
CHANGED
package/lib/index.js
CHANGED
package/lib/main.js
CHANGED
|
@@ -30,6 +30,7 @@ var pow = require( '@stdlib/math-base-special-pow' );
|
|
|
30
30
|
var chisqCDF = require( '@stdlib/stats-base-dists-chisquare-cdf' );
|
|
31
31
|
var identity = require( '@stdlib/utils-identity-function' );
|
|
32
32
|
var incrspace = require( '@stdlib/array-base-incrspace' );
|
|
33
|
+
var format = require( '@stdlib/string-format' );
|
|
33
34
|
var validate = require( './validate.js' );
|
|
34
35
|
var print = require( './print.js' ); // eslint-disable-line stdlib/no-redeclare
|
|
35
36
|
|
|
@@ -45,7 +46,7 @@ var print = require( './print.js' ); // eslint-disable-line stdlib/no-redeclare
|
|
|
45
46
|
* @param {Array} [options.groups] - array of group indicators
|
|
46
47
|
* @throws {Error} must provide at least two array-like arguments if `groups` is not set
|
|
47
48
|
* @throws {TypeError} must provide array-like arguments
|
|
48
|
-
* @throws {TypeError} options
|
|
49
|
+
* @throws {TypeError} options must be an object
|
|
49
50
|
* @throws {TypeError} must provide valid options
|
|
50
51
|
* @throws {RangeError} alpha option has to be a number in the interval `[0,1]`
|
|
51
52
|
* @returns {Object} test results
|
|
@@ -100,7 +101,7 @@ function kruskal() {
|
|
|
100
101
|
if ( opts.groups ) {
|
|
101
102
|
x = arguments[ 0 ];
|
|
102
103
|
if ( x.length !== opts.groups.length ) {
|
|
103
|
-
throw new RangeError( 'invalid arguments. First argument and `
|
|
104
|
+
throw new RangeError( format( 'invalid arguments. First argument and `%s` must be arrays having the same length.', 'opts.groups' ) );
|
|
104
105
|
}
|
|
105
106
|
n = countBy( opts.groups, identity );
|
|
106
107
|
levels = objectKeys( n );
|
|
@@ -110,22 +111,22 @@ function kruskal() {
|
|
|
110
111
|
groupRankSums[ key ] = 0;
|
|
111
112
|
}
|
|
112
113
|
if ( ngroups < 2 ) {
|
|
113
|
-
throw new Error( 'invalid
|
|
114
|
+
throw new Error( format( 'invalid option. `%s` option must be an array containing at least two unique elements. Option: `%s`.', 'groups', levels ) );
|
|
114
115
|
}
|
|
115
116
|
groupsIndicators = opts.groups;
|
|
116
117
|
} else {
|
|
117
118
|
x = [];
|
|
118
119
|
groupsIndicators = [];
|
|
119
120
|
if ( ngroups < 2 ) {
|
|
120
|
-
throw new Error( 'invalid number of
|
|
121
|
+
throw new Error( format( 'invalid invocation. Incorrect number of arguments. Must provide at least two array-like arguments. Value: `%s`.', arg ) );
|
|
121
122
|
}
|
|
122
123
|
for ( i = 0; i < ngroups; i++ ) {
|
|
123
124
|
arg = arguments[ i ];
|
|
124
125
|
if ( !isCollection( arg ) ) {
|
|
125
|
-
throw new TypeError( 'invalid argument. Must provide array-like arguments. Value:
|
|
126
|
+
throw new TypeError( format( 'invalid argument. Must provide array-like arguments. Value: `%s`.', arg ) );
|
|
126
127
|
}
|
|
127
128
|
if ( arg.length === 0 ) {
|
|
128
|
-
throw new Error( 'invalid argument. Supplied arrays cannot be empty. Value:
|
|
129
|
+
throw new Error( format( 'invalid argument. Supplied arrays cannot be empty. Value: `%s`.', arg ) );
|
|
129
130
|
} else {
|
|
130
131
|
n[ i ] = arg.length;
|
|
131
132
|
}
|
|
@@ -143,7 +144,7 @@ function kruskal() {
|
|
|
143
144
|
alpha = opts.alpha;
|
|
144
145
|
}
|
|
145
146
|
if ( alpha < 0.0 || alpha > 1.0 ) {
|
|
146
|
-
throw new RangeError( 'invalid option. `
|
|
147
|
+
throw new RangeError( format( 'invalid option. `%s` must be a number on the interval: [0, 1]. Value: `%f`.', 'alpha', alpha ) );
|
|
147
148
|
}
|
|
148
149
|
|
|
149
150
|
N = x.length;
|
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
|
|
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. `
|
|
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. `
|
|
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
|
}
|
package/lib/validate.js
CHANGED
|
@@ -25,6 +25,7 @@ var isNumber = require( '@stdlib/assert-is-number' ).isPrimitive;
|
|
|
25
25
|
var isObject = require( '@stdlib/assert-is-plain-object' );
|
|
26
26
|
var isnan = require( '@stdlib/assert-is-nan' );
|
|
27
27
|
var hasOwnProp = require( '@stdlib/assert-has-own-property' );
|
|
28
|
+
var format = require( '@stdlib/string-format' );
|
|
28
29
|
|
|
29
30
|
|
|
30
31
|
// MAIN //
|
|
@@ -41,18 +42,18 @@ var hasOwnProp = require( '@stdlib/assert-has-own-property' );
|
|
|
41
42
|
*/
|
|
42
43
|
function validate( opts, options ) {
|
|
43
44
|
if ( !isObject( options ) ) {
|
|
44
|
-
return new TypeError( 'invalid argument. Options argument must be an object. Value:
|
|
45
|
+
return new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );
|
|
45
46
|
}
|
|
46
47
|
if ( hasOwnProp( options, 'alpha' ) ) {
|
|
47
48
|
opts.alpha = options.alpha;
|
|
48
49
|
if ( !isNumber( opts.alpha ) || isnan( opts.alpha ) ) {
|
|
49
|
-
return new TypeError( 'invalid option. `
|
|
50
|
+
return new TypeError( format( 'invalid option. `%s` option must be a number. Option: `%s`.', 'alpha', opts.alpha ) );
|
|
50
51
|
}
|
|
51
52
|
}
|
|
52
53
|
if ( hasOwnProp( options, 'groups' ) ) {
|
|
53
54
|
opts.groups = options.groups;
|
|
54
55
|
if ( !isArray( opts.groups ) ) {
|
|
55
|
-
return new TypeError( 'invalid option. `
|
|
56
|
+
return new TypeError( format( 'invalid option. `%s` option must be an array. Option: `%s`.', 'groups', opts.groups ) );
|
|
56
57
|
}
|
|
57
58
|
}
|
|
58
59
|
return null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stdlib/stats-kruskal-test",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"description": "Compute the Kruskal-Wallis test for equal medians.",
|
|
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-base-incrspace": "^0.0
|
|
41
|
-
"@stdlib/assert-has-own-property": "^0.0
|
|
42
|
-
"@stdlib/assert-is-array": "^0.0
|
|
43
|
-
"@stdlib/assert-is-boolean": "^0.0
|
|
44
|
-
"@stdlib/assert-is-collection": "^0.0
|
|
45
|
-
"@stdlib/assert-is-nan": "^0.0
|
|
46
|
-
"@stdlib/assert-is-number": "^0.0
|
|
47
|
-
"@stdlib/assert-is-plain-object": "^0.0
|
|
48
|
-
"@stdlib/assert-is-positive-integer": "^0.0
|
|
49
|
-
"@stdlib/math-base-special-pow": "^0.0
|
|
50
|
-
"@stdlib/math-base-special-roundn": "^0.0
|
|
51
|
-
"@stdlib/stats-base-dists-chisquare-cdf": "^0.0
|
|
52
|
-
"@stdlib/stats-ranks": "^0.0
|
|
53
|
-
"@stdlib/
|
|
54
|
-
"@stdlib/
|
|
55
|
-
"@stdlib/utils-
|
|
56
|
-
"@stdlib/utils-
|
|
57
|
-
"@stdlib/utils-
|
|
40
|
+
"@stdlib/array-base-incrspace": "^0.1.0",
|
|
41
|
+
"@stdlib/assert-has-own-property": "^0.1.0",
|
|
42
|
+
"@stdlib/assert-is-array": "^0.1.0",
|
|
43
|
+
"@stdlib/assert-is-boolean": "^0.1.0",
|
|
44
|
+
"@stdlib/assert-is-collection": "^0.1.0",
|
|
45
|
+
"@stdlib/assert-is-nan": "^0.1.0",
|
|
46
|
+
"@stdlib/assert-is-number": "^0.1.0",
|
|
47
|
+
"@stdlib/assert-is-plain-object": "^0.1.0",
|
|
48
|
+
"@stdlib/assert-is-positive-integer": "^0.1.0",
|
|
49
|
+
"@stdlib/math-base-special-pow": "^0.1.0",
|
|
50
|
+
"@stdlib/math-base-special-roundn": "^0.1.0",
|
|
51
|
+
"@stdlib/stats-base-dists-chisquare-cdf": "^0.1.0",
|
|
52
|
+
"@stdlib/stats-ranks": "^0.1.0",
|
|
53
|
+
"@stdlib/string-format": "^0.1.0",
|
|
54
|
+
"@stdlib/types": "^0.1.0",
|
|
55
|
+
"@stdlib/utils-count-by": "^0.1.0",
|
|
56
|
+
"@stdlib/utils-define-read-only-property": "^0.1.0",
|
|
57
|
+
"@stdlib/utils-identity-function": "^0.1.0",
|
|
58
|
+
"@stdlib/utils-keys": "^0.1.0",
|
|
59
|
+
"@stdlib/error-tools-fmtprodmsg": "^0.1.0"
|
|
58
60
|
},
|
|
59
61
|
"devDependencies": {
|
|
60
|
-
"@stdlib/assert-contains": "^0.0
|
|
61
|
-
"@stdlib/assert-is-object": "^0.0
|
|
62
|
-
"@stdlib/assert-is-string": "^0.0
|
|
63
|
-
"@stdlib/bench": "^0.0
|
|
64
|
-
"@stdlib/constants-float64-eps": "^0.0
|
|
65
|
-
"@stdlib/math-base-special-abs": "^0.0
|
|
66
|
-
"@stdlib/random-base-discrete-uniform": "^0.0.
|
|
67
|
-
"@stdlib/random-base-randu": "^0.0.
|
|
62
|
+
"@stdlib/assert-contains": "^0.1.0",
|
|
63
|
+
"@stdlib/assert-is-object": "^0.1.0",
|
|
64
|
+
"@stdlib/assert-is-string": "^0.1.0",
|
|
65
|
+
"@stdlib/bench": "^0.1.0",
|
|
66
|
+
"@stdlib/constants-float64-eps": "^0.1.0",
|
|
67
|
+
"@stdlib/math-base-special-abs": "^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-
|
|
72
|
+
"tap-min": "git+https://github.com/Planeshifter/tap-min.git"
|
|
71
73
|
},
|
|
72
74
|
"engines": {
|
|
73
75
|
"node": ">=0.10.0",
|
|
@@ -100,7 +102,7 @@
|
|
|
100
102
|
"non-parametric"
|
|
101
103
|
],
|
|
102
104
|
"funding": {
|
|
103
|
-
"type": "
|
|
104
|
-
"url": "https://
|
|
105
|
+
"type": "opencollective",
|
|
106
|
+
"url": "https://opencollective.com/stdlib"
|
|
105
107
|
}
|
|
106
108
|
}
|
package/docs/repl.txt
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
{{alias}}( ...x[, options] )
|
|
3
|
-
Computes the Kruskal-Wallis test for equal medians.
|
|
4
|
-
|
|
5
|
-
Parameters
|
|
6
|
-
----------
|
|
7
|
-
x: ...Array
|
|
8
|
-
Measured values.
|
|
9
|
-
|
|
10
|
-
options: Object (optional)
|
|
11
|
-
Options.
|
|
12
|
-
|
|
13
|
-
options.alpha: number (optional)
|
|
14
|
-
Number in the interval `[0,1]` giving the significance level of the
|
|
15
|
-
hypothesis test. Default: `0.05`.
|
|
16
|
-
|
|
17
|
-
options.groups: Array (optional)
|
|
18
|
-
Array of group indicators.
|
|
19
|
-
|
|
20
|
-
Returns
|
|
21
|
-
-------
|
|
22
|
-
out: Object
|
|
23
|
-
Test result object.
|
|
24
|
-
|
|
25
|
-
out.alpha: number
|
|
26
|
-
Significance level.
|
|
27
|
-
|
|
28
|
-
out.rejected: boolean
|
|
29
|
-
Test decision.
|
|
30
|
-
|
|
31
|
-
out.pValue: number
|
|
32
|
-
p-value of the test.
|
|
33
|
-
|
|
34
|
-
out.statistic: number
|
|
35
|
-
Value of test statistic.
|
|
36
|
-
|
|
37
|
-
out.method: string
|
|
38
|
-
Name of test.
|
|
39
|
-
|
|
40
|
-
out.df: Object
|
|
41
|
-
Degrees of freedom.
|
|
42
|
-
|
|
43
|
-
out.print: Function
|
|
44
|
-
Function to print formatted output.
|
|
45
|
-
|
|
46
|
-
Examples
|
|
47
|
-
--------
|
|
48
|
-
// Data from Hollander & Wolfe (1973), p. 116:
|
|
49
|
-
> var x = [ 2.9, 3.0, 2.5, 2.6, 3.2 ];
|
|
50
|
-
> var y = [ 3.8, 2.7, 4.0, 2.4 ];
|
|
51
|
-
> var z = [ 2.8, 3.4, 3.7, 2.2, 2.0 ];
|
|
52
|
-
|
|
53
|
-
> var out = {{alias}}( x, y, z )
|
|
54
|
-
|
|
55
|
-
> var arr = [ 2.9, 3.0, 2.5, 2.6, 3.2,
|
|
56
|
-
... 3.8, 2.7, 4.0, 2.4,
|
|
57
|
-
... 2.8, 3.4, 3.7, 2.2, 2.0
|
|
58
|
-
... ];
|
|
59
|
-
> var groups = [
|
|
60
|
-
... 'a', 'a', 'a', 'a', 'a',
|
|
61
|
-
... 'b', 'b', 'b', 'b',
|
|
62
|
-
... 'c', 'c', 'c', 'c', 'c'
|
|
63
|
-
... ];
|
|
64
|
-
> out = {{alias}}( arr, { 'groups': groups })
|
|
65
|
-
|
|
66
|
-
See Also
|
|
67
|
-
--------
|
|
68
|
-
|
package/docs/types/test.ts
DELETED
|
@@ -1,89 +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 kruskalTest = require( './index' );
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
// TESTS //
|
|
23
|
-
|
|
24
|
-
// The function returns a test result object...
|
|
25
|
-
{
|
|
26
|
-
let x = [ 1, 3, 5, 2, 4, 6, 8, 7, 10, 11, 12, 15 ];
|
|
27
|
-
const g = [ 'D', 'A', 'B', 'C', 'D', 'A', 'B', 'C', 'D', 'A', 'B', 'C' ];
|
|
28
|
-
kruskalTest( x, { 'groups': g } ); // $ExpectType Results
|
|
29
|
-
|
|
30
|
-
x = [ 2.9, 3.0, 2.5, 2.6, 3.2 ];
|
|
31
|
-
const y = [ 3.8, 2.7, 4.0, 2.4 ];
|
|
32
|
-
const z = [ 2.8, 3.4, 3.7, 2.2, 2.0 ];
|
|
33
|
-
kruskalTest( x, y, z ); // $ExpectType Results
|
|
34
|
-
kruskalTest( x, y, z, { 'alpha': 0.1 } ); // $ExpectType Results
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
// The function does not compile if provided a first argument that is not a numeric array...
|
|
38
|
-
{
|
|
39
|
-
const y = [ 3.8, 2.7, 4.0, 2.4 ];
|
|
40
|
-
kruskalTest( 'abc', y ); // $ExpectError
|
|
41
|
-
kruskalTest( true, y ); // $ExpectError
|
|
42
|
-
kruskalTest( false, y ); // $ExpectError
|
|
43
|
-
kruskalTest( null, y ); // $ExpectError
|
|
44
|
-
kruskalTest( undefined, y ); // $ExpectError
|
|
45
|
-
kruskalTest( 5, y ); // $ExpectError
|
|
46
|
-
kruskalTest( {}, y ); // $ExpectError
|
|
47
|
-
kruskalTest( ( x: number ): number => x, y ); // $ExpectError
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
// The compiler throws an error if the function is provided a last argument which is not a numeric array or options object...
|
|
51
|
-
{
|
|
52
|
-
const x = [ 2.9, 3.0, 2.5, 2.6, 3.2 ];
|
|
53
|
-
kruskalTest( x, true ); // $ExpectError
|
|
54
|
-
kruskalTest( x, false ); // $ExpectError
|
|
55
|
-
kruskalTest( x, null ); // $ExpectError
|
|
56
|
-
kruskalTest( x, 5 ); // $ExpectError
|
|
57
|
-
kruskalTest( x, 'abc' ); // $ExpectError
|
|
58
|
-
kruskalTest( x, ( x: number ): number => x ); // $ExpectError
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
// The compiler throws an error if the function is provided an `alpha` option which is not a number...
|
|
62
|
-
{
|
|
63
|
-
const x = [ 2.9, 3.0, 2.5, 2.6, 3.2 ];
|
|
64
|
-
kruskalTest( x, { 'alpha': 'abc' } ); // $ExpectError
|
|
65
|
-
kruskalTest( x, { 'alpha': '123' } ); // $ExpectError
|
|
66
|
-
kruskalTest( x, { 'alpha': true } ); // $ExpectError
|
|
67
|
-
kruskalTest( x, { 'alpha': false } ); // $ExpectError
|
|
68
|
-
kruskalTest( x, { 'alpha': null } ); // $ExpectError
|
|
69
|
-
kruskalTest( x, { 'alpha': [] } ); // $ExpectError
|
|
70
|
-
kruskalTest( x, { 'alpha': {} } ); // $ExpectError
|
|
71
|
-
kruskalTest( x, { 'alpha': ( x: number ): number => x } ); // $ExpectError
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
// The compiler throws an error if the function is provided a `groups` option which is not an array...
|
|
75
|
-
{
|
|
76
|
-
const x = [ 2.9, 3.0, 2.5, 2.6, 3.2 ];
|
|
77
|
-
kruskalTest( x, { 'groups': 'abc' } ); // $ExpectError
|
|
78
|
-
kruskalTest( x, { 'groups': 123 } ); // $ExpectError
|
|
79
|
-
kruskalTest( x, { 'groups': true } ); // $ExpectError
|
|
80
|
-
kruskalTest( x, { 'groups': false } ); // $ExpectError
|
|
81
|
-
kruskalTest( x, { 'groups': null } ); // $ExpectError
|
|
82
|
-
kruskalTest( x, { 'groups': {} } ); // $ExpectError
|
|
83
|
-
kruskalTest( x, { 'groups': ( x: number ): number => x } ); // $ExpectError
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
// The function does not compile if provided an insufficient number of arguments...
|
|
87
|
-
{
|
|
88
|
-
kruskalTest(); // $ExpectError
|
|
89
|
-
}
|