@stdlib/stats-incr-mgrubbs 0.0.6 → 0.2.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/LICENSE +0 -304
- package/NOTICE +1 -1
- package/README.md +34 -19
- package/SECURITY.md +5 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +14 -0
- package/dist/index.js.map +7 -0
- package/docs/types/index.d.ts +2 -2
- package/lib/defaults.js +45 -0
- package/lib/main.js +8 -8
- package/lib/validate.js +5 -4
- package/package.json +36 -34
- package/docs/repl.txt +0 -81
- package/docs/types/test.ts +0 -103
- package/lib/defaults.json +0 -6
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-2024 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
|
# incrmgrubbs
|
|
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] -->
|
|
@@ -38,7 +49,7 @@ For a window of size `W`, the [Grubbs' test][grubbs-test] statistic for a two-si
|
|
|
38
49
|
<div class="equation" align="center" data-raw-text="G = \frac{\max_{i=0,\ldots,W-1} |Y_i - \bar{Y}|}{s}" data-equation="eq:grubbs_test_statistic">
|
|
39
50
|
<img src="https://cdn.jsdelivr.net/gh/stdlib-js/stdlib@d157db87026794d6fab579039be09a8916cad4e0/lib/node_modules/@stdlib/stats/incr/mgrubbs/docs/img/equation_grubbs_test_statistic.svg" alt="Grubbs' test statistic.">
|
|
40
51
|
<br>
|
|
41
|
-
</div>
|
|
52
|
+
</div> -->
|
|
42
53
|
|
|
43
54
|
<!-- </equation> -->
|
|
44
55
|
|
|
@@ -48,10 +59,10 @@ The [Grubbs' test][grubbs-test] statistic for the alternative hypothesis that th
|
|
|
48
59
|
|
|
49
60
|
<!-- <equation class="equation" label="eq:grubbs_test_statistic_min" align="center" raw="G = \frac{\bar{Y} - Y_{\textrm{min}}}{s}" alt="Grubbs' test statistic for testing whether the minimum value is an outlier."> -->
|
|
50
61
|
|
|
51
|
-
<div class="equation" align="center" data-raw-text="G = \frac{\bar{Y} - Y_{\textrm{min}}}{s}" data-equation="eq:grubbs_test_statistic_min">
|
|
62
|
+
<!-- <div class="equation" align="center" data-raw-text="G = \frac{\bar{Y} - Y_{\textrm{min}}}{s}" data-equation="eq:grubbs_test_statistic_min">
|
|
52
63
|
<img src="https://cdn.jsdelivr.net/gh/stdlib-js/stdlib@d157db87026794d6fab579039be09a8916cad4e0/lib/node_modules/@stdlib/stats/incr/mgrubbs/docs/img/equation_grubbs_test_statistic_min.svg" alt="Grubbs' test statistic for testing whether the minimum value is an outlier.">
|
|
53
64
|
<br>
|
|
54
|
-
</div>
|
|
65
|
+
</div> -->
|
|
55
66
|
|
|
56
67
|
<!-- </equation> -->
|
|
57
68
|
|
|
@@ -59,10 +70,10 @@ The [Grubbs' test][grubbs-test] statistic for the alternative hypothesis that th
|
|
|
59
70
|
|
|
60
71
|
<!-- <equation class="equation" label="eq:grubbs_test_statistic_max" align="center" raw="G = \frac{Y_{\textrm{max}} - \bar{Y}}{s}" alt="Grubbs' test statistic for testing whether the maximum value is an outlier."> -->
|
|
61
72
|
|
|
62
|
-
<div class="equation" align="center" data-raw-text="G = \frac{Y_{\textrm{max}} - \bar{Y}}{s}" data-equation="eq:grubbs_test_statistic_max">
|
|
73
|
+
<!-- <div class="equation" align="center" data-raw-text="G = \frac{Y_{\textrm{max}} - \bar{Y}}{s}" data-equation="eq:grubbs_test_statistic_max">
|
|
63
74
|
<img src="https://cdn.jsdelivr.net/gh/stdlib-js/stdlib@d157db87026794d6fab579039be09a8916cad4e0/lib/node_modules/@stdlib/stats/incr/mgrubbs/docs/img/equation_grubbs_test_statistic_max.svg" alt="Grubbs' test statistic for testing whether the maximum value is an outlier.">
|
|
64
75
|
<br>
|
|
65
|
-
</div>
|
|
76
|
+
</div> -->
|
|
66
77
|
|
|
67
78
|
<!-- </equation> -->
|
|
68
79
|
|
|
@@ -70,10 +81,10 @@ For a two-sided test, the hypothesis that a dataset does **not** contain an outl
|
|
|
70
81
|
|
|
71
82
|
<!-- <equation class="equation" label="eq:grubbs_test_two_sided" align="center" raw="G > \frac{W-1}{\sqrt{W}} \sqrt{\frac{t^2_{\alpha/(2W),W-2}}{W - 2 + t^2_{\alpha/(2W),W-2}}}" alt="Two-sided Grubbs' test."> -->
|
|
72
83
|
|
|
73
|
-
<div class="equation" align="center" data-raw-text="G > \frac{W-1}{\sqrt{W}} \sqrt{\frac{t^2_{\alpha/(2W),W-2}}{W - 2 + t^2_{\alpha/(2W),W-2}}}" data-equation="eq:grubbs_test_two_sided">
|
|
84
|
+
<!-- <div class="equation" align="center" data-raw-text="G > \frac{W-1}{\sqrt{W}} \sqrt{\frac{t^2_{\alpha/(2W),W-2}}{W - 2 + t^2_{\alpha/(2W),W-2}}}" data-equation="eq:grubbs_test_two_sided">
|
|
74
85
|
<img src="https://cdn.jsdelivr.net/gh/stdlib-js/stdlib@d157db87026794d6fab579039be09a8916cad4e0/lib/node_modules/@stdlib/stats/incr/mgrubbs/docs/img/equation_grubbs_test_two_sided.svg" alt="Two-sided Grubbs' test.">
|
|
75
86
|
<br>
|
|
76
|
-
</div>
|
|
87
|
+
</div> -->
|
|
77
88
|
|
|
78
89
|
<!-- </equation> -->
|
|
79
90
|
|
|
@@ -83,7 +94,7 @@ For a one-sided test, the hypothesis that a dataset does **not** contain an outl
|
|
|
83
94
|
|
|
84
95
|
<!-- <equation class="equation" label="eq:grubbs_test_one_sided" align="center" raw="G > \frac{W-1}{\sqrt{W}} \sqrt{\frac{t^2_{\alpha/W,W-2}}{W - 2 + t^2_{\alpha/W,W-2}}}" alt="One-sided Grubbs' test."> -->
|
|
85
96
|
|
|
86
|
-
<div class="equation" align="center" data-raw-text="G > \frac{W-1}{\sqrt{W}} \sqrt{\frac{t^2_{\alpha/W,W-2}}{W - 2 + t^2_{\alpha/W,W-2}}}" data-equation="eq:grubbs_test_one_sided">
|
|
97
|
+
<!-- <div class="equation" align="center" data-raw-text="G > \frac{W-1}{\sqrt{W}} \sqrt{\frac{t^2_{\alpha/W,W-2}}{W - 2 + t^2_{\alpha/W,W-2}}}" data-equation="eq:grubbs_test_one_sided">
|
|
87
98
|
<img src="https://cdn.jsdelivr.net/gh/stdlib-js/stdlib@d157db87026794d6fab579039be09a8916cad4e0/lib/node_modules/@stdlib/stats/incr/mgrubbs/docs/img/equation_grubbs_test_one_sided.svg" alt="One-sided Grubbs' test.">
|
|
88
99
|
<br>
|
|
89
100
|
</div>
|
|
@@ -263,7 +274,7 @@ for ( i = 0; i < data.length; i++ ) {
|
|
|
263
274
|
|
|
264
275
|
## See Also
|
|
265
276
|
|
|
266
|
-
- <span class="package-name">[`@stdlib/stats
|
|
277
|
+
- <span class="package-name">[`@stdlib/stats-incr/grubbs`][@stdlib/stats/incr/grubbs]</span><span class="delimiter">: </span><span class="description">grubbs' test for outliers.</span>
|
|
267
278
|
|
|
268
279
|
</section>
|
|
269
280
|
|
|
@@ -295,7 +306,7 @@ See [LICENSE][stdlib-license].
|
|
|
295
306
|
|
|
296
307
|
## Copyright
|
|
297
308
|
|
|
298
|
-
Copyright © 2016-
|
|
309
|
+
Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors].
|
|
299
310
|
|
|
300
311
|
</section>
|
|
301
312
|
|
|
@@ -308,8 +319,8 @@ Copyright © 2016-2022. The Stdlib [Authors][stdlib-authors].
|
|
|
308
319
|
[npm-image]: http://img.shields.io/npm/v/@stdlib/stats-incr-mgrubbs.svg
|
|
309
320
|
[npm-url]: https://npmjs.org/package/@stdlib/stats-incr-mgrubbs
|
|
310
321
|
|
|
311
|
-
[test-image]: https://github.com/stdlib-js/stats-incr-mgrubbs/actions/workflows/test.yml/badge.svg
|
|
312
|
-
[test-url]: https://github.com/stdlib-js/stats-incr-mgrubbs/actions/workflows/test.yml
|
|
322
|
+
[test-image]: https://github.com/stdlib-js/stats-incr-mgrubbs/actions/workflows/test.yml/badge.svg?branch=v0.2.0
|
|
323
|
+
[test-url]: https://github.com/stdlib-js/stats-incr-mgrubbs/actions/workflows/test.yml?query=branch:v0.2.0
|
|
313
324
|
|
|
314
325
|
[coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/stats-incr-mgrubbs/main.svg
|
|
315
326
|
[coverage-url]: https://codecov.io/github/stdlib-js/stats-incr-mgrubbs?branch=main
|
|
@@ -321,19 +332,23 @@ Copyright © 2016-2022. The Stdlib [Authors][stdlib-authors].
|
|
|
321
332
|
|
|
322
333
|
-->
|
|
323
334
|
|
|
335
|
+
[chat-image]: https://img.shields.io/gitter/room/stdlib-js/stdlib.svg
|
|
336
|
+
[chat-url]: https://app.gitter.im/#/room/#stdlib-js_stdlib:gitter.im
|
|
337
|
+
|
|
338
|
+
[stdlib]: https://github.com/stdlib-js/stdlib
|
|
339
|
+
|
|
340
|
+
[stdlib-authors]: https://github.com/stdlib-js/stdlib/graphs/contributors
|
|
341
|
+
|
|
324
342
|
[umd]: https://github.com/umdjs/umd
|
|
325
343
|
[es-module]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules
|
|
326
344
|
|
|
327
345
|
[deno-url]: https://github.com/stdlib-js/stats-incr-mgrubbs/tree/deno
|
|
346
|
+
[deno-readme]: https://github.com/stdlib-js/stats-incr-mgrubbs/blob/deno/README.md
|
|
328
347
|
[umd-url]: https://github.com/stdlib-js/stats-incr-mgrubbs/tree/umd
|
|
348
|
+
[umd-readme]: https://github.com/stdlib-js/stats-incr-mgrubbs/blob/umd/README.md
|
|
329
349
|
[esm-url]: https://github.com/stdlib-js/stats-incr-mgrubbs/tree/esm
|
|
330
|
-
|
|
331
|
-
[
|
|
332
|
-
[chat-url]: https://gitter.im/stdlib-js/stdlib/
|
|
333
|
-
|
|
334
|
-
[stdlib]: https://github.com/stdlib-js/stdlib
|
|
335
|
-
|
|
336
|
-
[stdlib-authors]: https://github.com/stdlib-js/stdlib/graphs/contributors
|
|
350
|
+
[esm-readme]: https://github.com/stdlib-js/stats-incr-mgrubbs/blob/esm/README.md
|
|
351
|
+
[branches-url]: https://github.com/stdlib-js/stats-incr-mgrubbs/blob/main/branches.md
|
|
337
352
|
|
|
338
353
|
[stdlib-license]: https://raw.githubusercontent.com/stdlib-js/stats-incr-mgrubbs/main/LICENSE
|
|
339
354
|
|
package/SECURITY.md
ADDED
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";var O=function(e,l){return function(){return l||e((l={exports:{}}).exports,l),l.exports}};var M=O(function(Oe,V){
|
|
2
|
+
var R=require('@stdlib/assert-has-own-property/dist'),x=require('@stdlib/assert-is-plain-object/dist'),W=require('@stdlib/assert-is-number/dist').isPrimitive,ee=require('@stdlib/assert-is-string/dist').isPrimitive,E=require('@stdlib/error-tools-fmtprodmsg/dist'),re=require('@stdlib/assert-is-nan/dist');function ie(e,l){if(!x(l))return new TypeError(E('1Hz2V',l));if(R(l,"alpha")){if(e.alpha=l.alpha,!W(e.alpha)||re(e.alpha))return new TypeError(E('1Hz8P',"alpha",e.alpha));if(e.alpha<0||e.alpha>1)return new RangeError(E('1HzDZ',"alpha",e.alpha));}return R(l,"alternative")&&(e.alternative=l.alternative,!ee(e.alternative))?new TypeError(E('1Hz2W',"alternative",e.alternative)):null;}V.exports=ie
|
|
3
|
+
});var A=O(function(Te,F){
|
|
4
|
+
function ae(){return{alpha:.05,alternative:"two-sided",digits:4,decision:!0}}F.exports=ae
|
|
5
|
+
});var S=O(function(be,I){
|
|
6
|
+
var P=require('@stdlib/math-base-assert-is-positive-zero/dist'),T=require('@stdlib/math-base-assert-is-negative-zero/dist'),k=require('@stdlib/math-base-assert-is-nan/dist'),te=require('@stdlib/constants-float64-pinf/dist'),ne=require('@stdlib/constants-float64-ninf/dist');function se(e,l,a){var t,r,f;return t=te,r=ne,f=0,u;function u(i,s){var n,m,v;if(k(i))f=l,t=i,r=i;else if(f<l)f+=1,(i<t||i===t&&T(i))&&(t=i),(i>r||i===r&&P(i))&&(r=i);else if(a[s]===t&&i>t||a[s]===r&&i<r||k(a[s])){for(t=i,r=i,v=0;v<l;v++)if(v!==s){if(m=a[v],k(m)){t=m,r=m;break}(m<t||m===t&&T(m))&&(t=m),(m>r||m===r&&P(m))&&(r=m)}}else if(i<t)t=i;else if(i>r)r=i;else if(i===0){if(n=T(i),i===t)if(a[s]===t&&T(a[s])&&n===!1){for(t=i,v=0;v<l;v++)if(v!==s&&T(a[v])){t=a[v];break}}else n&&(t=i);if(i===r)if(a[s]===r&&P(a[s])&&n){for(r=i,v=0;v<l;v++)if(v!==s&&P(a[v])){r=a[v];break}}else n===!1&&(r=i)}return e[0]=t,e[1]=r,e}}I.exports=se
|
|
7
|
+
});var G=O(function(ye,D){
|
|
8
|
+
var j=require('@stdlib/math-base-assert-is-nan/dist'),z=require('@stdlib/math-base-special-sqrt/dist');function le(e,l,a){var t,r,f,u,i,s,n,m;return m=l-1,f=0,u=0,n=0,v;function v(c,p){var d,h;if(j(c))n=l,u=NaN,f=NaN;else{if(n<l)return n+=1,t=c-u,u+=t/n,f+=t*(c-u),e[0]=u,n===1?e[1]=0:e[1]=z(f/(n-1)),e;if(n===1)return u=c,f=0,e[0]=c,e[1]=0,e;if(j(a[p])){for(n=1,u=c,f=0,d=0;d<l;d++)if(d!==p){if(h=a[d],j(h)){n=l,u=NaN,f=NaN;break}n+=1,t=h-u,u+=t/n,f+=t*(h-u)}}else j(f)===!1&&(r=a[p],t=c-r,i=r-u,u+=t/l,s=c-u,f+=t*(i+s))}return e[0]=u,e[1]=z(f/m),e}}D.exports=le
|
|
9
|
+
});var H=O(function(Ee,C){
|
|
10
|
+
var Z=require('@stdlib/assert-has-own-property/dist'),ve=require('@stdlib/assert-is-plain-object/dist'),B=require('@stdlib/assert-is-positive-integer/dist').isPrimitive,ue=require('@stdlib/assert-is-boolean/dist').isPrimitive,w=require('@stdlib/utils-define-read-only-property/dist'),N=require('@stdlib/utils-define-read-only-accessor/dist'),fe=require('@stdlib/math-base-special-max/dist'),me=require('@stdlib/math-base-special-sqrt/dist'),Q=require('@stdlib/math-base-special-roundn/dist'),b=require('@stdlib/error-tools-fmtprodmsg/dist'),oe=require('@stdlib/stats-base-dists-t-quantile/dist'),ce=require('@stdlib/array-float64/dist'),de=M(),ge=A(),he=S(),pe=G();function qe(e){var l,a,t,r,f,u,i,s,n,m,v,c,p,d,h;if(!B(e))throw new TypeError(b('1Hz9b',e));if(e<3)throw new RangeError(b('1Hz9c',e));if(r=ge(),arguments.length>1&&(f=de(r,arguments[1]),f))throw f;return u=new ce(e),c=e-2,v=0,d=0,p=0,h=-1,r.alternative==="min"||r.alternative==="max"?i=r.alpha/e:i=r.alpha/(2*e),m=oe(1-i,c),v=(e-1)*m/me(e*(c+m*m)),s=[0,0],t=he(s,e,u),n=[0,0],l=pe(n,e,u),a={},N(a,"rejected",K),w(a,"alpha",r.alpha),w(a,"criticalValue",v),N(a,"statistic",L),w(a,"df",c),N(a,"mean",U),N(a,"sd",X),N(a,"min",Y),N(a,"max",_),w(a,"alt",r.alternative),w(a,"method","Grubbs' Test"),w(a,"print",$),J;function J(g){var q;return arguments.length===0?p<e?null:a:(p+=1,h=(h+1)%e,l(g,h),t(g,h),u[h]=g,p<e?null:(r.alternative==="min"?d=(n[0]-s[0])/n[1]:r.alternative==="max"?d=(s[1]-n[0])/n[1]:(q=fe(n[0]-s[0],s[1]-n[0]),d=q/n[1]),a))}function K(){return d>v}function L(){return d}function U(){return n[0]}function X(){return n[1]}function Y(){return s[0]}function _(){return s[1]}function $(g){var q,y,o;if(y=r.digits,q=r.decision,arguments.length>0){if(!ve(g))throw new TypeError(b('1Hz47',g));if(Z(g,"digits")){if(!B(g.digits))throw new TypeError(b('1Hz3P',"digits",g.digits));y=g.digits}if(Z(g,"decision")){if(!ue(g.decision))throw new TypeError(b('1Hz2o',"decision",g.decision));q=g.decision}}return o="",o+=a.method,o+="\n\n",o+="Alternative hypothesis: ",r.alternative==="max"?o+="The maximum value ("+s[1]+") is an outlier":r.alternative==="min"?o+="The minimum value ("+s[0]+") is an outlier":(o+="The ",n[0]-s[0]>s[1]-n[0]?o+="minimum value ("+s[0]+")":o+="maximum value ("+s[1]+")",o+=" is an outlier"),o+="\n\n",o+=" criticalValue: "+Q(v,-y)+"\n",o+=" statistic: "+Q(d,-y)+"\n",o+=" df: "+c+"\n",o+="\n",q&&(o+="Test Decision: ",d>v?o+="Reject null in favor of alternative at "+r.alpha*100+"% significance level":o+="Fail to reject null in favor of alternative at "+r.alpha*100+"% significance level",o+="\n"),o}}C.exports=qe
|
|
11
|
+
});var we=H();module.exports=we;
|
|
12
|
+
/** @license Apache-2.0 */
|
|
13
|
+
/** @license Apache-2.0 */
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../lib/validate.js", "../lib/defaults.js", "../lib/minmax.js", "../lib/meanstdev.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 hasOwnProp = require( '@stdlib/assert-has-own-property' );\nvar isObject = require( '@stdlib/assert-is-plain-object' );\nvar isNumber = require( '@stdlib/assert-is-number' ).isPrimitive;\nvar isString = require( '@stdlib/assert-is-string' ).isPrimitive;\nvar format = require( '@stdlib/string-format' );\nvar isnan = require( '@stdlib/assert-is-nan' );\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\n* @returns {(null|Error)} null or an error\n*\n* @example\n* var opts = {};\n*\n* var options = {\n* 'alpha': 0.05,\n* 'alernative': 'two-sided'\n* };\n*\n* var err = validate( opts, options );\n* if ( err ) {\n* throw err;\n* }\n*/\nfunction validate( opts, options ) {\n\tif ( !isObject( options ) ) {\n\t\treturn new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );\n\t}\n\tif ( hasOwnProp( options, 'alpha' ) ) {\n\t\topts.alpha = options.alpha;\n\t\tif ( !isNumber( opts.alpha ) || isnan( opts.alpha ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a number. Option: `%s`.', 'alpha', opts.alpha ) );\n\t\t}\n\t\tif ( opts.alpha < 0.0 || opts.alpha > 1.0 ) {\n\t\t\treturn new RangeError( format( 'invalid option. `%s` option must be 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}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nmodule.exports = validate;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Returns default options.\n*\n* @private\n* @returns {Object} default options\n*\n* @example\n* var o = defaults();\n* // returns {...}\n*/\nfunction defaults() {\n\treturn {\n\t\t'alpha': 0.05,\n\t\t'alternative': 'two-sided',\n\t\t'digits': 4,\n\t\t'decision': true\n\t};\n}\n\n\n// EXPORTS //\n\nmodule.exports = defaults;\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 isPositiveZero = require( '@stdlib/math-base-assert-is-positive-zero' );\nvar isNegativeZero = require( '@stdlib/math-base-assert-is-negative-zero' );\nvar isnan = require( '@stdlib/math-base-assert-is-nan' );\nvar PINF = require( '@stdlib/constants-float64-pinf' );\nvar NINF = require( '@stdlib/constants-float64-ninf' );\n\n\n// MAIN //\n\n/**\n* Returns an accumulator function which incrementally computes moving minimum and maximum values.\n*\n* @private\n* @param {Collection} out - output array\n* @param {PositiveInteger} W - window size\n* @param {Collection} buf - data buffer\n* @returns {Function} accumulator function\n*\n* @example\n* var buf = [ 0.0, 0.0, 0.0 ];\n*\n* var accumulator = incrmminmax( [ 0.0, 0.0 ], 3, buf );\n*\n* var mm = accumulator( 2.0, 0 );\n* // returns [ 2.0, 2.0 ]\n*\n* buf[ 0 ] = 2.0;\n*\n* mm = accumulator( -5.0, 1 );\n* // returns [ -5.0, 2.0 ]\n*\n* buf[ 1 ] = -5.0;\n*\n* mm = accumulator( 3.0, 2 );\n* // returns [ -5.0, 3.0 ]\n*\n* buf[ 2 ] = 3.0;\n*\n* mm = accumulator( 5.0, 0 );\n* // returns [ -5.0, 5.0 ]\n*\n* buf[ 0 ] = 5.0;\n*/\nfunction incrmminmax( out, W, buf ) {\n\tvar min;\n\tvar max;\n\tvar N;\n\n\tmin = PINF;\n\tmax = NINF;\n\tN = 0;\n\n\treturn accumulator;\n\n\t/**\n\t* Updates accumulator state.\n\t*\n\t* @private\n\t* @param {number} x - input value\n\t* @param {NonNegativeInteger} i - buffer index\n\t* @returns {Collection} output array\n\t*/\n\tfunction accumulator( x, i ) {\n\t\tvar sgn;\n\t\tvar v;\n\t\tvar k;\n\n\t\t// Case: incoming value is NaN...\n\t\tif ( isnan( x ) ) {\n\t\t\tN = W; // explicitly set to avoid `N < W` branch\n\t\t\tmin = x;\n\t\t\tmax = x;\n\t\t}\n\t\t// Case: initial window...\n\t\telse if ( N < W ) {\n\t\t\tN += 1;\n\t\t\tif ( x < min || ( x === min && isNegativeZero( x ) ) ) {\n\t\t\t\tmin = x;\n\t\t\t}\n\t\t\tif ( x > max || ( x === max && isPositiveZero( x ) ) ) {\n\t\t\t\tmax = x;\n\t\t\t}\n\t\t}\n\t\t// Case: outgoing value is the current minimum or maximum and the new value is either greater than the minimum or less than the maximum, and, thus, we need to find new accumulated values among the current buffer values...\n\t\telse if (\n\t\t\t( buf[ i ] === min && x > min ) ||\n\t\t\t( buf[ i ] === max && x < max ) ||\n\t\t\tisnan( buf[ i ] )\n\t\t) {\n\t\t\tmin = x;\n\t\t\tmax = x;\n\t\t\tfor ( k = 0; k < W; k++ ) {\n\t\t\t\tif ( k !== i ) {\n\t\t\t\t\tv = buf[ k ];\n\t\t\t\t\tif ( isnan( v ) ) {\n\t\t\t\t\t\tmin = v;\n\t\t\t\t\t\tmax = v;\n\t\t\t\t\t\tbreak; // no need to continue searching\n\t\t\t\t\t}\n\t\t\t\t\tif ( v < min || ( v === min && isNegativeZero( v ) ) ) {\n\t\t\t\t\t\tmin = v;\n\t\t\t\t\t}\n\t\t\t\t\tif ( v > max || ( v === max && isPositiveZero( v ) ) ) {\n\t\t\t\t\t\tmax = v;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t// Case: incoming value is less than current minimum value...\n\t\telse if ( x < min ) {\n\t\t\tmin = x;\n\t\t}\n\t\t// Case: incoming value is greater than current maximum value...\n\t\telse if ( x > max ) {\n\t\t\tmax = x;\n\t\t}\n\t\t// Case: incoming value is zero, which means we need to be careful and correctly handle signed zeros...\n\t\telse if ( x === 0.0 ) {\n\t\t\tsgn = isNegativeZero( x );\n\t\t\tif ( x === min ) {\n\t\t\t\t// Case: outgoing value is the current minimum...\n\t\t\t\tif (\n\t\t\t\t\tbuf[ i ] === min &&\n\t\t\t\t\tisNegativeZero( buf[ i ] ) &&\n\t\t\t\t\tsgn === false\n\t\t\t\t) {\n\t\t\t\t\t// Because the outgoing and incoming are different signs (-,+), we need to search the buffer to see if it contains a negative zero. If so, the minimum value remains negative zero; otherwise, the minimum value is incoming value...\n\t\t\t\t\tmin = x;\n\t\t\t\t\tfor ( k = 0; k < W; k++ ) {\n\t\t\t\t\t\tif ( k !== i && isNegativeZero( buf[ k ] ) ) {\n\t\t\t\t\t\t\tmin = buf[ k ];\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else if ( sgn ) {\n\t\t\t\t\t// Ensure minimum value has the correct sign:\n\t\t\t\t\tmin = x;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( x === max ) {\n\t\t\t\t// Case: outgoing value is the current maximum...\n\t\t\t\tif (\n\t\t\t\t\tbuf[ i ] === max &&\n\t\t\t\t\tisPositiveZero( buf[ i ] ) &&\n\t\t\t\t\tsgn\n\t\t\t\t) {\n\t\t\t\t\t// Because the outgoing and incoming are different signs (+,-), we need to search the buffer to see if it contains a positive zero. If so, the maximum value remains positive zero; otherwise, the maximum value is incoming value...\n\t\t\t\t\tmax = x;\n\t\t\t\t\tfor ( k = 0; k < W; k++ ) {\n\t\t\t\t\t\tif ( k !== i && isPositiveZero( buf[ k ] ) ) {\n\t\t\t\t\t\t\tmax = buf[ k ];\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else if ( sgn === false ) {\n\t\t\t\t\t// Ensure maximum value has the correct sign:\n\t\t\t\t\tmax = x;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t// Case: updating existing window; however, the minimum and maximum values do not change so nothing to do...\n\n\t\tout[ 0 ] = min;\n\t\tout[ 1 ] = max;\n\t\treturn out;\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = incrmminmax;\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 isnan = require( '@stdlib/math-base-assert-is-nan' );\nvar sqrt = require( '@stdlib/math-base-special-sqrt' );\n\n\n// MAIN //\n\n/**\n* Returns an accumulator function which incrementally computes a moving arithmetic mean and corrected sample standard deviation.\n*\n* ## Method\n*\n* - Let \\\\(W\\\\) be a window of \\\\(N\\\\) elements over which we want to compute a corrected sample standard deviation.\n*\n* - We first recognize that the corrected sample standard deviation is defined as the square root of the unbiased sample variance. Accordingly, in order to derive an update equation for the corrected sample standard deviation, deriving an update equation for the unbiased sample variance is sufficient.\n*\n* - The difference between the unbiased sample variance in a window \\\\(W_i\\\\) and the unbiased sample variance in a window \\\\(W_{i+1})\\\\) is given by\n*\n* ```tex\n* \\Delta s^2 = s_{i+1}^2 - s_{i}^2\n* ```\n*\n* - If we multiply both sides by \\\\(N-1\\\\),\n*\n* ```tex\n* (N-1)(\\Delta s^2) = (N-1)s_{i+1}^2 - (N-1)s_{i}^2\n* ```\n*\n* - If we substitute the definition of the unbiased sample variance having the form\n*\n* ```tex\n* \\begin{align*}\n* s^2 &= \\frac{1}{N-1} \\biggl( \\sum_{i=1}^{N} (x_i - \\bar{x})^2 \\biggr) \\\\\n* &= \\frac{1}{N-1} \\biggl( \\sum_{i=1}^{N} (x_i^2 - 2\\bar{x}x_i + \\bar{x}^2) \\biggr) \\\\\n* &= \\frac{1}{N-1} \\biggl( \\sum_{i=1}^{N} x_i^2 - 2\\bar{x} \\sum_{i=1}^{N} x_i + \\sum_{i=1}^{N} \\bar{x}^2) \\biggr) \\\\\n* &= \\frac{1}{N-1} \\biggl( \\sum_{i=1}^{N} x_i^2 - \\frac{2N\\bar{x}\\sum_{i=1}^{N} x_i}{N} + N\\bar{x}^2 \\biggr) \\\\\n* &= \\frac{1}{N-1} \\biggl( \\sum_{i=1}^{N} x_i^2 - 2N\\bar{x}^2 + N\\bar{x}^2 \\biggr) \\\\\n* &= \\frac{1}{N-1} \\biggl( \\sum_{i=1}^{N} x_i^2 - N\\bar{x}^2 \\biggr)\n* \\end{align*}\n* ```\n*\n* we return\n*\n* ```tex\n* (N-1)(\\Delta s^2) = \\biggl(\\sum_{k=1}^N x_k^2 - N\\bar{x}_{i+1}^2 \\biggr) - \\biggl(\\sum_{k=0}^{N-1} x_k^2 - N\\bar{x}_{i}^2 \\biggr)\n* ```\n*\n* - This can be further simplified by recognizing that subtracting the sums reduces to \\\\(x_N^2 - x_0^2\\\\); in which case,\n*\n* ```tex\n* \\begin{align*}\n* (N-1)(\\Delta s^2) &= x_N^2 - x_0^2 - N\\bar{x}_{i+1}^2 + N\\bar{x}_{i}^2 \\\\\n* &= x_N^2 - x_0^2 - N(\\bar{x}_{i+1}^2 - \\bar{x}_{i}^2) \\\\\n* &= x_N^2 - x_0^2 - N(\\bar{x}_{i+1} - \\bar{x}_{i})(\\bar{x}_{i+1} + \\bar{x}_{i})\n* \\end{align*}\n* ```\n*\n* - Recognizing that the difference of means can be expressed\n*\n* ```tex\n* \\bar{x}_{i+1} - \\bar{x}_i = \\frac{1}{N} \\biggl( \\sum_{k=1}^N x_k - \\sum_{k=0}^{N-1} x_k \\biggr) = \\frac{x_N - x_0}{N}\n* ```\n*\n* and substituting into the equation above\n*\n* ```tex\n* (N-1)(\\Delta s^2) = x_N^2 - x_0^2 - (x_N - x_0)(\\bar{x}_{i+1} + \\bar{x}_{i})\n* ```\n*\n* - Rearranging terms gives us the update equation\n*\n* ```tex\n* \\begin{align*}\n* (N-1)(\\Delta s^2) &= (x_N - x_0)(x_N + x_0) - (x_N - x_0)(\\bar{x}_{i+1} + \\bar{x}_{i})\n* &= (x_N - x_0)(x_N + x_0 - \\bar{x}_{i+1} - \\bar{x}_{i}) \\\\\n* &= (x_N - x_0)(x_N - \\bar{x}_{i+1} + x_0 - \\bar{x}_{i})\n* \\end{align*}\n* ```\n*\n* @private\n* @param {Collection} out - output array\n* @param {PositiveInteger} W - window size\n* @param {Collection} buf - data buffer\n* @returns {Function} accumulator function\n*\n* @example\n* var buf = [ 0.0, 0.0, 0.0 ];\n* var accumulator = incrmmeanstdev( [ 0.0, 0.0 ], 3, buf );\n*\n* var v = accumulator( 2.0, 0 );\n* // returns [ 2.0, 0.0 ]\n*\n* buf[ 0 ] = 2.0;\n*\n* v = accumulator( -5.0, 1 );\n* // returns [ -1.5, ~4.95 ]\n*\n* buf[ 1 ] = -5.0;\n*\n* v = accumulator( 3.0, 2 );\n* // returns [ 0.0, ~4.36 ]\n*\n* buf[ 2 ] = 3.0;\n*\n* v = accumulator( 5.0, 0 );\n* // returns [ 1.0, ~5.29 ]\n*\n* buf[ 0 ] = 5.0;\n*/\nfunction incrmmeanstdev( out, W, buf ) {\n\tvar delta;\n\tvar tmp;\n\tvar M2;\n\tvar mu;\n\tvar d1;\n\tvar d2;\n\tvar N;\n\tvar n;\n\n\tn = W - 1;\n\tM2 = 0.0;\n\tmu = 0.0;\n\tN = 0;\n\n\treturn accumulator;\n\n\t/**\n\t* Updates accumulator state.\n\t*\n\t* @private\n\t* @param {number} x - input value\n\t* @param {NonNegativeInteger} i - buffer index\n\t* @returns {ArrayLike} output array\n\t*/\n\tfunction accumulator( x, i ) {\n\t\tvar k;\n\t\tvar v;\n\n\t\t// Case: incoming value is NaN, the sliding second moment is automatically NaN...\n\t\tif ( isnan( x ) ) {\n\t\t\tN = W; // explicitly set to avoid `N < W` branch\n\t\t\tmu = NaN;\n\t\t\tM2 = NaN;\n\t\t}\n\t\t// Case: initial window...\n\t\telse if ( N < W ) {\n\t\t\tN += 1;\n\t\t\tdelta = x - mu;\n\t\t\tmu += delta / N;\n\t\t\tM2 += delta * (x - mu);\n\n\t\t\tout[ 0 ] = mu;\n\t\t\tif ( N === 1 ) {\n\t\t\t\tout[ 1 ] = 0.0;\n\t\t\t} else {\n\t\t\t\tout[ 1 ] = sqrt( M2/(N-1) );\n\t\t\t}\n\t\t\treturn out;\n\t\t}\n\t\t// Case: N = W = 1\n\t\telse if ( N === 1 ) {\n\t\t\tmu = x;\n\t\t\tM2 = 0.0;\n\t\t\tout[ 0 ] = x;\n\t\t\tout[ 1 ] = 0.0;\n\t\t\treturn out;\n\t\t}\n\t\t// Case: outgoing value is NaN, and, thus, we need to compute the accumulated values...\n\t\telse if ( isnan( buf[ i ] ) ) {\n\t\t\tN = 1;\n\t\t\tmu = x;\n\t\t\tM2 = 0.0;\n\t\t\tfor ( k = 0; k < W; k++ ) {\n\t\t\t\tif ( k !== i ) {\n\t\t\t\t\tv = buf[ k ];\n\t\t\t\t\tif ( isnan( v ) ) {\n\t\t\t\t\t\tN = W; // explicitly set to avoid `N < W` branch\n\t\t\t\t\t\tmu = NaN;\n\t\t\t\t\t\tM2 = NaN;\n\t\t\t\t\t\tbreak; // second moment is automatically NaN, so no need to continue\n\t\t\t\t\t}\n\t\t\t\t\tN += 1;\n\t\t\t\t\tdelta = v - mu;\n\t\t\t\t\tmu += delta / N;\n\t\t\t\t\tM2 += delta * (v - mu);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t// Case: neither the current second moment nor the incoming value are NaN, so we need to update the accumulated values...\n\t\telse if ( isnan( M2 ) === false ) {\n\t\t\ttmp = buf[ i ];\n\t\t\tdelta = x - tmp;\n\t\t\td1 = tmp - mu;\n\t\t\tmu += delta / W;\n\t\t\td2 = x - mu;\n\t\t\tM2 += delta * (d1 + d2);\n\t\t}\n\t\t// Case: the current second moment is NaN, so nothing to do until the buffer no longer contains NaN values...\n\n\t\tout[ 0 ] = mu;\n\t\tout[ 1 ] = sqrt( M2/n );\n\t\treturn out;\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = incrmmeanstdev;\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 hasOwnProp = require( '@stdlib/assert-has-own-property' );\nvar isObject = require( '@stdlib/assert-is-plain-object' );\nvar isPositiveInteger = require( '@stdlib/assert-is-positive-integer' ).isPrimitive;\nvar isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive;\nvar setReadOnly = require( '@stdlib/utils-define-read-only-property' );\nvar setReadOnlyAccessor = require( '@stdlib/utils-define-read-only-accessor' );\nvar max = require( '@stdlib/math-base-special-max' );\nvar sqrt = require( '@stdlib/math-base-special-sqrt' );\nvar roundn = require( '@stdlib/math-base-special-roundn' );\nvar format = require( '@stdlib/string-format' );\nvar tQuantile = require( '@stdlib/stats-base-dists-t-quantile' );\nvar Float64Array = require( '@stdlib/array-float64' );\nvar validate = require( './validate.js' );\nvar defaults = require( './defaults.js' );\nvar incrmminmax = require( './minmax.js' );\nvar incrmmeanstdev = require( './meanstdev.js' );\n\n\n// MAIN //\n\n/**\n* Returns an accumulator function which incrementally performs a moving Grubbs' test for detecting outliers.\n*\n* @param {PositiveInteger} W - window size\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', 'min', 'max')\n* @throws {TypeError} first argument must be a positive integer\n* @throws {RangeError} first argument must be greater than or equal to 3\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {RangeError} `alpha` option must be on the interval `[0,1]`\n* @returns {Function} accumulator function\n*\n* @example\n* var rnorm = require( '@stdlib/random-base-normal' );\n*\n* var accumulator;\n* var opts;\n* var i;\n*\n* accumulator = incrmgrubbs( 20, opts );\n*\n* for ( i = 0; i < 200; i++ ) {\n* res = accumulator( rnorm( 10.0, 5.0 ) );\n* }\n*/\nfunction incrmgrubbs( W ) {\n\tvar meanstdev;\n\tvar results;\n\tvar minmax;\n\tvar opts;\n\tvar err;\n\tvar buf;\n\tvar sig;\n\tvar mm;\n\tvar ms;\n\tvar tc;\n\tvar gc;\n\tvar df;\n\tvar N;\n\tvar G;\n\tvar i;\n\n\tif ( !isPositiveInteger( W ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Window size must be a positive integer. Value: `%s`.', W ) );\n\t}\n\tif ( W < 3 ) {\n\t\tthrow new RangeError( format( 'invalid argument. Window size must be greater than or equal to 3. Value: `%s`.', W ) );\n\t}\n\topts = defaults();\n\tif ( arguments.length > 1 ) {\n\t\terr = validate( opts, arguments[ 1 ] );\n\t\tif ( err ) {\n\t\t\tthrow err;\n\t\t}\n\t}\n\tbuf = new Float64Array( W );\n\tdf = W - 2;\n\tgc = 0.0;\n\tG = 0.0;\n\tN = 0;\n\ti = -1;\n\n\t// Compute the critical values:\n\tif ( opts.alternative === 'min' ) {\n\t\tsig = opts.alpha / W;\n\t} else if ( opts.alternative === 'max' ) {\n\t\tsig = opts.alpha / W;\n\t} else { // two-sided\n\t\tsig = opts.alpha / (2*W);\n\t}\n\ttc = tQuantile( 1.0-sig, df );\n\tgc = (W-1)*tc / sqrt( W*(df+(tc*tc)) );\n\n\t// Initialize statistics accumulators:\n\tmm = [ 0.0, 0.0 ];\n\tminmax = incrmminmax( mm, W, buf );\n\n\tms = [ 0.0, 0.0 ];\n\tmeanstdev = incrmmeanstdev( ms, W, buf );\n\n\t// Initialize the results object:\n\tresults = {};\n\tsetReadOnlyAccessor( results, 'rejected', getRejected );\n\tsetReadOnly( results, 'alpha', opts.alpha );\n\tsetReadOnly( results, 'criticalValue', gc );\n\tsetReadOnlyAccessor( results, 'statistic', getStatistic );\n\tsetReadOnly( results, 'df', df );\n\tsetReadOnlyAccessor( results, 'mean', getMean );\n\tsetReadOnlyAccessor( results, 'sd', getStDev );\n\tsetReadOnlyAccessor( results, 'min', getMin );\n\tsetReadOnlyAccessor( results, 'max', getMax );\n\tsetReadOnly( results, 'alt', opts.alternative );\n\tsetReadOnly( results, 'method', 'Grubbs\\' Test' );\n\tsetReadOnly( results, 'print', print );\n\n\treturn accumulator;\n\n\t/**\n\t* If provided a value, the accumulator function returns updated Grubbs' test results. If not provided a value, the accumulator function returns the current Grubbs' test results.\n\t*\n\t* @private\n\t* @param {number} [x] - new value\n\t* @returns {(Object|null)} test results or null\n\t*/\n\tfunction accumulator( x ) {\n\t\tvar md;\n\t\tif ( arguments.length === 0 ) {\n\t\t\tif ( N < W ) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\treturn results;\n\t\t}\n\t\tN += 1;\n\n\t\t// Update the index for managing the circular buffer:\n\t\ti = (i+1) % W;\n\n\t\t// Update model statistics:\n\t\tmeanstdev( x, i );\n\t\tminmax( x, i );\n\n\t\t// Insert the value into the buffer:\n\t\tbuf[ i ] = x;\n\n\t\tif ( N < W ) {\n\t\t\treturn null;\n\t\t}\n\t\t// Compute the test statistic...\n\t\tif ( opts.alternative === 'min' ) {\n\t\t\tG = ( ms[0]-mm[0] ) / ms[ 1 ];\n\t\t} else if ( opts.alternative === 'max' ) {\n\t\t\tG = ( mm[1]-ms[0] ) / ms[ 1 ];\n\t\t} else { // two-sided\n\t\t\tmd = max( ms[0]-mm[0], mm[1]-ms[0] ); // maximum absolute deviation\n\t\t\tG = md / ms[ 1 ];\n\t\t}\n\t\treturn results;\n\t}\n\n\t/**\n\t* Returns a `boolean` indicating whether the null hypothesis should be rejected.\n\t*\n\t* @private\n\t* @returns {boolean} boolean indicating whether the null hypothesis should be rejected\n\t*/\n\tfunction getRejected() {\n\t\treturn ( G > gc );\n\t}\n\n\t/**\n\t* Returns the test statistic.\n\t*\n\t* @private\n\t* @returns {number} test statistic\n\t*/\n\tfunction getStatistic() {\n\t\treturn G;\n\t}\n\n\t/**\n\t* Returns the sample mean.\n\t*\n\t* @private\n\t* @returns {number} sample mean\n\t*/\n\tfunction getMean() {\n\t\treturn ms[ 0 ];\n\t}\n\n\t/**\n\t* Returns the corrected sample standard deviation.\n\t*\n\t* @private\n\t* @returns {number} corrected sample standard deviation\n\t*/\n\tfunction getStDev() {\n\t\treturn ms[ 1 ];\n\t}\n\n\t/**\n\t* Returns the sample minimum.\n\t*\n\t* @private\n\t* @returns {number} sample minimum\n\t*/\n\tfunction getMin() {\n\t\treturn mm[ 0 ];\n\t}\n\n\t/**\n\t* Returns the sample maximum.\n\t*\n\t* @private\n\t* @returns {number} sample maximum\n\t*/\n\tfunction getMax() {\n\t\treturn mm[ 1 ];\n\t}\n\n\t/**\n\t* Pretty-print test results.\n\t*\n\t* @private\n\t* @param {Object} [options] - options object\n\t* @param {PositiveInteger} [options.digits=4] - number of digits after the decimal point\n\t* @param {boolean} [options.decision=true] - boolean indicating whether to print the test decision\n\t* @throws {TypeError} options argument must be an object\n\t* @throws {TypeError} must provide valid options\n\t* @returns {string} formatted output\n\t*/\n\tfunction print( options ) {\n\t\tvar decision;\n\t\tvar digits;\n\t\tvar str;\n\n\t\tdigits = opts.digits;\n\t\tdecision = opts.decision;\n\t\tif ( arguments.length > 0 ) {\n\t\t\tif ( !isObject( options ) ) {\n\t\t\t\tthrow new TypeError( format( 'invalid argument. Must provide an object. Value: `%s`.', options ) );\n\t\t\t}\n\t\t\tif ( hasOwnProp( options, 'digits' ) ) {\n\t\t\t\tif ( !isPositiveInteger( options.digits ) ) {\n\t\t\t\t\tthrow new TypeError( format( 'invalid option. `%s` option must be a positive integer. Option: `%s`.', 'digits', options.digits ) );\n\t\t\t\t}\n\t\t\t\tdigits = options.digits;\n\t\t\t}\n\t\t\tif ( hasOwnProp( options, 'decision' ) ) {\n\t\t\t\tif ( !isBoolean( options.decision ) ) {\n\t\t\t\t\tthrow new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'decision', options.decision ) );\n\t\t\t\t}\n\t\t\t\tdecision = options.decision;\n\t\t\t}\n\t\t}\n\t\tstr = '';\n\t\tstr += results.method;\n\t\tstr += '\\n\\n';\n\t\tstr += 'Alternative hypothesis: ';\n\t\tif ( opts.alternative === 'max' ) {\n\t\t\tstr += 'The maximum value (' + mm[ 1 ] + ') is an outlier';\n\t\t} else if ( opts.alternative === 'min' ) {\n\t\t\tstr += 'The minimum value (' + mm[ 0 ] + ') is an outlier';\n\t\t} else { // two-sided\n\t\t\tstr += 'The ';\n\t\t\tif ( ms[0]-mm[0] > mm[1]-ms[0] ) {\n\t\t\t\tstr += 'minimum value (' + mm[ 0 ] + ')';\n\t\t\t} else {\n\t\t\t\tstr += 'maximum value (' + mm[ 1 ] + ')';\n\t\t\t}\n\t\t\tstr += ' is an outlier';\n\t\t}\n\t\tstr += '\\n\\n';\n\t\tstr += ' criticalValue: ' + roundn( gc, -digits ) + '\\n';\n\t\tstr += ' statistic: ' + roundn( G, -digits ) + '\\n';\n\t\tstr += ' df: ' + df + '\\n';\n\t\tstr += '\\n';\n\t\tif ( decision ) {\n\t\t\tstr += 'Test Decision: ';\n\t\t\tif ( G > gc ) {\n\t\t\t\tstr += 'Reject null in favor of alternative at ' + (opts.alpha*100.0) + '% significance level';\n\t\t\t} else {\n\t\t\t\tstr += 'Fail to reject null in favor of alternative at ' + (opts.alpha*100.0) + '% significance level';\n\t\t\t}\n\t\t\tstr += '\\n';\n\t\t}\n\t\treturn str;\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = incrmgrubbs;\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* Moving Grubbs' test for outliers.\n*\n* @module @stdlib/stats-incr-mgrubbs\n*\n* @example\n* var rnorm = require( '@stdlib/random-base-normal' );\n* var incrmgrubbs = require( '@stdlib/stats-incr-mgrubbs' );\n*\n* var accumulator;\n* var res;\n* var i;\n*\n* accumulator = incrmgrubbs( 20 );\n*\n* for ( i = 0; i < 200; i++ ) {\n* res = accumulator( rnorm( 10.0, 5.0 ) );\n* }\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,EAAa,QAAS,iCAAkC,EACxDC,EAAW,QAAS,gCAAiC,EACrDC,EAAW,QAAS,0BAA2B,EAAE,YACjDC,GAAW,QAAS,0BAA2B,EAAE,YACjDC,EAAS,QAAS,uBAAwB,EAC1CC,GAAQ,QAAS,uBAAwB,EA4B7C,SAASC,GAAUC,EAAMC,EAAU,CAClC,GAAK,CAACP,EAAUO,CAAQ,EACvB,OAAO,IAAI,UAAWJ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,EAAI,IAErCqB,GAAO,kBAAoBrB,EAAI,CAAE,EAAI,IAEtCqB,GAAO,kBAERA,GAAO,OACPA,GAAO,sBAAwBtC,EAAQoB,EAAI,CAACiB,CAAO,EAAI,KACvDC,GAAO,kBAAoBtC,EAAQuB,EAAG,CAACc,CAAO,EAAI,KAClDC,GAAO,WAAajB,EAAK,KACzBiB,GAAO,KACFF,IACJE,GAAO,kBACFf,EAAIH,EACRkB,GAAO,0CAA6CzB,EAAK,MAAM,IAAS,uBAExEyB,GAAO,kDAAqDzB,EAAK,MAAM,IAAS,uBAEjFyB,GAAO,MAEDA,CACR,CACD,CAKA/C,EAAO,QAAUiB,KClRjB,IAAI+B,GAAO,IAKX,OAAO,QAAUA",
|
|
6
|
+
"names": ["require_validate", "__commonJSMin", "exports", "module", "hasOwnProp", "isObject", "isNumber", "isString", "format", "isnan", "validate", "opts", "options", "require_defaults", "__commonJSMin", "exports", "module", "defaults", "require_minmax", "__commonJSMin", "exports", "module", "isPositiveZero", "isNegativeZero", "isnan", "PINF", "NINF", "incrmminmax", "out", "W", "buf", "min", "max", "N", "accumulator", "x", "i", "sgn", "v", "k", "require_meanstdev", "__commonJSMin", "exports", "module", "isnan", "sqrt", "incrmmeanstdev", "out", "W", "buf", "delta", "tmp", "M2", "mu", "d1", "d2", "N", "n", "accumulator", "x", "i", "k", "v", "require_main", "__commonJSMin", "exports", "module", "hasOwnProp", "isObject", "isPositiveInteger", "isBoolean", "setReadOnly", "setReadOnlyAccessor", "max", "sqrt", "roundn", "format", "tQuantile", "Float64Array", "validate", "defaults", "incrmminmax", "incrmmeanstdev", "incrmgrubbs", "W", "meanstdev", "results", "minmax", "opts", "err", "buf", "sig", "mm", "ms", "tc", "gc", "df", "N", "G", "i", "getRejected", "getStatistic", "getMean", "getStDev", "getMin", "getMax", "print", "accumulator", "x", "md", "options", "decision", "digits", "str", "main"]
|
|
7
|
+
}
|
package/docs/types/index.d.ts
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
-
// TypeScript Version:
|
|
19
|
+
// TypeScript Version: 4.1
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
22
|
* Interface defining function options.
|
|
@@ -120,7 +120,7 @@ type accumulator = ( x?: number ) => Results | null;
|
|
|
120
120
|
* @returns accumulator function
|
|
121
121
|
*
|
|
122
122
|
* @example
|
|
123
|
-
* var rnorm = require(
|
|
123
|
+
* var rnorm = require( '@stdlib/random-base-normal' );
|
|
124
124
|
*
|
|
125
125
|
* var accumulator;
|
|
126
126
|
* var opts;
|
package/lib/defaults.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Apache-2.0
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2023 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
|
+
'use strict';
|
|
20
|
+
|
|
21
|
+
// MAIN //
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Returns default options.
|
|
25
|
+
*
|
|
26
|
+
* @private
|
|
27
|
+
* @returns {Object} default options
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* var o = defaults();
|
|
31
|
+
* // returns {...}
|
|
32
|
+
*/
|
|
33
|
+
function defaults() {
|
|
34
|
+
return {
|
|
35
|
+
'alpha': 0.05,
|
|
36
|
+
'alternative': 'two-sided',
|
|
37
|
+
'digits': 4,
|
|
38
|
+
'decision': true
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
// EXPORTS //
|
|
44
|
+
|
|
45
|
+
module.exports = defaults;
|
package/lib/main.js
CHANGED
|
@@ -24,16 +24,16 @@ var hasOwnProp = require( '@stdlib/assert-has-own-property' );
|
|
|
24
24
|
var isObject = require( '@stdlib/assert-is-plain-object' );
|
|
25
25
|
var isPositiveInteger = require( '@stdlib/assert-is-positive-integer' ).isPrimitive;
|
|
26
26
|
var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive;
|
|
27
|
-
var copy = require( '@stdlib/utils-copy' );
|
|
28
27
|
var setReadOnly = require( '@stdlib/utils-define-read-only-property' );
|
|
29
28
|
var setReadOnlyAccessor = require( '@stdlib/utils-define-read-only-accessor' );
|
|
30
29
|
var max = require( '@stdlib/math-base-special-max' );
|
|
31
30
|
var sqrt = require( '@stdlib/math-base-special-sqrt' );
|
|
32
31
|
var roundn = require( '@stdlib/math-base-special-roundn' );
|
|
32
|
+
var format = require( '@stdlib/string-format' );
|
|
33
33
|
var tQuantile = require( '@stdlib/stats-base-dists-t-quantile' );
|
|
34
34
|
var Float64Array = require( '@stdlib/array-float64' );
|
|
35
35
|
var validate = require( './validate.js' );
|
|
36
|
-
var defaults = require( './defaults.
|
|
36
|
+
var defaults = require( './defaults.js' );
|
|
37
37
|
var incrmminmax = require( './minmax.js' );
|
|
38
38
|
var incrmmeanstdev = require( './meanstdev.js' );
|
|
39
39
|
|
|
@@ -85,12 +85,12 @@ function incrmgrubbs( W ) {
|
|
|
85
85
|
var i;
|
|
86
86
|
|
|
87
87
|
if ( !isPositiveInteger( W ) ) {
|
|
88
|
-
throw new TypeError( 'invalid argument. Window size must be a positive integer. Value:
|
|
88
|
+
throw new TypeError( format( 'invalid argument. Window size must be a positive integer. Value: `%s`.', W ) );
|
|
89
89
|
}
|
|
90
90
|
if ( W < 3 ) {
|
|
91
|
-
throw new RangeError( 'invalid argument. Window size must be greater than or equal to 3. Value:
|
|
91
|
+
throw new RangeError( format( 'invalid argument. Window size must be greater than or equal to 3. Value: `%s`.', W ) );
|
|
92
92
|
}
|
|
93
|
-
opts =
|
|
93
|
+
opts = defaults();
|
|
94
94
|
if ( arguments.length > 1 ) {
|
|
95
95
|
err = validate( opts, arguments[ 1 ] );
|
|
96
96
|
if ( err ) {
|
|
@@ -261,17 +261,17 @@ function incrmgrubbs( W ) {
|
|
|
261
261
|
decision = opts.decision;
|
|
262
262
|
if ( arguments.length > 0 ) {
|
|
263
263
|
if ( !isObject( options ) ) {
|
|
264
|
-
throw new TypeError( 'invalid argument. Must provide an object. Value:
|
|
264
|
+
throw new TypeError( format( 'invalid argument. Must provide an object. Value: `%s`.', options ) );
|
|
265
265
|
}
|
|
266
266
|
if ( hasOwnProp( options, 'digits' ) ) {
|
|
267
267
|
if ( !isPositiveInteger( options.digits ) ) {
|
|
268
|
-
throw new TypeError( 'invalid option. `
|
|
268
|
+
throw new TypeError( format( 'invalid option. `%s` option must be a positive integer. Option: `%s`.', 'digits', options.digits ) );
|
|
269
269
|
}
|
|
270
270
|
digits = options.digits;
|
|
271
271
|
}
|
|
272
272
|
if ( hasOwnProp( options, 'decision' ) ) {
|
|
273
273
|
if ( !isBoolean( options.decision ) ) {
|
|
274
|
-
throw new TypeError( 'invalid option. `
|
|
274
|
+
throw new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'decision', options.decision ) );
|
|
275
275
|
}
|
|
276
276
|
decision = options.decision;
|
|
277
277
|
}
|
package/lib/validate.js
CHANGED
|
@@ -24,6 +24,7 @@ var hasOwnProp = require( '@stdlib/assert-has-own-property' );
|
|
|
24
24
|
var isObject = require( '@stdlib/assert-is-plain-object' );
|
|
25
25
|
var isNumber = require( '@stdlib/assert-is-number' ).isPrimitive;
|
|
26
26
|
var isString = require( '@stdlib/assert-is-string' ).isPrimitive;
|
|
27
|
+
var format = require( '@stdlib/string-format' );
|
|
27
28
|
var isnan = require( '@stdlib/assert-is-nan' );
|
|
28
29
|
|
|
29
30
|
|
|
@@ -54,21 +55,21 @@ var isnan = require( '@stdlib/assert-is-nan' );
|
|
|
54
55
|
*/
|
|
55
56
|
function validate( opts, options ) {
|
|
56
57
|
if ( !isObject( options ) ) {
|
|
57
|
-
return new TypeError( 'invalid argument. Options argument must be an object. Value:
|
|
58
|
+
return new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );
|
|
58
59
|
}
|
|
59
60
|
if ( hasOwnProp( options, 'alpha' ) ) {
|
|
60
61
|
opts.alpha = options.alpha;
|
|
61
62
|
if ( !isNumber( opts.alpha ) || isnan( opts.alpha ) ) {
|
|
62
|
-
return new TypeError( 'invalid option. `
|
|
63
|
+
return new TypeError( format( 'invalid option. `%s` option must be a number. Option: `%s`.', 'alpha', opts.alpha ) );
|
|
63
64
|
}
|
|
64
65
|
if ( opts.alpha < 0.0 || opts.alpha > 1.0 ) {
|
|
65
|
-
return new RangeError( 'invalid option. `
|
|
66
|
+
return new RangeError( format( 'invalid option. `%s` option must be on the interval: [0, 1]. Option: `%f`.', 'alpha', opts.alpha ) );
|
|
66
67
|
}
|
|
67
68
|
}
|
|
68
69
|
if ( hasOwnProp( options, 'alternative' ) ) {
|
|
69
70
|
opts.alternative = options.alternative;
|
|
70
71
|
if ( !isString( opts.alternative ) ) {
|
|
71
|
-
return new TypeError( 'invalid option. `
|
|
72
|
+
return new TypeError( format( 'invalid option. `%s` option must be a string. Option: `%s`.', 'alternative', opts.alternative ) );
|
|
72
73
|
}
|
|
73
74
|
}
|
|
74
75
|
return null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stdlib/stats-incr-mgrubbs",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Moving Grubbs' test for outliers.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": {
|
|
@@ -37,41 +37,43 @@
|
|
|
37
37
|
"url": "https://github.com/stdlib-js/stdlib/issues"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@stdlib/array-float64": "^0.0
|
|
41
|
-
"@stdlib/assert-has-own-property": "^0.0
|
|
42
|
-
"@stdlib/assert-is-boolean": "^0.0
|
|
43
|
-
"@stdlib/assert-is-nan": "^0.0
|
|
44
|
-
"@stdlib/assert-is-number": "^0.0
|
|
45
|
-
"@stdlib/assert-is-plain-object": "^0.0
|
|
46
|
-
"@stdlib/assert-is-positive-integer": "^0.0
|
|
47
|
-
"@stdlib/assert-is-string": "^0.0
|
|
48
|
-
"@stdlib/constants-float64-ninf": "^0.0
|
|
49
|
-
"@stdlib/constants-float64-pinf": "^0.0
|
|
50
|
-
"@stdlib/math-base-assert-is-nan": "^0.0
|
|
51
|
-
"@stdlib/math-base-assert-is-negative-zero": "^0.0
|
|
52
|
-
"@stdlib/math-base-assert-is-positive-zero": "^0.0
|
|
53
|
-
"@stdlib/math-base-special-max": "^0.0
|
|
54
|
-
"@stdlib/math-base-special-roundn": "^0.0
|
|
55
|
-
"@stdlib/math-base-special-sqrt": "^0.0
|
|
56
|
-
"@stdlib/stats-base-dists-t-quantile": "^0.0
|
|
57
|
-
"@stdlib/
|
|
58
|
-
"@stdlib/utils-define-read-only-accessor": "^0.0
|
|
59
|
-
"@stdlib/utils-define-read-only-property": "^0.0
|
|
40
|
+
"@stdlib/array-float64": "^0.2.0",
|
|
41
|
+
"@stdlib/assert-has-own-property": "^0.2.0",
|
|
42
|
+
"@stdlib/assert-is-boolean": "^0.2.0",
|
|
43
|
+
"@stdlib/assert-is-nan": "^0.2.0",
|
|
44
|
+
"@stdlib/assert-is-number": "^0.2.0",
|
|
45
|
+
"@stdlib/assert-is-plain-object": "^0.2.0",
|
|
46
|
+
"@stdlib/assert-is-positive-integer": "^0.2.0",
|
|
47
|
+
"@stdlib/assert-is-string": "^0.2.0",
|
|
48
|
+
"@stdlib/constants-float64-ninf": "^0.2.0",
|
|
49
|
+
"@stdlib/constants-float64-pinf": "^0.2.0",
|
|
50
|
+
"@stdlib/math-base-assert-is-nan": "^0.2.0",
|
|
51
|
+
"@stdlib/math-base-assert-is-negative-zero": "^0.2.0",
|
|
52
|
+
"@stdlib/math-base-assert-is-positive-zero": "^0.2.0",
|
|
53
|
+
"@stdlib/math-base-special-max": "^0.2.0",
|
|
54
|
+
"@stdlib/math-base-special-roundn": "^0.2.0",
|
|
55
|
+
"@stdlib/math-base-special-sqrt": "^0.2.0",
|
|
56
|
+
"@stdlib/stats-base-dists-t-quantile": "^0.2.0",
|
|
57
|
+
"@stdlib/string-format": "^0.2.0",
|
|
58
|
+
"@stdlib/utils-define-read-only-accessor": "^0.2.0",
|
|
59
|
+
"@stdlib/utils-define-read-only-property": "^0.2.0",
|
|
60
|
+
"@stdlib/error-tools-fmtprodmsg": "^0.2.0"
|
|
60
61
|
},
|
|
61
62
|
"devDependencies": {
|
|
62
|
-
"@stdlib/assert-is-function": "^0.0
|
|
63
|
-
"@stdlib/
|
|
64
|
-
"@stdlib/datasets-
|
|
65
|
-
"@stdlib/
|
|
66
|
-
"@stdlib/random-base-
|
|
67
|
-
"@stdlib/
|
|
68
|
-
"@stdlib/stats-incr-
|
|
69
|
-
"@stdlib/stats-incr-
|
|
70
|
-
"@stdlib/stats-incr-
|
|
71
|
-
"@stdlib/stats-incr-mstdev": "^0.0.x",
|
|
63
|
+
"@stdlib/assert-is-function": "^0.2.0",
|
|
64
|
+
"@stdlib/datasets-herndon-venus-semidiameters": "^0.2.0",
|
|
65
|
+
"@stdlib/datasets-suthaharan-single-hop-sensor-network": "^0.2.0",
|
|
66
|
+
"@stdlib/random-base-normal": "^0.1.0",
|
|
67
|
+
"@stdlib/random-base-randu": "^0.1.0",
|
|
68
|
+
"@stdlib/stats-incr-mmax": "^0.2.0",
|
|
69
|
+
"@stdlib/stats-incr-mmean": "^0.2.0",
|
|
70
|
+
"@stdlib/stats-incr-mmin": "^0.2.0",
|
|
71
|
+
"@stdlib/stats-incr-mstdev": "^0.2.0",
|
|
72
72
|
"tape": "git+https://github.com/kgryte/tape.git#fix/globby",
|
|
73
73
|
"istanbul": "^0.4.1",
|
|
74
|
-
"tap-
|
|
74
|
+
"tap-min": "git+https://github.com/Planeshifter/tap-min.git",
|
|
75
|
+
"@stdlib/bench-harness": "^0.2.0",
|
|
76
|
+
"@stdlib/bench": "^0.3.1"
|
|
75
77
|
},
|
|
76
78
|
"engines": {
|
|
77
79
|
"node": ">=0.10.0",
|
|
@@ -120,7 +122,7 @@
|
|
|
120
122
|
"moving"
|
|
121
123
|
],
|
|
122
124
|
"funding": {
|
|
123
|
-
"type": "
|
|
124
|
-
"url": "https://
|
|
125
|
+
"type": "opencollective",
|
|
126
|
+
"url": "https://opencollective.com/stdlib"
|
|
125
127
|
}
|
|
126
128
|
}
|
package/docs/repl.txt
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
{{alias}}( W[, options] )
|
|
3
|
-
Returns an accumulator function which incrementally performs a moving
|
|
4
|
-
Grubbs' test for detecting outliers.
|
|
5
|
-
|
|
6
|
-
Grubbs' test assumes that data is normally distributed. Accordingly, one
|
|
7
|
-
should first verify that the data can be reasonably approximated by a normal
|
|
8
|
-
distribution before applying the Grubbs' test.
|
|
9
|
-
|
|
10
|
-
The `W` parameter defines the number of values over which to perform Grubbs'
|
|
11
|
-
test. The minimum window size is 3.
|
|
12
|
-
|
|
13
|
-
If provided a value, the accumulator function returns updated test results.
|
|
14
|
-
If not provided a value, the accumulator function returns the current test
|
|
15
|
-
results.
|
|
16
|
-
|
|
17
|
-
Until provided `W` values, the accumulator function returns `null`.
|
|
18
|
-
|
|
19
|
-
The accumulator function returns an object having the following fields:
|
|
20
|
-
|
|
21
|
-
- rejected: boolean indicating whether the null hypothesis should be
|
|
22
|
-
rejected.
|
|
23
|
-
- alpha: significance level.
|
|
24
|
-
- criticalValue: critical value.
|
|
25
|
-
- statistic: test statistic.
|
|
26
|
-
- df: degrees of freedom.
|
|
27
|
-
- mean: sample mean.
|
|
28
|
-
- sd: corrected sample standard deviation.
|
|
29
|
-
- min: minimum value.
|
|
30
|
-
- max: maximum value.
|
|
31
|
-
- alt: alternative hypothesis.
|
|
32
|
-
- method: method name.
|
|
33
|
-
- print: method for pretty-printing test output.
|
|
34
|
-
|
|
35
|
-
Parameters
|
|
36
|
-
----------
|
|
37
|
-
W: integer
|
|
38
|
-
Window size.
|
|
39
|
-
|
|
40
|
-
options: Object (optional)
|
|
41
|
-
Function options.
|
|
42
|
-
|
|
43
|
-
options.alpha: number (optional)
|
|
44
|
-
Significance level. Default: 0.05.
|
|
45
|
-
|
|
46
|
-
options.alternative: string (optional)
|
|
47
|
-
Alternative hypothesis. The option may be one of the following values:
|
|
48
|
-
|
|
49
|
-
- 'two-sided': test whether the minimum or maximum value is an outlier.
|
|
50
|
-
- 'min': test whether the minimum value is an outlier.
|
|
51
|
-
- 'max': test whether the maximum value is an outlier.
|
|
52
|
-
|
|
53
|
-
Default: 'two-sided'.
|
|
54
|
-
|
|
55
|
-
Returns
|
|
56
|
-
-------
|
|
57
|
-
acc: Function
|
|
58
|
-
Accumulator function.
|
|
59
|
-
|
|
60
|
-
Examples
|
|
61
|
-
--------
|
|
62
|
-
> var acc = {{alias}}( 20 );
|
|
63
|
-
> var res = acc()
|
|
64
|
-
null
|
|
65
|
-
> for ( var i = 0; i < 200; i++ ) {
|
|
66
|
-
... res = acc( {{alias:@stdlib/random/base/normal}}( 10.0, 5.0 ) );
|
|
67
|
-
... };
|
|
68
|
-
> res.print()
|
|
69
|
-
|
|
70
|
-
References
|
|
71
|
-
----------
|
|
72
|
-
- Grubbs, Frank E. 1950. "Sample Criteria for Testing Outlying
|
|
73
|
-
Observations." _The Annals of Mathematical Statistics_ 21 (1). The Institute
|
|
74
|
-
of Mathematical Statistics: 27–58. doi:10.1214/aoms/1177729885.
|
|
75
|
-
- Grubbs, Frank E. 1969. "Procedures for Detecting Outlying Observations in
|
|
76
|
-
Samples." _Technometrics_ 11 (1). Taylor & Francis: 1–21. doi:10.1080/
|
|
77
|
-
00401706.1969.10490657.
|
|
78
|
-
|
|
79
|
-
See Also
|
|
80
|
-
--------
|
|
81
|
-
|
package/docs/types/test.ts
DELETED
|
@@ -1,103 +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 incrmgrubbs = require( './index' );
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
// TESTS //
|
|
23
|
-
|
|
24
|
-
// The function returns an accumulator function...
|
|
25
|
-
{
|
|
26
|
-
incrmgrubbs( 20 ); // $ExpectType accumulator
|
|
27
|
-
incrmgrubbs( 20, { 'alpha': 0.1 } ); // $ExpectType accumulator
|
|
28
|
-
incrmgrubbs( 20, { 'alternative': 'max' } ); // $ExpectType accumulator
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
// The compiler throws an error if the function is provided a first argument that is not a number...
|
|
32
|
-
{
|
|
33
|
-
incrmgrubbs( 'abc' ); // $ExpectError
|
|
34
|
-
incrmgrubbs( true ); // $ExpectError
|
|
35
|
-
incrmgrubbs( false ); // $ExpectError
|
|
36
|
-
incrmgrubbs( null ); // $ExpectError
|
|
37
|
-
incrmgrubbs( undefined ); // $ExpectError
|
|
38
|
-
incrmgrubbs( [] ); // $ExpectError
|
|
39
|
-
incrmgrubbs( {} ); // $ExpectError
|
|
40
|
-
incrmgrubbs( ( x: number ): number => x ); // $ExpectError
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
// The compiler throws an error if the function is provided a second argument which is not an options object...
|
|
44
|
-
{
|
|
45
|
-
incrmgrubbs( 20, '5' ); // $ExpectError
|
|
46
|
-
incrmgrubbs( 20, 5 ); // $ExpectError
|
|
47
|
-
incrmgrubbs( 20, true ); // $ExpectError
|
|
48
|
-
incrmgrubbs( 20, false ); // $ExpectError
|
|
49
|
-
incrmgrubbs( 20, null ); // $ExpectError
|
|
50
|
-
incrmgrubbs( 20, [] ); // $ExpectError
|
|
51
|
-
incrmgrubbs( 20, ( x: number ): number => x ); // $ExpectError
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
// The compiler throws an error if the function is provided an `alpha` option which is not a number...
|
|
55
|
-
{
|
|
56
|
-
incrmgrubbs( 20, { 'alpha': 'abc' } ); // $ExpectError
|
|
57
|
-
incrmgrubbs( 20, { 'alpha': '123' } ); // $ExpectError
|
|
58
|
-
incrmgrubbs( 20, { 'alpha': true } ); // $ExpectError
|
|
59
|
-
incrmgrubbs( 20, { 'alpha': false } ); // $ExpectError
|
|
60
|
-
incrmgrubbs( 20, { 'alpha': null } ); // $ExpectError
|
|
61
|
-
incrmgrubbs( 20, { 'alpha': [] } ); // $ExpectError
|
|
62
|
-
incrmgrubbs( 20, { 'alpha': {} } ); // $ExpectError
|
|
63
|
-
incrmgrubbs( 20, { 'alpha': ( x: number ): number => x } ); // $ExpectError
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
// The compiler throws an error if the function is provided an `alternative` option which is not a recognized alternative...
|
|
67
|
-
{
|
|
68
|
-
incrmgrubbs( 20, { 'alternative': 'abc' } ); // $ExpectError
|
|
69
|
-
incrmgrubbs( 20, { 'alternative': 123 } ); // $ExpectError
|
|
70
|
-
incrmgrubbs( 20, { 'alternative': true } ); // $ExpectError
|
|
71
|
-
incrmgrubbs( 20, { 'alternative': false } ); // $ExpectError
|
|
72
|
-
incrmgrubbs( 20, { 'alternative': null } ); // $ExpectError
|
|
73
|
-
incrmgrubbs( 20, { 'alternative': [] } ); // $ExpectError
|
|
74
|
-
incrmgrubbs( 20, { 'alternative': {} } ); // $ExpectError
|
|
75
|
-
incrmgrubbs( 20, { 'alternative': ( x: number ): number => x } ); // $ExpectError
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
// The compiler throws an error if the function is provided an invalid number of arguments...
|
|
79
|
-
{
|
|
80
|
-
incrmgrubbs(); // $ExpectError
|
|
81
|
-
incrmgrubbs( 3, {}, {} ); // $ExpectError
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
// The function returns an accumulator function which returns an accumulated result...
|
|
85
|
-
{
|
|
86
|
-
const acc = incrmgrubbs( 5 );
|
|
87
|
-
|
|
88
|
-
acc(); // $ExpectType Results | null
|
|
89
|
-
acc( 3.14 ); // $ExpectType Results | null
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
// The compiler throws an error if the returned accumulator function is provided invalid arguments...
|
|
93
|
-
{
|
|
94
|
-
const acc = incrmgrubbs( 5 );
|
|
95
|
-
|
|
96
|
-
acc( 'abc' ); // $ExpectError
|
|
97
|
-
acc( true ); // $ExpectError
|
|
98
|
-
acc( false ); // $ExpectError
|
|
99
|
-
acc( null ); // $ExpectError
|
|
100
|
-
acc( [] ); // $ExpectError
|
|
101
|
-
acc( {} ); // $ExpectError
|
|
102
|
-
acc( ( x: number ): number => x ); // $ExpectError
|
|
103
|
-
}
|