@stdlib/stats-base-dists-binomial-mode 0.0.8 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CITATION.cff +30 -0
- package/NOTICE +1 -1
- package/README.md +15 -4
- package/dist/index.d.ts +3 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +7 -0
- package/docs/types/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/package.json +13 -13
- package/docs/repl.txt +0 -40
- package/docs/types/test.ts +0 -53
- /package/lib/{mode.js → main.js} +0 -0
package/CITATION.cff
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
cff-version: 1.2.0
|
|
2
|
+
title: stdlib
|
|
3
|
+
message: >-
|
|
4
|
+
If you use this software, please cite it using the
|
|
5
|
+
metadata from this file.
|
|
6
|
+
|
|
7
|
+
type: software
|
|
8
|
+
|
|
9
|
+
authors:
|
|
10
|
+
- name: The Stdlib Authors
|
|
11
|
+
url: https://github.com/stdlib-js/stdlib/graphs/contributors
|
|
12
|
+
|
|
13
|
+
repository-code: https://github.com/stdlib-js/stdlib
|
|
14
|
+
url: https://stdlib.io
|
|
15
|
+
|
|
16
|
+
abstract: |
|
|
17
|
+
Standard library for JavaScript and Node.js.
|
|
18
|
+
|
|
19
|
+
keywords:
|
|
20
|
+
- JavaScript
|
|
21
|
+
- Node.js
|
|
22
|
+
- TypeScript
|
|
23
|
+
- standard library
|
|
24
|
+
- scientific computing
|
|
25
|
+
- numerical computing
|
|
26
|
+
- statistical computing
|
|
27
|
+
|
|
28
|
+
license: Apache-2.0 AND BSL-1.0
|
|
29
|
+
|
|
30
|
+
date-released: 2016
|
package/NOTICE
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Copyright (c) 2016-
|
|
1
|
+
Copyright (c) 2016-2023 The Stdlib Authors.
|
package/README.md
CHANGED
|
@@ -18,6 +18,17 @@ limitations under the License.
|
|
|
18
18
|
|
|
19
19
|
-->
|
|
20
20
|
|
|
21
|
+
|
|
22
|
+
<details>
|
|
23
|
+
<summary>
|
|
24
|
+
About stdlib...
|
|
25
|
+
</summary>
|
|
26
|
+
<p>We believe in a future in which the web is a preferred environment for numerical computation. To help realize this future, we've built stdlib. stdlib is a standard library, with an emphasis on numerical and scientific computation, written in JavaScript (and C) for execution in browsers and in Node.js.</p>
|
|
27
|
+
<p>The library is fully decomposable, being architected in such a way that you can swap out and mix and match APIs and functionality to cater to your exact preferences and use cases.</p>
|
|
28
|
+
<p>When you use stdlib, you can be absolutely certain that you are using the most thorough, rigorous, well-written, studied, documented, tested, measured, and high-quality code out there.</p>
|
|
29
|
+
<p>To join us in bringing numerical computing to the web, get started by checking us out on <a href="https://github.com/stdlib-js/stdlib">GitHub</a>, and please consider <a href="https://opencollective.com/stdlib">financially supporting stdlib</a>. We greatly appreciate your continued support!</p>
|
|
30
|
+
</details>
|
|
31
|
+
|
|
21
32
|
# Mode
|
|
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] -->
|
|
@@ -191,7 +202,7 @@ See [LICENSE][stdlib-license].
|
|
|
191
202
|
|
|
192
203
|
## Copyright
|
|
193
204
|
|
|
194
|
-
Copyright © 2016-
|
|
205
|
+
Copyright © 2016-2023. The Stdlib [Authors][stdlib-authors].
|
|
195
206
|
|
|
196
207
|
</section>
|
|
197
208
|
|
|
@@ -204,8 +215,8 @@ Copyright © 2016-2022. The Stdlib [Authors][stdlib-authors].
|
|
|
204
215
|
[npm-image]: http://img.shields.io/npm/v/@stdlib/stats-base-dists-binomial-mode.svg
|
|
205
216
|
[npm-url]: https://npmjs.org/package/@stdlib/stats-base-dists-binomial-mode
|
|
206
217
|
|
|
207
|
-
[test-image]: https://github.com/stdlib-js/stats-base-dists-binomial-mode/actions/workflows/test.yml/badge.svg?branch=v0.
|
|
208
|
-
[test-url]: https://github.com/stdlib-js/stats-base-dists-binomial-mode/actions/workflows/test.yml?query=branch:v0.
|
|
218
|
+
[test-image]: https://github.com/stdlib-js/stats-base-dists-binomial-mode/actions/workflows/test.yml/badge.svg?branch=v0.1.1
|
|
219
|
+
[test-url]: https://github.com/stdlib-js/stats-base-dists-binomial-mode/actions/workflows/test.yml?query=branch:v0.1.1
|
|
209
220
|
|
|
210
221
|
[coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/stats-base-dists-binomial-mode/main.svg
|
|
211
222
|
[coverage-url]: https://codecov.io/github/stdlib-js/stats-base-dists-binomial-mode?branch=main
|
|
@@ -218,7 +229,7 @@ Copyright © 2016-2022. The Stdlib [Authors][stdlib-authors].
|
|
|
218
229
|
-->
|
|
219
230
|
|
|
220
231
|
[chat-image]: https://img.shields.io/gitter/room/stdlib-js/stdlib.svg
|
|
221
|
-
[chat-url]: https://gitter.im
|
|
232
|
+
[chat-url]: https://app.gitter.im/#/room/#stdlib-js_stdlib:gitter.im
|
|
222
233
|
|
|
223
234
|
[stdlib]: https://github.com/stdlib-js/stdlib
|
|
224
235
|
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";var a=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var u=a(function(c,t){
|
|
2
|
+
var o=require('@stdlib/math-base-assert-is-nonnegative-integer/dist'),i=require('@stdlib/math-base-assert-is-nan/dist'),s=require('@stdlib/math-base-special-floor/dist'),v=require('@stdlib/constants-float64-pinf/dist');function n(e,r){return i(e)||i(r)||r<0||r>1||!o(e)||e===v?NaN:s((e+1)*r)}t.exports=n
|
|
3
|
+
});var q=u();module.exports=q;
|
|
4
|
+
/** @license Apache-2.0 */
|
|
5
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../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 isNonNegativeInteger = require( '@stdlib/math-base-assert-is-nonnegative-integer' );\nvar isnan = require( '@stdlib/math-base-assert-is-nan' );\nvar floor = require( '@stdlib/math-base-special-floor' );\nvar PINF = require( '@stdlib/constants-float64-pinf' );\n\n\n// MAIN //\n\n/**\n* Returns the mode of a binomial distribution.\n*\n* @param {NonNegativeInteger} n - number of trials\n* @param {Probability} p - success probability\n* @returns {NonNegativeInteger} mode\n*\n* @example\n* var v = mode( 100, 0.1 );\n* // returns 10\n*\n* @example\n* var v = mode( 20, 0.5 );\n* // returns 10\n*\n* @example\n* var v = mode( 10.3, 0.5 );\n* // returns NaN\n*\n* @example\n* var v = mode( 20, 1.1 );\n* // returns NaN\n*\n* @example\n* var v = mode( 20, NaN );\n* // returns NaN\n*/\nfunction mode( n, p ) {\n\tif (\n\t\tisnan( n ) ||\n\t\tisnan( p ) ||\n\t\tp < 0.0 ||\n\t\tp > 1.0 ||\n\t\t!isNonNegativeInteger( n ) ||\n\t\tn === PINF\n\t) {\n\t\treturn NaN;\n\t}\n\treturn floor( ( n+1 ) * p );\n}\n\n\n// EXPORTS //\n\nmodule.exports = mode;\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* Binomial distribution mode.\n*\n* @module @stdlib/stats-base-dists-binomial-mode\n*\n* @example\n* var mode = require( '@stdlib/stats-base-dists-binomial-mode' );\n*\n* var v = mode( 100, 0.1 );\n* // returns 10\n*\n* v = mode( 20, 0.5 );\n* // returns 10\n*/\n\n// MODULES //\n\nvar mode = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = mode;\n"],
|
|
5
|
+
"mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAuB,QAAS,iDAAkD,EAClFC,EAAQ,QAAS,iCAAkC,EACnDC,EAAQ,QAAS,iCAAkC,EACnDC,EAAO,QAAS,gCAAiC,EAgCrD,SAASC,EAAMC,EAAGC,EAAI,CACrB,OACCL,EAAOI,CAAE,GACTJ,EAAOK,CAAE,GACTA,EAAI,GACJA,EAAI,GACJ,CAACN,EAAsBK,CAAE,GACzBA,IAAMF,EAEC,IAEDD,GAASG,EAAE,GAAMC,CAAE,CAC3B,CAKAP,EAAO,QAAUK,ICrCjB,IAAIG,EAAO,IAKX,OAAO,QAAUA",
|
|
6
|
+
"names": ["require_main", "__commonJSMin", "exports", "module", "isNonNegativeInteger", "isnan", "floor", "PINF", "mode", "n", "p", "mode"]
|
|
7
|
+
}
|
package/docs/types/index.d.ts
CHANGED
package/lib/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stdlib/stats-base-dists-binomial-mode",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Binomial distribution mode.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": {
|
|
@@ -37,20 +37,20 @@
|
|
|
37
37
|
"url": "https://github.com/stdlib-js/stdlib/issues"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@stdlib/constants-float64-pinf": "^0.
|
|
41
|
-
"@stdlib/math-base-assert-is-nan": "^0.
|
|
42
|
-
"@stdlib/math-base-assert-is-nonnegative-integer": "^0.
|
|
43
|
-
"@stdlib/math-base-special-floor": "^0.
|
|
40
|
+
"@stdlib/constants-float64-pinf": "^0.1.1",
|
|
41
|
+
"@stdlib/math-base-assert-is-nan": "^0.1.1",
|
|
42
|
+
"@stdlib/math-base-assert-is-nonnegative-integer": "^0.1.1",
|
|
43
|
+
"@stdlib/math-base-special-floor": "^0.1.1"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@stdlib/bench": "^0.0
|
|
47
|
-
"@stdlib/constants-float64-ninf": "^0.
|
|
48
|
-
"@stdlib/math-base-special-ceil": "^0.0
|
|
49
|
-
"@stdlib/math-base-special-round": "^0.
|
|
50
|
-
"@stdlib/random-base-randu": "^0.0
|
|
46
|
+
"@stdlib/bench": "^0.1.0",
|
|
47
|
+
"@stdlib/constants-float64-ninf": "^0.1.1",
|
|
48
|
+
"@stdlib/math-base-special-ceil": "^0.1.0",
|
|
49
|
+
"@stdlib/math-base-special-round": "^0.1.1",
|
|
50
|
+
"@stdlib/random-base-randu": "^0.1.0",
|
|
51
51
|
"tape": "git+https://github.com/kgryte/tape.git#fix/globby",
|
|
52
52
|
"istanbul": "^0.4.1",
|
|
53
|
-
"tap-
|
|
53
|
+
"tap-min": "git+https://github.com/Planeshifter/tap-min.git"
|
|
54
54
|
},
|
|
55
55
|
"engines": {
|
|
56
56
|
"node": ">=0.10.0",
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
"univariate"
|
|
88
88
|
],
|
|
89
89
|
"funding": {
|
|
90
|
-
"type": "
|
|
91
|
-
"url": "https://
|
|
90
|
+
"type": "opencollective",
|
|
91
|
+
"url": "https://opencollective.com/stdlib"
|
|
92
92
|
}
|
|
93
93
|
}
|
package/docs/repl.txt
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
{{alias}}( n, p )
|
|
3
|
-
Returns the mode of a binomial distribution.
|
|
4
|
-
|
|
5
|
-
If provided `NaN` as any argument, the function returns `NaN`.
|
|
6
|
-
|
|
7
|
-
If provided a number of trials `n` which is not a nonnegative integer, the
|
|
8
|
-
function returns `NaN`.
|
|
9
|
-
|
|
10
|
-
If `p < 0` or `p > 1`, the function returns `NaN`.
|
|
11
|
-
|
|
12
|
-
Parameters
|
|
13
|
-
----------
|
|
14
|
-
n: integer
|
|
15
|
-
Number of trials.
|
|
16
|
-
|
|
17
|
-
p: number
|
|
18
|
-
Success probability.
|
|
19
|
-
|
|
20
|
-
Returns
|
|
21
|
-
-------
|
|
22
|
-
out: number
|
|
23
|
-
Mode.
|
|
24
|
-
|
|
25
|
-
Examples
|
|
26
|
-
--------
|
|
27
|
-
> var v = {{alias}}( 100, 0.1 )
|
|
28
|
-
10
|
|
29
|
-
> v = {{alias}}( 20, 0.5 )
|
|
30
|
-
10
|
|
31
|
-
> v = {{alias}}( 10.3, 0.5 )
|
|
32
|
-
NaN
|
|
33
|
-
> v = {{alias}}( 20, 1.1 )
|
|
34
|
-
NaN
|
|
35
|
-
> v = {{alias}}( 20, NaN )
|
|
36
|
-
NaN
|
|
37
|
-
|
|
38
|
-
See Also
|
|
39
|
-
--------
|
|
40
|
-
|
package/docs/types/test.ts
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* @license Apache-2.0
|
|
3
|
-
*
|
|
4
|
-
* Copyright (c) 2019 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 mode = require( './index' );
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
// TESTS //
|
|
23
|
-
|
|
24
|
-
// The function returns a number...
|
|
25
|
-
{
|
|
26
|
-
mode( 10, 0.3 ); // $ExpectType number
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
// The function does not compile if provided a first argument which is not a number...
|
|
30
|
-
{
|
|
31
|
-
mode( true, 0.5 ); // $ExpectError
|
|
32
|
-
mode( false, 0.5 ); // $ExpectError
|
|
33
|
-
mode( '5', 0.5 ); // $ExpectError
|
|
34
|
-
mode( [], 0.5 ); // $ExpectError
|
|
35
|
-
mode( {}, 0.5 ); // $ExpectError
|
|
36
|
-
mode( ( x: number ): number => x, 0.5 ); // $ExpectError
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
// The function does not compile if provided a second argument which is not a number...
|
|
40
|
-
{
|
|
41
|
-
mode( 8, true ); // $ExpectError
|
|
42
|
-
mode( 8, false ); // $ExpectError
|
|
43
|
-
mode( 8, '5' ); // $ExpectError
|
|
44
|
-
mode( 8, [] ); // $ExpectError
|
|
45
|
-
mode( 8, {} ); // $ExpectError
|
|
46
|
-
mode( 8, ( x: number ): number => x ); // $ExpectError
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
// The function does not compile if provided insufficient arguments...
|
|
50
|
-
{
|
|
51
|
-
mode(); // $ExpectError
|
|
52
|
-
mode( 8 ); // $ExpectError
|
|
53
|
-
}
|
/package/lib/{mode.js → main.js}
RENAMED
|
File without changes
|