@stdlib/stats-base-dists-bradford 0.1.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 ADDED
@@ -0,0 +1,177 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
package/NOTICE ADDED
@@ -0,0 +1 @@
1
+ Copyright (c) 2016-2026 The Stdlib Authors.
package/README.md ADDED
@@ -0,0 +1,269 @@
1
+ <!--
2
+
3
+ @license Apache-2.0
4
+
5
+ Copyright (c) 2025 The Stdlib Authors.
6
+
7
+ Licensed under the Apache License, Version 2.0 (the "License");
8
+ you may not use this file except in compliance with the License.
9
+ You may obtain a copy of the License at
10
+
11
+ http://www.apache.org/licenses/LICENSE-2.0
12
+
13
+ Unless required by applicable law or agreed to in writing, software
14
+ distributed under the License is distributed on an "AS IS" BASIS,
15
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ See the License for the specific language governing permissions and
17
+ limitations under the License.
18
+
19
+ -->
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
+
32
+ # Bradford
33
+
34
+ [![NPM version][npm-image]][npm-url] [![Build Status][test-image]][test-url] [![Coverage Status][coverage-image]][coverage-url] <!-- [![dependencies][dependencies-image]][dependencies-url] -->
35
+
36
+ > Bradford distribution.
37
+
38
+ <section class="installation">
39
+
40
+ ## Installation
41
+
42
+ ```bash
43
+ npm install @stdlib/stats-base-dists-bradford
44
+ ```
45
+
46
+ </section>
47
+
48
+ <section class="usage">
49
+
50
+ ## Usage
51
+
52
+ ```javascript
53
+ var bradford = require( '@stdlib/stats-base-dists-bradford' );
54
+ ```
55
+
56
+ #### bradford
57
+
58
+ [Bradford][bradford-distribution] distribution.
59
+
60
+ ```javascript
61
+ var dist = bradford;
62
+ // returns {...}
63
+ ```
64
+
65
+ The namespace contains the following distribution functions:
66
+
67
+ <!-- <toc pattern="*+(cdf|pdf|mgf|quantile)*"> -->
68
+
69
+ <div class="namespace-toc">
70
+
71
+ - <span class="signature">[`cdf( x, c )`][@stdlib/stats/base/dists/bradford/cdf]</span><span class="delimiter">: </span><span class="description">bradford distribution cumulative distribution function (CDF).</span>
72
+ - <span class="signature">[`pdf( x, c )`][@stdlib/stats/base/dists/bradford/pdf]</span><span class="delimiter">: </span><span class="description">bradford distribution probability density function (PDF).</span>
73
+ - <span class="signature">[`quantile( p, c )`][@stdlib/stats/base/dists/bradford/quantile]</span><span class="delimiter">: </span><span class="description">bradford distribution quantile function.</span>
74
+
75
+ </div>
76
+
77
+ <!-- </toc> -->
78
+
79
+ The namespace contains the following functions for calculating distribution properties:
80
+
81
+ <!-- <toc pattern="*+(entropy|mean|median|mode|skewness|stdev|variance)*"> -->
82
+
83
+ <div class="namespace-toc">
84
+
85
+ - <span class="signature">[`entropy( c )`][@stdlib/stats/base/dists/bradford/entropy]</span><span class="delimiter">: </span><span class="description">bradford distribution differential entropy.</span>
86
+ - <span class="signature">[`mean( c )`][@stdlib/stats/base/dists/bradford/mean]</span><span class="delimiter">: </span><span class="description">bradford distribution expected value.</span>
87
+ - <span class="signature">[`median( c )`][@stdlib/stats/base/dists/bradford/median]</span><span class="delimiter">: </span><span class="description">bradford distribution median.</span>
88
+ - <span class="signature">[`mode( c )`][@stdlib/stats/base/dists/bradford/mode]</span><span class="delimiter">: </span><span class="description">bradford distribution mode.</span>
89
+ - <span class="signature">[`skewness( c )`][@stdlib/stats/base/dists/bradford/skewness]</span><span class="delimiter">: </span><span class="description">bradford distribution skewness.</span>
90
+ - <span class="signature">[`stdev( c )`][@stdlib/stats/base/dists/bradford/stdev]</span><span class="delimiter">: </span><span class="description">bradford distribution standard deviation.</span>
91
+ - <span class="signature">[`variance( c )`][@stdlib/stats/base/dists/bradford/variance]</span><span class="delimiter">: </span><span class="description">bradford distribution variance.</span>
92
+
93
+ </div>
94
+
95
+ <!-- </toc> -->
96
+
97
+ </section>
98
+
99
+ <!-- /.usage -->
100
+
101
+ <section class="examples">
102
+
103
+ ## Examples
104
+
105
+ <!-- eslint no-undef: "error" -->
106
+
107
+ ```javascript
108
+ var bradford = require( '@stdlib/stats-base-dists-bradford' );
109
+
110
+ /*
111
+ * The Bradford distribution is defined over [0,1] with shape parameter c.
112
+ */
113
+
114
+ var c = 2.0;
115
+
116
+ // Compute the mean:
117
+ var mu = bradford.mean( c );
118
+ // returns ~0.410
119
+
120
+ // Compute the median:
121
+ var median = bradford.median( c );
122
+ // returns ~0.366
123
+
124
+ // Compute the variance:
125
+ var s2 = bradford.variance( c );
126
+ // returns ~0.082
127
+
128
+ // Compute the standard deviation:
129
+ var sigma = bradford.stdev( c );
130
+ // returns ~0.286
131
+
132
+ // Evaluate the PDF at x = 0.5:
133
+ var y = bradford.pdf( 0.5, c );
134
+ // returns ~0.910
135
+
136
+ // Evaluate the CDF at x = 0.5:
137
+ var p = bradford.cdf( 0.5, c );
138
+ // returns ~0.631
139
+
140
+ // Compute the 50th percentile (median):
141
+ var q = bradford.quantile( 0.5, c );
142
+ // returns ~0.366
143
+
144
+ // Compute the entropy:
145
+ var h = bradford.entropy( c );
146
+ // returns ~-0.050
147
+
148
+ // Compute the skewness:
149
+ var skew = bradford.skewness( c );
150
+ // returns ~0.378
151
+
152
+ // Compute the mode:
153
+ var mode = bradford.mode( c );
154
+ // returns 0.0
155
+ ```
156
+
157
+ </section>
158
+
159
+ <!-- /.examples -->
160
+
161
+ <!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
162
+
163
+ <section class="related">
164
+
165
+ </section>
166
+
167
+ <!-- /.related -->
168
+
169
+ <!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
170
+
171
+
172
+ <section class="main-repo" >
173
+
174
+ * * *
175
+
176
+ ## Notice
177
+
178
+ This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more.
179
+
180
+ For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib].
181
+
182
+ #### Community
183
+
184
+ [![Chat][chat-image]][chat-url]
185
+
186
+ ---
187
+
188
+ ## License
189
+
190
+ See [LICENSE][stdlib-license].
191
+
192
+
193
+ ## Copyright
194
+
195
+ Copyright &copy; 2016-2026. The Stdlib [Authors][stdlib-authors].
196
+
197
+ </section>
198
+
199
+ <!-- /.stdlib -->
200
+
201
+ <!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
202
+
203
+ <section class="links">
204
+
205
+ [npm-image]: http://img.shields.io/npm/v/@stdlib/stats-base-dists-bradford.svg
206
+ [npm-url]: https://npmjs.org/package/@stdlib/stats-base-dists-bradford
207
+
208
+ [test-image]: https://github.com/stdlib-js/stats-base-dists-bradford/actions/workflows/test.yml/badge.svg?branch=v0.1.0
209
+ [test-url]: https://github.com/stdlib-js/stats-base-dists-bradford/actions/workflows/test.yml?query=branch:v0.1.0
210
+
211
+ [coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/stats-base-dists-bradford/main.svg
212
+ [coverage-url]: https://codecov.io/github/stdlib-js/stats-base-dists-bradford?branch=main
213
+
214
+ <!--
215
+
216
+ [dependencies-image]: https://img.shields.io/david/stdlib-js/stats-base-dists-bradford.svg
217
+ [dependencies-url]: https://david-dm.org/stdlib-js/stats-base-dists-bradford/main
218
+
219
+ -->
220
+
221
+ [chat-image]: https://img.shields.io/badge/zulip-join_chat-brightgreen.svg
222
+ [chat-url]: https://stdlib.zulipchat.com
223
+
224
+ [stdlib]: https://github.com/stdlib-js/stdlib
225
+
226
+ [stdlib-authors]: https://github.com/stdlib-js/stdlib/graphs/contributors
227
+
228
+ [umd]: https://github.com/umdjs/umd
229
+ [es-module]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules
230
+
231
+ [deno-url]: https://github.com/stdlib-js/stats-base-dists-bradford/tree/deno
232
+ [deno-readme]: https://github.com/stdlib-js/stats-base-dists-bradford/blob/deno/README.md
233
+ [umd-url]: https://github.com/stdlib-js/stats-base-dists-bradford/tree/umd
234
+ [umd-readme]: https://github.com/stdlib-js/stats-base-dists-bradford/blob/umd/README.md
235
+ [esm-url]: https://github.com/stdlib-js/stats-base-dists-bradford/tree/esm
236
+ [esm-readme]: https://github.com/stdlib-js/stats-base-dists-bradford/blob/esm/README.md
237
+ [branches-url]: https://github.com/stdlib-js/stats-base-dists-bradford/blob/main/branches.md
238
+
239
+ [stdlib-license]: https://raw.githubusercontent.com/stdlib-js/stats-base-dists-bradford/main/LICENSE
240
+
241
+ [bradford-distribution]: https://en.wikipedia.org/wiki/Bradford_distribution
242
+
243
+ <!-- <toc-links> -->
244
+
245
+ [@stdlib/stats/base/dists/bradford/entropy]: https://www.npmjs.com/package/@stdlib/stats-base-dists-bradford-entropy
246
+
247
+ [@stdlib/stats/base/dists/bradford/mean]: https://www.npmjs.com/package/@stdlib/stats-base-dists-bradford-mean
248
+
249
+ [@stdlib/stats/base/dists/bradford/median]: https://www.npmjs.com/package/@stdlib/stats-base-dists-bradford-median
250
+
251
+ [@stdlib/stats/base/dists/bradford/mode]: https://www.npmjs.com/package/@stdlib/stats-base-dists-bradford-mode
252
+
253
+ [@stdlib/stats/base/dists/bradford/skewness]: https://www.npmjs.com/package/@stdlib/stats-base-dists-bradford-skewness
254
+
255
+ [@stdlib/stats/base/dists/bradford/stdev]: https://www.npmjs.com/package/@stdlib/stats-base-dists-bradford-stdev
256
+
257
+ [@stdlib/stats/base/dists/bradford/variance]: https://www.npmjs.com/package/@stdlib/stats-base-dists-bradford-variance
258
+
259
+ [@stdlib/stats/base/dists/bradford/cdf]: https://www.npmjs.com/package/@stdlib/stats-base-dists-bradford-cdf
260
+
261
+ [@stdlib/stats/base/dists/bradford/pdf]: https://www.npmjs.com/package/@stdlib/stats-base-dists-bradford-pdf
262
+
263
+ [@stdlib/stats/base/dists/bradford/quantile]: https://www.npmjs.com/package/@stdlib/stats-base-dists-bradford-quantile
264
+
265
+ <!-- </toc-links> -->
266
+
267
+ </section>
268
+
269
+ <!-- /.links -->
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 ns from '../docs/types/index';
3
+ export = ns;
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ "use strict";var r=require('@stdlib/utils-define-read-only-property/dist'),e={};r(e,"cdf",require('@stdlib/stats-base-dists-bradford-cdf/dist'));r(e,"entropy",require('@stdlib/stats-base-dists-bradford-entropy/dist'));r(e,"mean",require('@stdlib/stats-base-dists-bradford-mean/dist'));r(e,"median",require('@stdlib/stats-base-dists-bradford-median/dist'));r(e,"mode",require('@stdlib/stats-base-dists-bradford-mode/dist'));r(e,"pdf",require('@stdlib/stats-base-dists-bradford-pdf/dist'));r(e,"quantile",require('@stdlib/stats-base-dists-bradford-quantile/dist'));r(e,"skewness",require('@stdlib/stats-base-dists-bradford-skewness/dist'));r(e,"stdev",require('@stdlib/stats-base-dists-bradford-stdev/dist'));r(e,"variance",require('@stdlib/stats-base-dists-bradford-variance/dist'));module.exports=e;
2
+ /** @license Apache-2.0 */
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../lib/index.js"],
4
+ "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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* When adding modules to the namespace, ensure that they are added in alphabetical order according to module name.\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-read-only-property' );\n\n\n// MAIN //\n\n/**\n* Top-level namespace.\n*\n* @namespace bradford\n*/\nvar bradford = {};\n\n/**\n* @name cdf\n* @memberof bradford\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/stats/base/dists/bradford/cdf}\n*/\nsetReadOnly( bradford, 'cdf', require( '@stdlib/stats-base-dists-bradford-cdf' ) );\n\n/**\n* @name entropy\n* @memberof bradford\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/stats/base/dists/bradford/entropy}\n*/\nsetReadOnly( bradford, 'entropy', require( '@stdlib/stats-base-dists-bradford-entropy' ) );\n\n/**\n* @name mean\n* @memberof bradford\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/stats/base/dists/bradford/mean}\n*/\nsetReadOnly( bradford, 'mean', require( '@stdlib/stats-base-dists-bradford-mean' ) );\n\n/**\n* @name median\n* @memberof bradford\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/stats/base/dists/bradford/median}\n*/\nsetReadOnly( bradford, 'median', require( '@stdlib/stats-base-dists-bradford-median' ) );\n\n/**\n* @name mode\n* @memberof bradford\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/stats/base/dists/bradford/mode}\n*/\nsetReadOnly( bradford, 'mode', require( '@stdlib/stats-base-dists-bradford-mode' ) );\n\n/**\n* @name pdf\n* @memberof bradford\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/stats/base/dists/bradford/pdf}\n*/\nsetReadOnly( bradford, 'pdf', require( '@stdlib/stats-base-dists-bradford-pdf' ) );\n\n/**\n* @name quantile\n* @memberof bradford\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/stats/base/dists/bradford/quantile}\n*/\nsetReadOnly( bradford, 'quantile', require( '@stdlib/stats-base-dists-bradford-quantile' ) );\n\n/**\n* @name skewness\n* @memberof bradford\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/stats/base/dists/bradford/skewness}\n*/\nsetReadOnly( bradford, 'skewness', require( '@stdlib/stats-base-dists-bradford-skewness' ) );\n\n/**\n* @name stdev\n* @memberof bradford\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/stats/base/dists/bradford/stdev}\n*/\nsetReadOnly( bradford, 'stdev', require( '@stdlib/stats-base-dists-bradford-stdev' ) );\n\n/**\n* @name variance\n* @memberof bradford\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/stats/base/dists/bradford/variance}\n*/\nsetReadOnly( bradford, 'variance', require( '@stdlib/stats-base-dists-bradford-variance' ) );\n\n\n// EXPORTS //\n\nmodule.exports = bradford;\n"],
5
+ "mappings": "aA0BA,IAAIA,EAAc,QAAS,yCAA0C,EAUjEC,EAAW,CAAC,EAShBD,EAAaC,EAAU,MAAO,QAAS,uCAAwC,CAAE,EASjFD,EAAaC,EAAU,UAAW,QAAS,2CAA4C,CAAE,EASzFD,EAAaC,EAAU,OAAQ,QAAS,wCAAyC,CAAE,EASnFD,EAAaC,EAAU,SAAU,QAAS,0CAA2C,CAAE,EASvFD,EAAaC,EAAU,OAAQ,QAAS,wCAAyC,CAAE,EASnFD,EAAaC,EAAU,MAAO,QAAS,uCAAwC,CAAE,EASjFD,EAAaC,EAAU,WAAY,QAAS,4CAA6C,CAAE,EAS3FD,EAAaC,EAAU,WAAY,QAAS,4CAA6C,CAAE,EAS3FD,EAAaC,EAAU,QAAS,QAAS,yCAA0C,CAAE,EASrFD,EAAaC,EAAU,WAAY,QAAS,4CAA6C,CAAE,EAK3F,OAAO,QAAUA",
6
+ "names": ["setReadOnly", "bradford"]
7
+ }
@@ -0,0 +1,357 @@
1
+ /*
2
+ * @license Apache-2.0
3
+ *
4
+ * Copyright (c) 2025 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
+ // TypeScript Version: 4.1
20
+
21
+ /* eslint-disable max-lines */
22
+
23
+ import cdf = require( '@stdlib/stats-base-dists-bradford-cdf' );
24
+ import entropy = require( '@stdlib/stats-base-dists-bradford-entropy' );
25
+ import mean = require( '@stdlib/stats-base-dists-bradford-mean' );
26
+ import median = require( '@stdlib/stats-base-dists-bradford-median' );
27
+ import mode = require( '@stdlib/stats-base-dists-bradford-mode' );
28
+ import pdf = require( '@stdlib/stats-base-dists-bradford-pdf' );
29
+ import quantile = require( '@stdlib/stats-base-dists-bradford-quantile' );
30
+ import skewness = require( '@stdlib/stats-base-dists-bradford-skewness' );
31
+ import stdev = require( '@stdlib/stats-base-dists-bradford-stdev' );
32
+ import variance = require( '@stdlib/stats-base-dists-bradford-variance' );
33
+
34
+ /**
35
+ * Interface describing the `bradford` namespace.
36
+ */
37
+ interface Namespace {
38
+ /**
39
+ * Bradford distribution cumulative distribution function (CDF).
40
+ *
41
+ * @param x - input value
42
+ * @param c - shape parameter
43
+ * @returns evaluated CDF
44
+ *
45
+ * @example
46
+ * var y = ns.cdf( 0.5, 5.0 );
47
+ * // returns ~0.699
48
+ *
49
+ * var mycdf = ns.cdf.factory( 5.0 );
50
+ * y = mycdf( 0.5 );
51
+ * // returns ~0.699
52
+ *
53
+ * y = mycdf( 1.0 );
54
+ * // returns 1.0
55
+ */
56
+ cdf: typeof cdf;
57
+
58
+ /**
59
+ * Returns the differential entropy of a Bradford distribution.
60
+ *
61
+ * ## Notes
62
+ *
63
+ * - If `c <= 0`, the function returns `NaN`.
64
+ *
65
+ * @param c - shape parameter
66
+ * @returns differential entropy
67
+ *
68
+ * @example
69
+ * var v = ns.entropy( 0.2 );
70
+ * // returns ~-0.001
71
+ *
72
+ * @example
73
+ * var v = ns.entropy( 0.5 );
74
+ * // returns ~-0.007
75
+ *
76
+ * @example
77
+ * var v = ns.entropy( 10.0 );
78
+ * // returns ~-0.229
79
+ *
80
+ * @example
81
+ * var v = ns.entropy( 0.0 );
82
+ * // returns NaN
83
+ *
84
+ * @example
85
+ * var v = ns.entropy( -1.0 );
86
+ * // returns NaN
87
+ *
88
+ * @example
89
+ * var v = ns.entropy( NaN );
90
+ * // returns NaN
91
+ */
92
+ entropy: typeof entropy;
93
+
94
+ /**
95
+ * Returns the expected value of a Bradford distribution.
96
+ *
97
+ * ## Notes
98
+ *
99
+ * - If `c <= 0`, the function returns `NaN`.
100
+ *
101
+ * @param c - shape parameter
102
+ * @returns expected value
103
+ *
104
+ * @example
105
+ * var v = ns.mean( 0.1 );
106
+ * // returns ~0.492
107
+ *
108
+ * @example
109
+ * var v = ns.mean( 0.5 );
110
+ * // returns ~0.466
111
+ *
112
+ * @example
113
+ * var v = ns.mean( 10.0 );
114
+ * // returns ~0.317
115
+ *
116
+ * @example
117
+ * var v = ns.mean( 0.0 );
118
+ * // returns NaN
119
+ *
120
+ * @example
121
+ * var v = ns.mean( -1.0 );
122
+ * // returns NaN
123
+ *
124
+ * @example
125
+ * var v = ns.mean( NaN );
126
+ * // returns NaN
127
+ */
128
+ mean: typeof mean;
129
+
130
+ /**
131
+ * Returns the median of a Bradford distribution.
132
+ *
133
+ * ## Notes
134
+ *
135
+ * - If `c <= 0`, the function returns `NaN`.
136
+ *
137
+ * @param c - shape parameter
138
+ * @returns median
139
+ *
140
+ * @example
141
+ * var v = ns.median( 0.1 );
142
+ * // returns ~0.488
143
+ *
144
+ * @example
145
+ * var v = ns.median( 0.5 );
146
+ * // returns ~0.449
147
+ *
148
+ * @example
149
+ * var v = ns.median( 10.0 );
150
+ * // returns ~0.232
151
+ *
152
+ * @example
153
+ * var v = ns.median( 0.0 );
154
+ * // returns NaN
155
+ *
156
+ * @example
157
+ * var v = ns.median( -1.0 );
158
+ * // returns NaN
159
+ *
160
+ * @example
161
+ * var v = ns.median( NaN );
162
+ * // returns NaN
163
+ */
164
+ median: typeof median;
165
+
166
+ /**
167
+ * Returns the mode of a Bradford distribution.
168
+ *
169
+ * ## Notes
170
+ *
171
+ * - If `c <= 0`, the function returns `NaN`.
172
+ *
173
+ * @param c - shape parameter
174
+ * @returns mode
175
+ *
176
+ * @example
177
+ * var v = ns.mode( 0.1 );
178
+ * // returns 0.0
179
+ *
180
+ * @example
181
+ * var v = ns.mode( 0.5 );
182
+ * // returns 0.0
183
+ *
184
+ * @example
185
+ * var v = ns.mode( 10.0 );
186
+ * // returns 0.0
187
+ *
188
+ * @example
189
+ * var v = ns.mode( 0.0 );
190
+ * // returns NaN
191
+ *
192
+ * @example
193
+ * var v = ns.mode( -1.0 );
194
+ * // returns NaN
195
+ *
196
+ * @example
197
+ * var v = ns.mode( NaN );
198
+ * // returns NaN
199
+ */
200
+ mode: typeof mode;
201
+
202
+ /**
203
+ * Bradford distribution probability density function (PDF).
204
+ *
205
+ * @param x - input value
206
+ * @param c - shape parameter
207
+ * @returns evaluated PDF
208
+ *
209
+ * @example
210
+ * var y = ns.pdf( 0.5, 5.0 );
211
+ * // returns ~0.797
212
+ *
213
+ * var mypdf = ns.pdf.factory( 5.0 );
214
+ * y = mypdf( 0.5 );
215
+ * // returns ~0.797
216
+ *
217
+ * y = mypdf( 1.0 );
218
+ * // returns ~0.465
219
+ */
220
+ pdf: typeof pdf;
221
+
222
+ /**
223
+ * Bradford distribution quantile function.
224
+ *
225
+ * @param p - input value
226
+ * @param c - shape parameter
227
+ * @returns evaluated quantile function
228
+ *
229
+ * @example
230
+ * var y = ns.quantile( 0.1, 0.1 );
231
+ * // returns ~0.096
232
+ *
233
+ * y = ns.quantile( 0.5, 5.0 );
234
+ * // returns ~0.290
235
+ *
236
+ * var myquantile = ns.quantile.factory( 5.0 );
237
+ * y = myquantile( 0.4 );
238
+ * // returns ~0.210
239
+ *
240
+ * y = myquantile( 0.8 );
241
+ * // returns ~0.639
242
+ *
243
+ * y = myquantile( 1.0 );
244
+ * // returns 1.0
245
+ */
246
+ quantile: typeof quantile;
247
+
248
+ /**
249
+ * Returns the skewness of a Bradford distribution.
250
+ *
251
+ * ## Notes
252
+ *
253
+ * - If provided `c <= 0`, the function returns `NaN`.
254
+ *
255
+ * @param c - shape parameter
256
+ * @returns skewness
257
+ *
258
+ * @example
259
+ * var v = ns.skewness( 9.0 );
260
+ * // returns ~0.772
261
+ *
262
+ * @example
263
+ * var v = ns.skewness( 1.0 );
264
+ * // returns ~0.239
265
+ *
266
+ * @example
267
+ * var v = ns.skewness( -0.2 );
268
+ * // returns NaN
269
+ *
270
+ * @example
271
+ * var v = ns.skewness( NaN );
272
+ * // returns NaN
273
+ */
274
+ skewness: typeof skewness;
275
+
276
+ /**
277
+ * Returns the standard deviation of a Bradford distribution.
278
+ *
279
+ * ## Notes
280
+ *
281
+ * - If `c <= 0`, the function returns `NaN`.
282
+ *
283
+ * @param c - shape parameter
284
+ * @returns standard deviation
285
+ *
286
+ * @example
287
+ * var v = ns.stdev( 0.1 );
288
+ * // returns ~0.289
289
+ *
290
+ * @example
291
+ * var v = ns.stdev( 0.5 );
292
+ * // returns ~0.288
293
+ *
294
+ * @example
295
+ * var v = ns.stdev( 10.0 );
296
+ * // returns ~0.276
297
+ *
298
+ * @example
299
+ * var v = ns.stdev( 0.0 );
300
+ * // returns NaN
301
+ *
302
+ * @example
303
+ * var v = ns.stdev( -1.0 );
304
+ * // returns NaN
305
+ *
306
+ * @example
307
+ * var v = ns.stdev( NaN );
308
+ * // returns NaN
309
+ */
310
+ stdev: typeof stdev;
311
+
312
+ /**
313
+ * Returns the variance of a Bradford distribution.
314
+ *
315
+ * ## Notes
316
+ *
317
+ * - If `c <= 0`, the function returns `NaN`.
318
+ *
319
+ * @param c - shape parameter
320
+ * @returns variance
321
+ *
322
+ * @example
323
+ * var v = ns.variance( 0.1 );
324
+ * // returns ~0.083
325
+ *
326
+ * @example
327
+ * var v = ns.variance( 0.5 );
328
+ * // returns ~0.083
329
+ *
330
+ * @example
331
+ * var v = ns.variance( 10.0 );
332
+ * // returns ~0.076
333
+ *
334
+ * @example
335
+ * var v = ns.variance( 0.0 );
336
+ * // returns NaN
337
+ *
338
+ * @example
339
+ * var v = ns.variance( -1.0 );
340
+ * // returns NaN
341
+ *
342
+ * @example
343
+ * var v = ns.variance( NaN );
344
+ * // returns NaN
345
+ */
346
+ variance: typeof variance;
347
+ }
348
+
349
+ /**
350
+ * Bradford distribution.
351
+ */
352
+ declare var ns: Namespace;
353
+
354
+
355
+ // EXPORTS //
356
+
357
+ export = ns;
package/lib/index.js ADDED
@@ -0,0 +1,132 @@
1
+ /**
2
+ * @license Apache-2.0
3
+ *
4
+ * Copyright (c) 2025 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
+ /*
22
+ * When adding modules to the namespace, ensure that they are added in alphabetical order according to module name.
23
+ */
24
+
25
+ // MODULES //
26
+
27
+ var setReadOnly = require( '@stdlib/utils-define-read-only-property' );
28
+
29
+
30
+ // MAIN //
31
+
32
+ /**
33
+ * Top-level namespace.
34
+ *
35
+ * @namespace bradford
36
+ */
37
+ var bradford = {};
38
+
39
+ /**
40
+ * @name cdf
41
+ * @memberof bradford
42
+ * @readonly
43
+ * @type {Function}
44
+ * @see {@link module:@stdlib/stats/base/dists/bradford/cdf}
45
+ */
46
+ setReadOnly( bradford, 'cdf', require( '@stdlib/stats-base-dists-bradford-cdf' ) );
47
+
48
+ /**
49
+ * @name entropy
50
+ * @memberof bradford
51
+ * @readonly
52
+ * @type {Function}
53
+ * @see {@link module:@stdlib/stats/base/dists/bradford/entropy}
54
+ */
55
+ setReadOnly( bradford, 'entropy', require( '@stdlib/stats-base-dists-bradford-entropy' ) );
56
+
57
+ /**
58
+ * @name mean
59
+ * @memberof bradford
60
+ * @readonly
61
+ * @type {Function}
62
+ * @see {@link module:@stdlib/stats/base/dists/bradford/mean}
63
+ */
64
+ setReadOnly( bradford, 'mean', require( '@stdlib/stats-base-dists-bradford-mean' ) );
65
+
66
+ /**
67
+ * @name median
68
+ * @memberof bradford
69
+ * @readonly
70
+ * @type {Function}
71
+ * @see {@link module:@stdlib/stats/base/dists/bradford/median}
72
+ */
73
+ setReadOnly( bradford, 'median', require( '@stdlib/stats-base-dists-bradford-median' ) );
74
+
75
+ /**
76
+ * @name mode
77
+ * @memberof bradford
78
+ * @readonly
79
+ * @type {Function}
80
+ * @see {@link module:@stdlib/stats/base/dists/bradford/mode}
81
+ */
82
+ setReadOnly( bradford, 'mode', require( '@stdlib/stats-base-dists-bradford-mode' ) );
83
+
84
+ /**
85
+ * @name pdf
86
+ * @memberof bradford
87
+ * @readonly
88
+ * @type {Function}
89
+ * @see {@link module:@stdlib/stats/base/dists/bradford/pdf}
90
+ */
91
+ setReadOnly( bradford, 'pdf', require( '@stdlib/stats-base-dists-bradford-pdf' ) );
92
+
93
+ /**
94
+ * @name quantile
95
+ * @memberof bradford
96
+ * @readonly
97
+ * @type {Function}
98
+ * @see {@link module:@stdlib/stats/base/dists/bradford/quantile}
99
+ */
100
+ setReadOnly( bradford, 'quantile', require( '@stdlib/stats-base-dists-bradford-quantile' ) );
101
+
102
+ /**
103
+ * @name skewness
104
+ * @memberof bradford
105
+ * @readonly
106
+ * @type {Function}
107
+ * @see {@link module:@stdlib/stats/base/dists/bradford/skewness}
108
+ */
109
+ setReadOnly( bradford, 'skewness', require( '@stdlib/stats-base-dists-bradford-skewness' ) );
110
+
111
+ /**
112
+ * @name stdev
113
+ * @memberof bradford
114
+ * @readonly
115
+ * @type {Function}
116
+ * @see {@link module:@stdlib/stats/base/dists/bradford/stdev}
117
+ */
118
+ setReadOnly( bradford, 'stdev', require( '@stdlib/stats-base-dists-bradford-stdev' ) );
119
+
120
+ /**
121
+ * @name variance
122
+ * @memberof bradford
123
+ * @readonly
124
+ * @type {Function}
125
+ * @see {@link module:@stdlib/stats/base/dists/bradford/variance}
126
+ */
127
+ setReadOnly( bradford, 'variance', require( '@stdlib/stats-base-dists-bradford-variance' ) );
128
+
129
+
130
+ // EXPORTS //
131
+
132
+ module.exports = bradford;
package/package.json ADDED
@@ -0,0 +1,82 @@
1
+ {
2
+ "name": "@stdlib/stats-base-dists-bradford",
3
+ "version": "0.1.0",
4
+ "description": "Bradford distribution.",
5
+ "license": "Apache-2.0",
6
+ "author": {
7
+ "name": "The Stdlib Authors",
8
+ "url": "https://github.com/stdlib-js/stdlib/graphs/contributors"
9
+ },
10
+ "contributors": [
11
+ {
12
+ "name": "The Stdlib Authors",
13
+ "url": "https://github.com/stdlib-js/stdlib/graphs/contributors"
14
+ }
15
+ ],
16
+ "main": "./lib",
17
+ "directories": {
18
+ "doc": "./docs",
19
+ "lib": "./lib",
20
+ "dist": "./dist"
21
+ },
22
+ "types": "./docs/types",
23
+ "scripts": {},
24
+ "homepage": "https://stdlib.io",
25
+ "repository": {
26
+ "type": "git",
27
+ "url": "git://github.com/stdlib-js/stats-base-dists-bradford.git"
28
+ },
29
+ "bugs": {
30
+ "url": "https://github.com/stdlib-js/stdlib/issues"
31
+ },
32
+ "dependencies": {
33
+ "@stdlib/stats-base-dists-bradford-cdf": "^0.1.0",
34
+ "@stdlib/stats-base-dists-bradford-entropy": "^0.1.0",
35
+ "@stdlib/stats-base-dists-bradford-mean": "^0.1.0",
36
+ "@stdlib/stats-base-dists-bradford-median": "^0.1.0",
37
+ "@stdlib/stats-base-dists-bradford-mode": "^0.1.0",
38
+ "@stdlib/stats-base-dists-bradford-pdf": "^0.1.0",
39
+ "@stdlib/stats-base-dists-bradford-quantile": "github:stdlib-js/stats-base-dists-bradford-quantile#main",
40
+ "@stdlib/stats-base-dists-bradford-skewness": "^0.1.0",
41
+ "@stdlib/stats-base-dists-bradford-stdev": "^0.1.0",
42
+ "@stdlib/stats-base-dists-bradford-variance": "^0.1.0",
43
+ "@stdlib/utils-define-read-only-property": "^0.2.2"
44
+ },
45
+ "devDependencies": {},
46
+ "engines": {
47
+ "node": ">=0.10.0",
48
+ "npm": ">2.7.0"
49
+ },
50
+ "os": [
51
+ "aix",
52
+ "darwin",
53
+ "freebsd",
54
+ "linux",
55
+ "macos",
56
+ "openbsd",
57
+ "sunos",
58
+ "win32",
59
+ "windows"
60
+ ],
61
+ "keywords": [
62
+ "stdlib",
63
+ "stdmath",
64
+ "standard",
65
+ "library",
66
+ "std",
67
+ "lib",
68
+ "statistics",
69
+ "stats",
70
+ "probability",
71
+ "prob",
72
+ "distribution",
73
+ "dist",
74
+ "bradford",
75
+ "univariate",
76
+ "continuous"
77
+ ],
78
+ "funding": {
79
+ "type": "opencollective",
80
+ "url": "https://opencollective.com/stdlib"
81
+ }
82
+ }