@stdlib/stats-binomial-test 0.0.7 → 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 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-2022 The Stdlib Authors.
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
  # Binomial Test
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] -->
@@ -280,7 +291,7 @@ See [LICENSE][stdlib-license].
280
291
 
281
292
  ## Copyright
282
293
 
283
- Copyright &copy; 2016-2022. The Stdlib [Authors][stdlib-authors].
294
+ Copyright &copy; 2016-2024. The Stdlib [Authors][stdlib-authors].
284
295
 
285
296
  </section>
286
297
 
@@ -293,8 +304,8 @@ Copyright &copy; 2016-2022. The Stdlib [Authors][stdlib-authors].
293
304
  [npm-image]: http://img.shields.io/npm/v/@stdlib/stats-binomial-test.svg
294
305
  [npm-url]: https://npmjs.org/package/@stdlib/stats-binomial-test
295
306
 
296
- [test-image]: https://github.com/stdlib-js/stats-binomial-test/actions/workflows/test.yml/badge.svg
297
- [test-url]: https://github.com/stdlib-js/stats-binomial-test/actions/workflows/test.yml
307
+ [test-image]: https://github.com/stdlib-js/stats-binomial-test/actions/workflows/test.yml/badge.svg?branch=v0.2.0
308
+ [test-url]: https://github.com/stdlib-js/stats-binomial-test/actions/workflows/test.yml?query=branch:v0.2.0
298
309
 
299
310
  [coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/stats-binomial-test/main.svg
300
311
  [coverage-url]: https://codecov.io/github/stdlib-js/stats-binomial-test?branch=main
@@ -306,19 +317,23 @@ Copyright &copy; 2016-2022. The Stdlib [Authors][stdlib-authors].
306
317
 
307
318
  -->
308
319
 
320
+ [chat-image]: https://img.shields.io/gitter/room/stdlib-js/stdlib.svg
321
+ [chat-url]: https://app.gitter.im/#/room/#stdlib-js_stdlib:gitter.im
322
+
323
+ [stdlib]: https://github.com/stdlib-js/stdlib
324
+
325
+ [stdlib-authors]: https://github.com/stdlib-js/stdlib/graphs/contributors
326
+
309
327
  [umd]: https://github.com/umdjs/umd
310
328
  [es-module]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules
311
329
 
312
330
  [deno-url]: https://github.com/stdlib-js/stats-binomial-test/tree/deno
331
+ [deno-readme]: https://github.com/stdlib-js/stats-binomial-test/blob/deno/README.md
313
332
  [umd-url]: https://github.com/stdlib-js/stats-binomial-test/tree/umd
333
+ [umd-readme]: https://github.com/stdlib-js/stats-binomial-test/blob/umd/README.md
314
334
  [esm-url]: https://github.com/stdlib-js/stats-binomial-test/tree/esm
315
-
316
- [chat-image]: https://img.shields.io/gitter/room/stdlib-js/stdlib.svg
317
- [chat-url]: https://gitter.im/stdlib-js/stdlib/
318
-
319
- [stdlib]: https://github.com/stdlib-js/stdlib
320
-
321
- [stdlib-authors]: https://github.com/stdlib-js/stdlib/graphs/contributors
335
+ [esm-readme]: https://github.com/stdlib-js/stats-binomial-test/blob/esm/README.md
336
+ [branches-url]: https://github.com/stdlib-js/stats-binomial-test/blob/main/branches.md
322
337
 
323
338
  [stdlib-license]: https://raw.githubusercontent.com/stdlib-js/stats-binomial-test/main/LICENSE
324
339
 
package/SECURITY.md ADDED
@@ -0,0 +1,5 @@
1
+ # Security
2
+
3
+ > Policy for reporting security vulnerabilities.
4
+
5
+ See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security).
@@ -0,0 +1,3 @@
1
+ /// <reference path="../docs/types/index.d.ts" />
2
+ import binomialTest from '../docs/types/index';
3
+ export = binomialTest;
package/dist/index.js ADDED
@@ -0,0 +1,9 @@
1
+ "use strict";var w=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var R=w(function($,j){
2
+ var T=require('@stdlib/assert-is-number/dist').isPrimitive,L=require('@stdlib/assert-is-plain-object/dist'),Q=require('@stdlib/assert-is-string/dist').isPrimitive,V=require('@stdlib/assert-is-nan/dist'),q=require('@stdlib/assert-has-own-property/dist'),d=require('@stdlib/error-tools-fmtprodmsg/dist');function S(e,r){return L(r)?q(r,"alpha")&&(e.alpha=r.alpha,!T(e.alpha)||V(e.alpha))?new TypeError(d('1Gx8P',"alpha",e.alpha)):q(r,"alternative")&&(e.alternative=r.alternative,!Q(e.alternative))?new TypeError(d('1Gx2W',"alternative",e.alternative)):q(r,"p")&&(e.p=r.p,!T(e.p)||V(e.p))?new TypeError(d('1Gx8P',"p",e.p)):null:new TypeError(d('1Gx2V',r));}j.exports=S
3
+ });var N=w(function(ee,k){
4
+ var _=require('@stdlib/assert-is-positive-integer/dist'),z=require('@stdlib/assert-is-plain-object/dist'),G=require('@stdlib/assert-is-boolean/dist').isPrimitive,P=require('@stdlib/assert-has-own-property/dist'),g=require('@stdlib/math-base-special-roundn/dist'),E=require('@stdlib/error-tools-fmtprodmsg/dist');function H(e){var r,s,i;if(s=4,r=!0,arguments.length>0){if(!z(e))throw new TypeError(E('1Gx3L',e));if(P(e,"digits")){if(!_(e.digits))throw new TypeError(E('1Gx3P',"digits",e.digits));s=e.digits}if(P(e,"decision")){if(!G(e.decision))throw new TypeError(E('1Gx2o',"decision",e.decision));r=e.decision}}switch(i="",i+=this.method,i+="\n\n",i+="Alternative hypothesis: ",i+="True correlation coefficient is ",this.alternative){case"less":i+="less than ";break;case"greater":i+="greater than ";break;case"two-sided":default:i+="not equal to ";break}return i+=this.nullValue,i+="\n\n",i+=" pValue: "+g(this.pValue,-s)+"\n",i+=" statistic: "+g(this.statistic,-s)+"\n",i+=" "+(1-this.alpha)*100+"% confidence interval: ["+g(this.ci[0],-s)+","+g(this.ci[1],-s)+"]",i+="\n\n",r&&(i+="Test Decision: ",this.rejected?i+="Reject null in favor of alternative at "+this.alpha*100+"% significance level":i+="Fail to reject null in favor of alternative at "+this.alpha*100+"% significance level",i+="\n"),i}k.exports=H
5
+ });var C=w(function(re,B){
6
+ var l=require('@stdlib/utils-define-read-only-property/dist'),J=require('@stdlib/assert-is-number-array/dist'),A=require('@stdlib/assert-is-nonnegative-integer/dist'),D=require('@stdlib/stats-base-dists-beta-quantile/dist'),K=require('@stdlib/math-base-special-floor/dist'),U=require('@stdlib/math-base-special-ceil/dist'),p=require('@stdlib/stats-base-dists-binomial-cdf/dist'),y=require('@stdlib/stats-base-dists-binomial-pmf/dist'),v=require('@stdlib/error-tools-fmtprodmsg/dist'),F=R(),W=N(),x=1+1e-7;function I(e,r,s){return e===0?0:D(s,e,r-e+1)}function M(e,r,s){return e===r?1:D(1-s,e+1,r-e)}function X(){var e,r,s,i,O,h,m,o,b,c,t,n,a,f,u;if(r={},J(arguments[0])){if(a=arguments[0],a.length!==2)throw new Error(v('1Gx9G',a));t=a[1]+a[0],a=a[0],arguments[1]&&(m=F(r,arguments[1]))}else{if(a=arguments[0],t=arguments[1],!A(a))throw new TypeError(v('1Gx9H',a));if(!A(t))throw new TypeError(v('1Gx2K',t));if(a>t)throw new TypeError(v('1Gx9I'));arguments[2]&&(m=F(r,arguments[2]))}if(m)throw m;if(r.alpha===void 0?e=.05:e=r.alpha,e<0||e>1)throw new RangeError(v('1Gx8V',"alpha",e));if(r.p===void 0?n=.5:n=r.p,n<0||n>1)throw new RangeError(v('1Gx9J',"p",n));switch(h=r.alternative||"two-sided",O=a/t,h){case"less":i=p(a,t,n),s=[0,M(a,t,e)];break;case"greater":i=1-p(a-1,t,n),s=[I(a,t,e),1];break;case"two-sided":if(b=y(a,t,n),c=t*n,a===c)i=1;else if(a<c){for(f=0,u=U(c);u<=t;u++)y(u,t,n)<=b*x&&(f+=1);i=p(a,t,n)+(1-p(t-f,t,n))}else{for(f=0,u=0;u<=K(c);u++)y(u,t,n)<=b*x&&(f+=1);i=p(f-1,t,n)+(1-p(a-1,t,n))}s=[I(a,t,e/2),M(a,t,e/2)];break;default:throw new Error(v('1Gx4S',"alternative",["two-sided","less","greater"].join('", "'),h))}return o={},l(o,"rejected",i<=e),l(o,"alpha",e),l(o,"pValue",i),l(o,"statistic",O),l(o,"ci",s),l(o,"nullValue",n),l(o,"alternative",h),l(o,"method","Exact binomial test"),l(o,"print",W),o}B.exports=X
7
+ });var Y=C();module.exports=Y;
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 isNumber = require( '@stdlib/assert-is-number' ).isPrimitive;\nvar isObject = require( '@stdlib/assert-is-plain-object' );\nvar isString = require( '@stdlib/assert-is-string' ).isPrimitive;\nvar isnan = require( '@stdlib/assert-is-nan' );\nvar hasOwnProp = require( '@stdlib/assert-has-own-property' );\nvar format = require( '@stdlib/string-format' );\n\n\n// MAIN //\n\n/**\n* Validates function options.\n*\n* @private\n* @param {Object} opts - destination for validated options\n* @param {Options} options - function options\n* @param {number} [options.alpha] - significance level\n* @param {string} [options.alternative] - alternative hypothesis (`two-sided`, `less` or `greater`)\n* @param {number} [options.p] - probability under H0\n* @returns {(null|Error)} null or an error\n*/\nfunction validate( opts, options ) {\n\tif ( !isObject( options ) ) {\n\t\treturn new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );\n\t}\n\tif ( hasOwnProp( options, 'alpha' ) ) {\n\t\topts.alpha = options.alpha;\n\t\tif ( !isNumber( opts.alpha ) || isnan( opts.alpha ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a number. Option: `%s`.', 'alpha', opts.alpha ) );\n\t\t}\n\t}\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\tif ( hasOwnProp( options, 'p' ) ) {\n\t\topts.p = options.p;\n\t\tif ( !isNumber( opts.p ) || isnan( opts.p ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a number. Option: `%s`.', 'p', opts.p ) );\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\tstr = '';\n\tstr += this.method;\n\tstr += '\\n\\n';\n\tstr += 'Alternative hypothesis: ';\n\tstr += 'True correlation coefficient is ';\n\tswitch ( this.alternative ) {\n\tcase 'less':\n\t\tstr += 'less than ';\n\t\tbreak;\n\tcase 'greater':\n\t\tstr += 'greater than ';\n\t\tbreak;\n\tcase 'two-sided':\n\tdefault:\n\t\tstr += 'not equal to ';\n\t\tbreak;\n\t}\n\tstr += this.nullValue;\n\tstr += '\\n\\n';\n\tstr += ' pValue: ' + roundn( this.pValue, -dgts ) + '\\n';\n\tstr += ' statistic: ' + roundn( this.statistic, -dgts ) + '\\n';\n\tstr += ' ' + ((1.0-this.alpha)*100) + '% confidence interval: [' +\n\t\troundn( this.ci[0], -dgts ) +\n\t\t',' +\n\t\troundn( this.ci[1], -dgts ) +\n\t']';\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 setReadOnly = require( '@stdlib/utils-define-read-only-property' );\nvar isNumberArray = require( '@stdlib/assert-is-number-array' );\nvar isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' );\nvar betaQuantile = require( '@stdlib/stats-base-dists-beta-quantile' );\nvar floor = require( '@stdlib/math-base-special-floor' );\nvar ceil = require( '@stdlib/math-base-special-ceil' );\nvar binomialCDF = require( '@stdlib/stats-base-dists-binomial-cdf' );\nvar binomialPMF = require( '@stdlib/stats-base-dists-binomial-pmf' );\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// VARIABLES //\n\nvar RELATIVE_ERROR = 1+1e-07;\n\n\n// FUNCTIONS //\n\n/**\n* Calculates the lower endpoint of a confidence interval.\n*\n* @private\n* @param {NonNegativeInteger} x - number of successes\n* @param {NonNegativeInteger} n - total number of observations\n* @param {number} alpha - significance level\n* @returns {number} lower endpoint\n*/\nfunction lower( x, n, alpha ) {\n\treturn ( x === 0 ) ? 0 : betaQuantile( alpha, x, n - x + 1 );\n}\n\n/**\n* Calculates the upper endpoint of a confidence interval.\n*\n* @private\n* @param {NonNegativeInteger} x - number of successes\n* @param {NonNegativeInteger} n - total number of observations\n* @param {number} alpha - significance level\n* @returns {number} upper endpoint\n*/\nfunction upper( x, n, alpha ) {\n\treturn ( x === n ) ? 1 : betaQuantile( 1 - alpha, x + 1, n - x );\n}\n\n\n// MAIN //\n\n/**\n* Computes an exact test for the success probability in a Bernoulli experiment.\n*\n* @param {(NonNegativeInteger|Array)} x - number of successes or two-element array with successes and failures\n* @param {NonNegativeInteger} [n] - total number of observations\n* @param {Options} [options] - function options\n* @param {number} [options.alpha=0.05] - significance level\n* @param {string} [options.alternative='two-sided'] - alternative hypothesis (`two-sided`, `less` or `greater`)\n* @param {Probability} [options.p=0.5] - success probability under H0\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* @throws {TypeError} alternative option has to be a string\n* @throws {Error} alternative option must be `two-sided`, `less` or `greater`\n* @returns {Object} test results\n*/\nfunction binomialTest() {\n\tvar alpha;\n\tvar opts;\n\tvar cint;\n\tvar pval;\n\tvar stat;\n\tvar alt;\n\tvar err;\n\tvar out;\n\tvar d;\n\tvar m;\n\tvar n;\n\tvar p;\n\tvar x;\n\tvar y;\n\tvar i;\n\n\topts = {};\n\tif ( isNumberArray( arguments[ 0 ] ) ) {\n\t\tx = arguments[ 0 ];\n\t\tif ( x.length !== 2 ) {\n\t\t\tthrow new Error( format( 'invalid argument. An array argument must contain two elements. Value: `%s`.', x ) );\n\t\t}\n\t\tn = x[ 1 ] + x[ 0 ];\n\t\tx = x[ 0 ];\n\t\tif ( arguments[ 1 ] ) {\n\t\t\terr = validate( opts, arguments[ 1 ] );\n\t\t}\n\t} else {\n\t\tx = arguments[ 0 ];\n\t\tn = arguments[ 1 ];\n\t\tif ( !isNonNegativeInteger( x ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Must provide a nonnegative integer or a two-element array. Value: `%s`.', x ) );\n\t\t}\n\t\tif ( !isNonNegativeInteger( n ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Must provide a nonnegative integer. Value: `%s`.', n ) );\n\t\t}\n\t\tif ( x > n ) {\n\t\t\tthrow new TypeError( format( 'invalid arguments. Number of successes cannot be larger than the total number of observations. x: `%u`. n: `%u`.' ) );\n\t\t}\n\t\tif ( arguments[ 2 ] ) {\n\t\t\terr = validate( opts, arguments[ 2 ] );\n\t\t}\n\t}\n\tif ( err ) {\n\t\tthrow err;\n\t}\n\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` option must be a number on the interval: [0, 1]. Option: `%f`.', 'alpha', alpha ) );\n\t}\n\tif ( opts.p === void 0 ) {\n\t\tp = 0.5;\n\t} else {\n\t\tp = opts.p;\n\t}\n\tif ( p < 0.0 || p > 1.0 ) {\n\t\tthrow new RangeError( format( 'invalid option. `%s` option must be a probability. Option: `%f`.', 'p', p ) );\n\t}\n\n\talt = opts.alternative || 'two-sided';\n\tstat = x / n;\n\tswitch ( alt ) {\n\tcase 'less':\n\t\tpval = binomialCDF( x, n, p );\n\t\tcint = [ 0.0, upper( x, n, alpha ) ];\n\t\tbreak;\n\tcase 'greater':\n\t\tpval = 1.0 - binomialCDF( x - 1, n, p );\n\t\tcint = [ lower( x, n, alpha ), 1.0 ];\n\t\tbreak;\n\tcase 'two-sided':\n\t\td = binomialPMF( x, n, p );\n\t\tm = n * p;\n\t\tif ( x === m ) {\n\t\t\tpval = 1;\n\t\t} else if ( x < m ) {\n\t\t\ty = 0;\n\t\t\tfor ( i = ceil( m ); i <= n; i++ ) {\n\t\t\t\tif ( binomialPMF( i, n, p ) <= d * RELATIVE_ERROR ) {\n\t\t\t\t\ty += 1;\n\t\t\t\t}\n\t\t\t}\n\t\t\tpval = binomialCDF(x, n, p) + ( 1 - binomialCDF(n - y, n, p ) );\n\t\t} else {\n\t\t\ty = 0;\n\t\t\tfor ( i = 0; i <= floor( m ); i++ ) {\n\t\t\t\tif ( binomialPMF( i, n, p ) <= d * RELATIVE_ERROR ) {\n\t\t\t\t\ty += 1;\n\t\t\t\t}\n\t\t\t}\n\t\t\tpval = binomialCDF( y-1, n, p ) + ( 1 - binomialCDF( x-1, n, p ) );\n\t\t}\n\t\tcint = [ lower( x, n, alpha/2.0 ), upper( x, n, alpha/2.0 ) ];\n\t\tbreak;\n\tdefault:\n\t\tthrow new Error( format( 'invalid option. `%s` option must be one of the following: \"%s\". Option: `%s`.', 'alternative', [ 'two-sided', 'less', 'greater' ].join( '\", \"' ), alt ) );\n\t}\n\n\tout = {};\n\tsetReadOnly( out, 'rejected', pval <= alpha );\n\tsetReadOnly( out, 'alpha', alpha );\n\tsetReadOnly( out, 'pValue', pval );\n\tsetReadOnly( out, 'statistic', stat );\n\tsetReadOnly( out, 'ci', cint );\n\tsetReadOnly( out, 'nullValue', p );\n\tsetReadOnly( out, 'alternative', alt );\n\tsetReadOnly( out, 'method', 'Exact binomial test' );\n\tsetReadOnly( out, 'print', print );\n\treturn out;\n}\n\n\n// EXPORTS //\n\nmodule.exports = binomialTest;\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 an exact test for the success probability in a Bernoulli experiment.\n*\n* @module @stdlib/stats-binomial-test\n*\n* @example\n* var binomialTest = require( '@stdlib/stats-binomial-test' );\n*\n* var out = binomialTest( 682, 925 );\n* // returns {...}\n*\n* out = binomialTest( 682, 925, {\n* 'p': 0.75,\n* 'alpha': 0.05\n* });\n* // returns {...}\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,S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EAAGa,CAAE,EAChE,CACAR,EAAO,CAAEP,EAAOC,EAAGC,EAAGC,EAAM,CAAI,EAAGC,EAAOH,EAAGC,EAAGC,EAAM,CAAI,CAAE,EAC5D,MACD,QACC,MAAM,IAAI,MAAOP,EAAQ,gFAAiF,cAAe,CAAE,YAAa,OAAQ,SAAU,EAAE,KAAM,MAAO,EAAGc,CAAI,CAAE,CACnL,CAEA,OAAAE,EAAM,CAAC,EACPxB,EAAawB,EAAK,WAAYJ,GAAQL,CAAM,EAC5Cf,EAAawB,EAAK,QAAST,CAAM,EACjCf,EAAawB,EAAK,SAAUJ,CAAK,EACjCpB,EAAawB,EAAK,YAAaH,CAAK,EACpCrB,EAAawB,EAAK,KAAML,CAAK,EAC7BnB,EAAawB,EAAK,YAAaG,CAAE,EACjC3B,EAAawB,EAAK,cAAeF,CAAI,EACrCtB,EAAawB,EAAK,SAAU,qBAAsB,EAClDxB,EAAawB,EAAK,QAASd,CAAM,EAC1Bc,CACR,CAKAzB,EAAO,QAAUkB,ICvKjB,IAAIa,EAAO,IAKX,OAAO,QAAUA",
6
+ "names": ["require_validate", "__commonJSMin", "exports", "module", "isNumber", "isObject", "isString", "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", "setReadOnly", "isNumberArray", "isNonNegativeInteger", "betaQuantile", "floor", "ceil", "binomialCDF", "binomialPMF", "format", "validate", "print", "RELATIVE_ERROR", "lower", "x", "n", "alpha", "upper", "binomialTest", "opts", "cint", "pval", "stat", "alt", "err", "out", "d", "m", "p", "y", "i", "main"]
7
+ }
@@ -16,7 +16,7 @@
16
16
  * limitations under the License.
17
17
  */
18
18
 
19
- // TypeScript Version: 2.0
19
+ // TypeScript Version: 4.1
20
20
 
21
21
  /**
22
22
  * A [successes, failures] tuple.
package/lib/index.js CHANGED
@@ -38,9 +38,9 @@
38
38
 
39
39
  // MODULES //
40
40
 
41
- var binomialTest = require( './main.js' );
41
+ var main = require( './main.js' );
42
42
 
43
43
 
44
44
  // EXPORTS //
45
45
 
46
- module.exports = binomialTest;
46
+ module.exports = main;
package/lib/main.js CHANGED
@@ -28,6 +28,7 @@ var floor = require( '@stdlib/math-base-special-floor' );
28
28
  var ceil = require( '@stdlib/math-base-special-ceil' );
29
29
  var binomialCDF = require( '@stdlib/stats-base-dists-binomial-cdf' );
30
30
  var binomialPMF = require( '@stdlib/stats-base-dists-binomial-pmf' );
31
+ var format = require( '@stdlib/string-format' );
31
32
  var validate = require( './validate.js' );
32
33
  var print = require( './print.js' ); // eslint-disable-line stdlib/no-redeclare
33
34
 
@@ -77,10 +78,10 @@ function upper( x, n, alpha ) {
77
78
  * @param {number} [options.alpha=0.05] - significance level
78
79
  * @param {string} [options.alternative='two-sided'] - alternative hypothesis (`two-sided`, `less` or `greater`)
79
80
  * @param {Probability} [options.p=0.5] - success probability under H0
80
- * @throws {TypeError} options has to be simple object
81
+ * @throws {TypeError} options must be an object
81
82
  * @throws {TypeError} must provide valid options
82
83
  * @throws {RangeError} alpha option has to be a number in the interval `[0,1]`
83
- * @throws {TypeError} alternative option has to be a string primitive
84
+ * @throws {TypeError} alternative option has to be a string
84
85
  * @throws {Error} alternative option must be `two-sided`, `less` or `greater`
85
86
  * @returns {Object} test results
86
87
  */
@@ -105,7 +106,7 @@ function binomialTest() {
105
106
  if ( isNumberArray( arguments[ 0 ] ) ) {
106
107
  x = arguments[ 0 ];
107
108
  if ( x.length !== 2 ) {
108
- throw new Error( 'invalid argument. If provided an array, it must have two elements. Value: `' + x + '`.' );
109
+ throw new Error( format( 'invalid argument. An array argument must contain two elements. Value: `%s`.', x ) );
109
110
  }
110
111
  n = x[ 1 ] + x[ 0 ];
111
112
  x = x[ 0 ];
@@ -116,13 +117,13 @@ function binomialTest() {
116
117
  x = arguments[ 0 ];
117
118
  n = arguments[ 1 ];
118
119
  if ( !isNonNegativeInteger( x ) ) {
119
- throw new TypeError( 'invalid argument. Must provide a nonnegative integer or a two-element array. Value: `' + x + '`.' );
120
+ throw new TypeError( format( 'invalid argument. Must provide a nonnegative integer or a two-element array. Value: `%s`.', x ) );
120
121
  }
121
122
  if ( !isNonNegativeInteger( n ) ) {
122
- throw new TypeError( 'invalid argument. Must provide a nonnegative integer. Value: `' + n + '`.' );
123
+ throw new TypeError( format( 'invalid argument. Must provide a nonnegative integer. Value: `%s`.', n ) );
123
124
  }
124
125
  if ( x > n ) {
125
- throw new TypeError( 'invalid arguments. `x` cannot be larger than `n`. `x:' + x + ', n:' + n + '`.' );
126
+ throw new TypeError( format( 'invalid arguments. Number of successes cannot be larger than the total number of observations. x: `%u`. n: `%u`.' ) );
126
127
  }
127
128
  if ( arguments[ 2 ] ) {
128
129
  err = validate( opts, arguments[ 2 ] );
@@ -138,7 +139,7 @@ function binomialTest() {
138
139
  alpha = opts.alpha;
139
140
  }
140
141
  if ( alpha < 0.0 || alpha > 1.0 ) {
141
- throw new RangeError( 'invalid argument. Option `alpha` must be a number in the range 0 to 1. Value: `' + alpha + '`.' );
142
+ throw new RangeError( format( 'invalid option. `%s` option must be a number on the interval: [0, 1]. Option: `%f`.', 'alpha', alpha ) );
142
143
  }
143
144
  if ( opts.p === void 0 ) {
144
145
  p = 0.5;
@@ -146,7 +147,7 @@ function binomialTest() {
146
147
  p = opts.p;
147
148
  }
148
149
  if ( p < 0.0 || p > 1.0 ) {
149
- throw new RangeError( 'invalid argument. Option `p` must be a probability. Value: `' + p + '`.' );
150
+ throw new RangeError( format( 'invalid option. `%s` option must be a probability. Option: `%f`.', 'p', p ) );
150
151
  }
151
152
 
152
153
  alt = opts.alternative || 'two-sided';
@@ -185,7 +186,7 @@ function binomialTest() {
185
186
  cint = [ lower( x, n, alpha/2.0 ), upper( x, n, alpha/2.0 ) ];
186
187
  break;
187
188
  default:
188
- throw new Error( 'Invalid option. `alternative` must be either `two-sided`, `less` or `greater`. Value: `' + alt + '`' );
189
+ throw new Error( format( 'invalid option. `%s` option must be one of the following: "%s". Option: `%s`.', 'alternative', [ 'two-sided', 'less', 'greater' ].join( '", "' ), alt ) );
189
190
  }
190
191
 
191
192
  out = {};
package/lib/print.js CHANGED
@@ -25,6 +25,7 @@ var isObject = require( '@stdlib/assert-is-plain-object' );
25
25
  var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive;
26
26
  var hasOwnProp = require( '@stdlib/assert-has-own-property' );
27
27
  var roundn = require( '@stdlib/math-base-special-roundn' );
28
+ var format = require( '@stdlib/string-format' );
28
29
 
29
30
 
30
31
  // MAIN //
@@ -49,17 +50,17 @@ function print( opts ) { // eslint-disable-line stdlib/no-redeclare
49
50
  decision = true;
50
51
  if ( arguments.length > 0 ) {
51
52
  if ( !isObject( opts ) ) {
52
- throw new TypeError( 'invalid argument. First argument must be an options object. Value: `' + opts + '`.' );
53
+ throw new TypeError( format( 'invalid argument. First argument must be an object. Value: `%s`.', opts ) );
53
54
  }
54
55
  if ( hasOwnProp( opts, 'digits' ) ) {
55
56
  if ( !isPositiveInteger( opts.digits ) ) {
56
- throw new TypeError( 'invalid option. `digits` option must be a positive integer. Option: `' + opts.digits + '`.' );
57
+ throw new TypeError( format( 'invalid option. `%s` option must be a positive integer. Option: `%s`.', 'digits', opts.digits ) );
57
58
  }
58
59
  dgts = opts.digits;
59
60
  }
60
61
  if ( hasOwnProp( opts, 'decision' ) ) {
61
62
  if ( !isBoolean( opts.decision ) ) {
62
- throw new TypeError( 'invalid option. `decision` option must be a boolean primitive. Option: `' + opts.decision + '`.' );
63
+ throw new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'decision', opts.decision ) );
63
64
  }
64
65
  decision = opts.decision;
65
66
  }
package/lib/validate.js CHANGED
@@ -25,6 +25,7 @@ var isObject = require( '@stdlib/assert-is-plain-object' );
25
25
  var isString = require( '@stdlib/assert-is-string' ).isPrimitive;
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 //
@@ -42,24 +43,24 @@ var hasOwnProp = require( '@stdlib/assert-has-own-property' );
42
43
  */
43
44
  function validate( opts, options ) {
44
45
  if ( !isObject( options ) ) {
45
- return new TypeError( 'invalid argument. Options argument must be an object. Value: `' + options + '`.' );
46
+ return new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );
46
47
  }
47
48
  if ( hasOwnProp( options, 'alpha' ) ) {
48
49
  opts.alpha = options.alpha;
49
50
  if ( !isNumber( opts.alpha ) || isnan( opts.alpha ) ) {
50
- return new TypeError( 'invalid option. `alpha` option must be a number primitive. Option: `' + opts.alpha + '`.' );
51
+ return new TypeError( format( 'invalid option. `%s` option must be a number. Option: `%s`.', 'alpha', opts.alpha ) );
51
52
  }
52
53
  }
53
54
  if ( hasOwnProp( options, 'alternative' ) ) {
54
55
  opts.alternative = options.alternative;
55
56
  if ( !isString( opts.alternative ) ) {
56
- return new TypeError( 'invalid option. `alternative` option must be a string primitive. Option: `' + opts.alternative + '`.' );
57
+ return new TypeError( format( 'invalid option. `%s` option must be a string. Option: `%s`.', 'alternative', opts.alternative ) );
57
58
  }
58
59
  }
59
60
  if ( hasOwnProp( options, 'p' ) ) {
60
61
  opts.p = options.p;
61
62
  if ( !isNumber( opts.p ) || isnan( opts.p ) ) {
62
- return new TypeError( 'invalid option. `p` option must be a number primitive. Option: `' + opts.p + '`.' );
63
+ return new TypeError( format( 'invalid option. `%s` option must be a number. Option: `%s`.', 'p', opts.p ) );
63
64
  }
64
65
  }
65
66
  return null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stdlib/stats-binomial-test",
3
- "version": "0.0.7",
3
+ "version": "0.2.0",
4
4
  "description": "Exact test for the success probability in a Bernoulli experiment.",
5
5
  "license": "Apache-2.0",
6
6
  "author": {
@@ -37,33 +37,36 @@
37
37
  "url": "https://github.com/stdlib-js/stdlib/issues"
38
38
  },
39
39
  "dependencies": {
40
- "@stdlib/assert-has-own-property": "^0.0.x",
41
- "@stdlib/assert-is-boolean": "^0.0.x",
42
- "@stdlib/assert-is-nan": "^0.0.x",
43
- "@stdlib/assert-is-nonnegative-integer": "^0.0.x",
44
- "@stdlib/assert-is-number": "^0.0.x",
45
- "@stdlib/assert-is-number-array": "^0.0.x",
46
- "@stdlib/assert-is-plain-object": "^0.0.x",
47
- "@stdlib/assert-is-positive-integer": "^0.0.x",
48
- "@stdlib/assert-is-string": "^0.0.x",
49
- "@stdlib/math-base-special-ceil": "^0.0.x",
50
- "@stdlib/math-base-special-floor": "^0.0.x",
51
- "@stdlib/math-base-special-roundn": "^0.0.x",
52
- "@stdlib/stats-base-dists-beta-quantile": "^0.0.x",
53
- "@stdlib/stats-base-dists-binomial-cdf": "^0.0.x",
54
- "@stdlib/stats-base-dists-binomial-pmf": "^0.0.x",
55
- "@stdlib/utils-define-read-only-property": "^0.0.x"
40
+ "@stdlib/assert-has-own-property": "^0.2.0",
41
+ "@stdlib/assert-is-boolean": "^0.2.0",
42
+ "@stdlib/assert-is-nan": "^0.2.0",
43
+ "@stdlib/assert-is-nonnegative-integer": "^0.2.0",
44
+ "@stdlib/assert-is-number": "^0.2.0",
45
+ "@stdlib/assert-is-number-array": "^0.2.0",
46
+ "@stdlib/assert-is-plain-object": "^0.2.0",
47
+ "@stdlib/assert-is-positive-integer": "^0.2.0",
48
+ "@stdlib/assert-is-string": "^0.2.0",
49
+ "@stdlib/math-base-special-ceil": "^0.2.0",
50
+ "@stdlib/math-base-special-floor": "^0.2.0",
51
+ "@stdlib/math-base-special-roundn": "^0.2.0",
52
+ "@stdlib/stats-base-dists-beta-quantile": "^0.2.0",
53
+ "@stdlib/stats-base-dists-binomial-cdf": "^0.2.0",
54
+ "@stdlib/stats-base-dists-binomial-pmf": "^0.2.0",
55
+ "@stdlib/string-format": "^0.2.0",
56
+ "@stdlib/utils-define-read-only-property": "^0.2.0",
57
+ "@stdlib/error-tools-fmtprodmsg": "^0.2.0"
56
58
  },
57
59
  "devDependencies": {
58
- "@stdlib/assert-contains": "^0.0.x",
59
- "@stdlib/assert-is-object": "^0.0.x",
60
- "@stdlib/bench": "^0.0.x",
61
- "@stdlib/constants-float64-eps": "^0.0.x",
62
- "@stdlib/math-base-special-abs": "^0.0.x",
63
- "@stdlib/random-base-discrete-uniform": "^0.0.x",
60
+ "@stdlib/assert-contains": "^0.2.0",
61
+ "@stdlib/assert-is-object": "^0.2.0",
62
+ "@stdlib/constants-float64-eps": "^0.2.0",
63
+ "@stdlib/math-base-special-abs": "^0.2.0",
64
+ "@stdlib/random-base-discrete-uniform": "^0.1.0",
64
65
  "tape": "git+https://github.com/kgryte/tape.git#fix/globby",
65
66
  "istanbul": "^0.4.1",
66
- "tap-spec": "5.x.x"
67
+ "tap-min": "git+https://github.com/Planeshifter/tap-min.git",
68
+ "@stdlib/bench-harness": "^0.2.0",
69
+ "@stdlib/bench": "^0.3.1"
67
70
  },
68
71
  "engines": {
69
72
  "node": ">=0.10.0",
@@ -96,7 +99,7 @@
96
99
  "probability"
97
100
  ],
98
101
  "funding": {
99
- "type": "patreon",
100
- "url": "https://www.patreon.com/athan"
102
+ "type": "opencollective",
103
+ "url": "https://opencollective.com/stdlib"
101
104
  }
102
105
  }
package/docs/repl.txt DELETED
@@ -1,92 +0,0 @@
1
-
2
- {{alias}}( x[, n][, options] )
3
- Computes an exact test for the success probability in a Bernoulli
4
- experiment.
5
-
6
- The returned object comes with a `.print()` method which when invoked will
7
- print a formatted output of the results of the hypothesis test.
8
-
9
- Parameters
10
- ----------
11
- x: (number|Array<number>)
12
- Number of successes or two-element array with successes and failures.
13
-
14
- n: Array<number> (optional)
15
- Total number of observations.
16
-
17
- options: Object (optional)
18
- Options.
19
-
20
- options.alpha: number (optional)
21
- Number in the interval `[0,1]` giving the significance level of the
22
- hypothesis test. Default: `0.05`.
23
-
24
- options.alternative: string (optional)
25
- Indicates whether the alternative hypothesis is that the mean of `x` is
26
- larger than `mu` (`greater`), smaller than `mu` (`less`) or equal to
27
- `mu` (`two-sided`). Default: `'two-sided'`.
28
-
29
- options.p: number (optional)
30
- Hypothesized probability under the null hypothesis. Default: `0.5`.
31
-
32
- Returns
33
- -------
34
- out: Object
35
- Test result object.
36
-
37
- out.alpha: number
38
- Used significance level.
39
-
40
- out.rejected: boolean
41
- Test decision.
42
-
43
- out.pValue: number
44
- p-value of the test.
45
-
46
- out.statistic: number
47
- Sample proportion.
48
-
49
- out.ci: Array<number>
50
- 1-alpha confidence interval for the success probability.
51
-
52
- out.nullValue: number
53
- Assumed success probability under H0.
54
-
55
- out.alternative: string
56
- Alternative hypothesis (`two-sided`, `less` or `greater`).
57
-
58
- out.method: string
59
- Name of test.
60
-
61
- out.print: Function
62
- Function to print formatted output.
63
-
64
- Examples
65
- --------
66
- > var out = {{alias}}( 682, 925 )
67
- {
68
- 'pValue': ~3.544e-49,
69
- 'statistic': ~0.737
70
- // ...
71
- }
72
-
73
- > out = {{alias}}( [ 682, 925 - 682 ] )
74
- {
75
- 'pValue': ~3.544e-49,
76
- 'statistic': ~0.737
77
- // ...
78
- }
79
-
80
- > out = {{alias}}( 21, 40, {
81
- ... 'p': 0.4,
82
- ... 'alternative': 'greater'
83
- ... })
84
- {
85
- 'pValue': ~0.074,
86
- 'statistic': 0.525
87
- // ...
88
- }
89
-
90
- See Also
91
- --------
92
-
@@ -1,116 +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 binomialTest = require( './index' );
20
-
21
-
22
- // TESTS //
23
-
24
- // The function returns a test result object...
25
- {
26
- binomialTest( 682, 925 ); // $ExpectType Results
27
- binomialTest( [ 682, 243 ] ); // $ExpectType Results
28
- binomialTest( 682, 925, { 'alpha': 0.1 } ); // $ExpectType Results
29
- binomialTest( [ 682, 243 ], { 'p': 0.75 } ); // $ExpectType Results
30
- }
31
-
32
- // The function does not compile if provided a first argument that is neither a number nor a two-element number array...
33
- {
34
- binomialTest( 'abc' ); // $ExpectError
35
- binomialTest( true ); // $ExpectError
36
- binomialTest( false ); // $ExpectError
37
- binomialTest( null ); // $ExpectError
38
- binomialTest( undefined ); // $ExpectError
39
- binomialTest( {} ); // $ExpectError
40
- binomialTest( [] ); // $ExpectError
41
- binomialTest( [ 100, 150, 100 ] ); // $ExpectError
42
- binomialTest( ( x: number ): number => x ); // $ExpectError
43
- }
44
-
45
- // The function does not compile if provided a first argument that is a number and a second argument that is not a number...
46
- {
47
- binomialTest( 682, 'abc' ); // $ExpectError
48
- binomialTest( 682, true ); // $ExpectError
49
- binomialTest( 682, false ); // $ExpectError
50
- binomialTest( 682, null ); // $ExpectError
51
- binomialTest( 682, undefined ); // $ExpectError
52
- binomialTest( 682, [] ); // $ExpectError
53
- binomialTest( 682, {} ); // $ExpectError
54
- binomialTest( 682, ( x: number ): number => x ); // $ExpectError
55
- }
56
-
57
- // The compiler throws an error if the function is provided a last argument which is not an options object...
58
- {
59
- binomialTest( 682, 925, true ); // $ExpectError
60
- binomialTest( 682, 925, false ); // $ExpectError
61
- binomialTest( 682, 925, null ); // $ExpectError
62
- binomialTest( 682, 925, 5 ); // $ExpectError
63
- binomialTest( 682, 925, 'abc' ); // $ExpectError
64
- binomialTest( 682, 925, [] ); // $ExpectError
65
- binomialTest( 682, 925, ( x: number ): number => x ); // $ExpectError
66
-
67
- binomialTest( [ 682, 243 ], true ); // $ExpectError
68
- binomialTest( [ 682, 243 ], false ); // $ExpectError
69
- binomialTest( [ 682, 243 ], null ); // $ExpectError
70
- binomialTest( [ 682, 243 ], 5 ); // $ExpectError
71
- binomialTest( [ 682, 243 ], 'abc' ); // $ExpectError
72
- binomialTest( [ 682, 243 ], [] ); // $ExpectError
73
- binomialTest( [ 682, 243 ], ( x: number ): number => x ); // $ExpectError
74
- }
75
-
76
- // The compiler throws an error if the function is provided a `alpha` option which is not a number...
77
- {
78
- binomialTest( 682, 925, { 'alpha': 'abc' } ); // $ExpectError
79
- binomialTest( 682, 925, { 'alpha': '123' } ); // $ExpectError
80
- binomialTest( 682, 925, { 'alpha': true } ); // $ExpectError
81
- binomialTest( 682, 925, { 'alpha': false } ); // $ExpectError
82
- binomialTest( 682, 925, { 'alpha': null } ); // $ExpectError
83
- binomialTest( 682, 925, { 'alpha': [] } ); // $ExpectError
84
- binomialTest( 682, 925, { 'alpha': {} } ); // $ExpectError
85
- binomialTest( 682, 925, { 'alpha': ( x: number ): number => x } ); // $ExpectError
86
- }
87
-
88
- // The compiler throws an error if the function is provided an `alternative` option which is not a recognized alternative...
89
- {
90
- binomialTest( 682, 925, { 'alternative': 'abc' } ); // $ExpectError
91
- binomialTest( 682, 925, { 'alternative': 123 } ); // $ExpectError
92
- binomialTest( 682, 925, { 'alternative': true } ); // $ExpectError
93
- binomialTest( 682, 925, { 'alternative': false } ); // $ExpectError
94
- binomialTest( 682, 925, { 'alternative': null } ); // $ExpectError
95
- binomialTest( 682, 925, { 'alternative': [] } ); // $ExpectError
96
- binomialTest( 682, 925, { 'alternative': {} } ); // $ExpectError
97
- binomialTest( 682, 925, { 'alternative': ( x: number ): number => x } ); // $ExpectError
98
- }
99
-
100
- // The compiler throws an error if the function is provided a `p` option which is not a number...
101
- {
102
- binomialTest( 682, 925, { 'p': 'abc' } ); // $ExpectError
103
- binomialTest( 682, 925, { 'p': '123' } ); // $ExpectError
104
- binomialTest( 682, 925, { 'p': true } ); // $ExpectError
105
- binomialTest( 682, 925, { 'p': false } ); // $ExpectError
106
- binomialTest( 682, 925, { 'p': null } ); // $ExpectError
107
- binomialTest( 682, 925, { 'p': [] } ); // $ExpectError
108
- binomialTest( 682, 925, { 'p': {} } ); // $ExpectError
109
- binomialTest( 682, 925, { 'p': ( x: number ): number => x } ); // $ExpectError
110
- }
111
-
112
- // The function does not compile if provided an invalid number of arguments...
113
- {
114
- binomialTest(); // $ExpectError
115
- binomialTest( 682, 925, {}, {} ); // $ExpectError
116
- }