@stdlib/stats-base-dists-binomial 0.2.1 → 0.3.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/NOTICE CHANGED
@@ -1 +1 @@
1
- Copyright (c) 2016-2024 The Stdlib Authors.
1
+ Copyright (c) 2016-2026 The Stdlib Authors.
package/README.md CHANGED
@@ -130,10 +130,43 @@ var mu = dist.mean;
130
130
  <!-- eslint no-undef: "error" -->
131
131
 
132
132
  ```javascript
133
- var objectKeys = require( '@stdlib/utils-keys' );
134
133
  var binomial = require( '@stdlib/stats-base-dists-binomial' );
135
134
 
136
- console.log( objectKeys( binomial ) );
135
+ /*
136
+ * Let's take an example of rolling a fair dice 10 times and counting the number of times a 6 is rolled.
137
+ * This situation can be modeled using a Binomial distribution with n = 10 and p = 1/6
138
+ */
139
+
140
+ var n = 10;
141
+ var p = 1/6;
142
+
143
+ // Mean can be used to calculate the average number of times a 6 is rolled:
144
+ console.log( binomial.mean( n, p ) );
145
+ // => ~1.6667
146
+
147
+ // PMF can be used to calculate the probability of getting a certain number of 6s (say 3 sixes):
148
+ console.log( binomial.pmf( 3, n, p ) );
149
+ // => ~0.1550
150
+
151
+ // CDF can be used to calculate probability up to certain number of 6s (say up to 3 sixes):
152
+ console.log( binomial.cdf( 3, n, p ) );
153
+ // => ~0.9303
154
+
155
+ // Quantile can be used to calculate the number of 6s at which you can be 80% confident that the actual number will not exceed.
156
+ console.log( binomial.quantile( 0.8, n, p ) );
157
+ // => 3
158
+
159
+ // Standard deviation can be used to calculate the measure of the spread of 6s around the mean:
160
+ console.log( binomial.stdev( n, p ) );
161
+ // => ~1.1785
162
+
163
+ // Skewness can be used to calculate the asymmetry of the distribution of 6s:
164
+ console.log( binomial.skewness( n, p ) );
165
+ // => ~0.5657
166
+
167
+ // MGF can be used for more advanced statistical analyses and generating moments of the distribution:
168
+ console.log( binomial.mgf( 0.5, n, p ) );
169
+ // => ~2.7917
137
170
  ```
138
171
 
139
172
  </section>
@@ -174,7 +207,7 @@ See [LICENSE][stdlib-license].
174
207
 
175
208
  ## Copyright
176
209
 
177
- Copyright &copy; 2016-2024. The Stdlib [Authors][stdlib-authors].
210
+ Copyright &copy; 2016-2026. The Stdlib [Authors][stdlib-authors].
178
211
 
179
212
  </section>
180
213
 
@@ -187,8 +220,8 @@ Copyright &copy; 2016-2024. The Stdlib [Authors][stdlib-authors].
187
220
  [npm-image]: http://img.shields.io/npm/v/@stdlib/stats-base-dists-binomial.svg
188
221
  [npm-url]: https://npmjs.org/package/@stdlib/stats-base-dists-binomial
189
222
 
190
- [test-image]: https://github.com/stdlib-js/stats-base-dists-binomial/actions/workflows/test.yml/badge.svg?branch=v0.2.1
191
- [test-url]: https://github.com/stdlib-js/stats-base-dists-binomial/actions/workflows/test.yml?query=branch:v0.2.1
223
+ [test-image]: https://github.com/stdlib-js/stats-base-dists-binomial/actions/workflows/test.yml/badge.svg?branch=v0.3.0
224
+ [test-url]: https://github.com/stdlib-js/stats-base-dists-binomial/actions/workflows/test.yml?query=branch:v0.3.0
192
225
 
193
226
  [coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/stats-base-dists-binomial/main.svg
194
227
  [coverage-url]: https://codecov.io/github/stdlib-js/stats-base-dists-binomial?branch=main
@@ -200,8 +233,8 @@ Copyright &copy; 2016-2024. The Stdlib [Authors][stdlib-authors].
200
233
 
201
234
  -->
202
235
 
203
- [chat-image]: https://img.shields.io/gitter/room/stdlib-js/stdlib.svg
204
- [chat-url]: https://app.gitter.im/#/room/#stdlib-js_stdlib:gitter.im
236
+ [chat-image]: https://img.shields.io/badge/zulip-join_chat-brightgreen.svg
237
+ [chat-url]: https://stdlib.zulipchat.com
205
238
 
206
239
  [stdlib]: https://github.com/stdlib-js/stdlib
207
240
 
@@ -58,7 +58,7 @@ interface Namespace {
58
58
  * // returns ~0.834
59
59
  *
60
60
  * y = ns.cdf( 0.0, 10, 0.4 );
61
- * // returns ~0.06
61
+ * // returns ~0.006
62
62
  *
63
63
  * var mycdf = ns.cdf.factory( 10, 0.5 );
64
64
  *
@@ -110,7 +110,7 @@ interface Namespace {
110
110
  entropy: typeof entropy;
111
111
 
112
112
  /**
113
- * Returns the kurtosis of a binomial distribution.
113
+ * Returns the excess kurtosis of a binomial distribution.
114
114
  *
115
115
  * ## Notes
116
116
  *
@@ -167,7 +167,7 @@ interface Namespace {
167
167
  * var mylogpmf = ns.logpmf.factory( 10, 0.5 );
168
168
  *
169
169
  * y = mylogpmf( 3.0 );
170
- * // returns ~-2.146
170
+ * // returns ~-2.144
171
171
  *
172
172
  * y = mylogpmf( 5.0 );
173
173
  * // returns ~-1.402
@@ -257,7 +257,7 @@ interface Namespace {
257
257
  * y = ns.mgf( 5.0, 20, 0.2 );
258
258
  * // returns ~4.798e29
259
259
  *
260
- * y = ns.mgf( 0.9, 10, 0.4 )
260
+ * y = ns.mgf( 0.9, 10, 0.4 );
261
261
  * // returns ~99.338
262
262
  *
263
263
  * var mymgf = ns.mgf.factory( 10, 0.5 );
@@ -320,7 +320,7 @@ interface Namespace {
320
320
  * // returns ~0.201
321
321
  *
322
322
  * y = ns.pmf( 0.0, 10, 0.4 );
323
- * // returns ~0.06
323
+ * // returns ~0.006
324
324
  *
325
325
  * var mypmf = ns.pmf.factory( 10, 0.5 );
326
326
  *
@@ -342,7 +342,7 @@ interface Namespace {
342
342
  *
343
343
  * @example
344
344
  * var y = ns.quantile( 0.4, 20, 0.2 );
345
- * // returns 2
345
+ * // returns 3
346
346
  *
347
347
  * y = ns.quantile( 0.8, 20, 0.2 );
348
348
  * // returns 5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stdlib/stats-base-dists-binomial",
3
- "version": "0.2.1",
3
+ "version": "0.3.0",
4
4
  "description": "Binomial distribution.",
5
5
  "license": "Apache-2.0",
6
6
  "author": {
@@ -30,21 +30,21 @@
30
30
  "url": "https://github.com/stdlib-js/stdlib/issues"
31
31
  },
32
32
  "dependencies": {
33
- "@stdlib/stats-base-dists-binomial-cdf": "^0.2.1",
34
- "@stdlib/stats-base-dists-binomial-ctor": "^0.2.1",
35
- "@stdlib/stats-base-dists-binomial-entropy": "^0.2.1",
36
- "@stdlib/stats-base-dists-binomial-kurtosis": "^0.2.1",
37
- "@stdlib/stats-base-dists-binomial-logpmf": "^0.2.1",
38
- "@stdlib/stats-base-dists-binomial-mean": "^0.2.1",
39
- "@stdlib/stats-base-dists-binomial-median": "^0.2.1",
40
- "@stdlib/stats-base-dists-binomial-mgf": "^0.2.1",
41
- "@stdlib/stats-base-dists-binomial-mode": "^0.2.1",
42
- "@stdlib/stats-base-dists-binomial-pmf": "^0.2.1",
43
- "@stdlib/stats-base-dists-binomial-quantile": "^0.2.1",
44
- "@stdlib/stats-base-dists-binomial-skewness": "^0.2.1",
45
- "@stdlib/stats-base-dists-binomial-stdev": "^0.2.1",
46
- "@stdlib/stats-base-dists-binomial-variance": "^0.2.1",
47
- "@stdlib/utils-define-read-only-property": "^0.2.1"
33
+ "@stdlib/stats-base-dists-binomial-cdf": "^0.2.2",
34
+ "@stdlib/stats-base-dists-binomial-ctor": "^0.2.2",
35
+ "@stdlib/stats-base-dists-binomial-entropy": "^0.3.0",
36
+ "@stdlib/stats-base-dists-binomial-kurtosis": "^0.3.0",
37
+ "@stdlib/stats-base-dists-binomial-logpmf": "^0.2.2",
38
+ "@stdlib/stats-base-dists-binomial-mean": "^0.3.0",
39
+ "@stdlib/stats-base-dists-binomial-median": "^0.3.0",
40
+ "@stdlib/stats-base-dists-binomial-mgf": "^0.3.0",
41
+ "@stdlib/stats-base-dists-binomial-mode": "^0.3.0",
42
+ "@stdlib/stats-base-dists-binomial-pmf": "^0.3.0",
43
+ "@stdlib/stats-base-dists-binomial-quantile": "^0.2.2",
44
+ "@stdlib/stats-base-dists-binomial-skewness": "^0.3.0",
45
+ "@stdlib/stats-base-dists-binomial-stdev": "^0.3.0",
46
+ "@stdlib/stats-base-dists-binomial-variance": "^0.3.0",
47
+ "@stdlib/utils-define-read-only-property": "^0.2.2"
48
48
  },
49
49
  "devDependencies": {},
50
50
  "engines": {