@stdlib/stats-base-dists-binomial 0.2.1 → 0.2.2

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.
Files changed (2) hide show
  1. package/README.md +37 -4
  2. package/package.json +14 -14
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>
@@ -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.2.2
224
+ [test-url]: https://github.com/stdlib-js/stats-base-dists-binomial/actions/workflows/test.yml?query=branch:v0.2.2
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
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.2.2",
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",
33
+ "@stdlib/stats-base-dists-binomial-cdf": "^0.2.2",
34
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",
35
+ "@stdlib/stats-base-dists-binomial-entropy": "^0.2.2",
36
+ "@stdlib/stats-base-dists-binomial-kurtosis": "^0.2.2",
37
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"
38
+ "@stdlib/stats-base-dists-binomial-mean": "^0.2.2",
39
+ "@stdlib/stats-base-dists-binomial-median": "^0.2.2",
40
+ "@stdlib/stats-base-dists-binomial-mgf": "^0.2.2",
41
+ "@stdlib/stats-base-dists-binomial-mode": "^0.2.2",
42
+ "@stdlib/stats-base-dists-binomial-pmf": "^0.2.2",
43
+ "@stdlib/stats-base-dists-binomial-quantile": "^0.2.2",
44
+ "@stdlib/stats-base-dists-binomial-skewness": "^0.2.2",
45
+ "@stdlib/stats-base-dists-binomial-stdev": "^0.2.2",
46
+ "@stdlib/stats-base-dists-binomial-variance": "^0.2.2",
47
+ "@stdlib/utils-define-read-only-property": "^0.2.2"
48
48
  },
49
49
  "devDependencies": {},
50
50
  "engines": {