@stdlib/stats-base-dists-chisquare-logpdf 0.2.2 → 0.2.3

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
@@ -139,20 +139,17 @@ y = myLogPDF( 1.0 );
139
139
  <!-- eslint no-undef: "error" -->
140
140
 
141
141
  ```javascript
142
- var randu = require( '@stdlib/random-base-randu' );
142
+ var uniform = require( '@stdlib/random-array-uniform' );
143
+ var logEachMap = require( '@stdlib/console-log-each-map' );
143
144
  var logpdf = require( '@stdlib/stats-base-dists-chisquare-logpdf' );
144
145
 
145
- var k;
146
- var x;
147
- var y;
148
- var i;
149
-
150
- for ( i = 0; i < 20; i++ ) {
151
- x = randu() * 10.0;
152
- k = randu() * 10.0;
153
- y = logpdf( x, k );
154
- console.log( 'x: %d, k: %d, ln(f(x;k)): %d', x.toFixed( 4 ), k.toFixed( 4 ), y.toFixed( 4 ) );
155
- }
146
+ var opts = {
147
+ 'dtype': 'float64'
148
+ };
149
+ var x = uniform( 20, 0.0, 10.0, opts );
150
+ var k = uniform( 20, 0.0, 10.0, opts );
151
+
152
+ logEachMap( 'x: %0.4f, k: %0.4f, ln(f(x;k)): %0.4f', x, k, logpdf );
156
153
  ```
157
154
 
158
155
  </section>
@@ -193,7 +190,7 @@ See [LICENSE][stdlib-license].
193
190
 
194
191
  ## Copyright
195
192
 
196
- Copyright &copy; 2016-2024. The Stdlib [Authors][stdlib-authors].
193
+ Copyright &copy; 2016-2026. The Stdlib [Authors][stdlib-authors].
197
194
 
198
195
  </section>
199
196
 
@@ -206,8 +203,8 @@ Copyright &copy; 2016-2024. The Stdlib [Authors][stdlib-authors].
206
203
  [npm-image]: http://img.shields.io/npm/v/@stdlib/stats-base-dists-chisquare-logpdf.svg
207
204
  [npm-url]: https://npmjs.org/package/@stdlib/stats-base-dists-chisquare-logpdf
208
205
 
209
- [test-image]: https://github.com/stdlib-js/stats-base-dists-chisquare-logpdf/actions/workflows/test.yml/badge.svg?branch=v0.2.2
210
- [test-url]: https://github.com/stdlib-js/stats-base-dists-chisquare-logpdf/actions/workflows/test.yml?query=branch:v0.2.2
206
+ [test-image]: https://github.com/stdlib-js/stats-base-dists-chisquare-logpdf/actions/workflows/test.yml/badge.svg?branch=v0.2.3
207
+ [test-url]: https://github.com/stdlib-js/stats-base-dists-chisquare-logpdf/actions/workflows/test.yml?query=branch:v0.2.3
211
208
 
212
209
  [coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/stats-base-dists-chisquare-logpdf/main.svg
213
210
  [coverage-url]: https://codecov.io/github/stdlib-js/stats-base-dists-chisquare-logpdf?branch=main
@@ -219,8 +216,8 @@ Copyright &copy; 2016-2024. The Stdlib [Authors][stdlib-authors].
219
216
 
220
217
  -->
221
218
 
222
- [chat-image]: https://img.shields.io/gitter/room/stdlib-js/stdlib.svg
223
- [chat-url]: https://app.gitter.im/#/room/#stdlib-js_stdlib:gitter.im
219
+ [chat-image]: https://img.shields.io/badge/zulip-join_chat-brightgreen.svg
220
+ [chat-url]: https://stdlib.zulipchat.com
224
221
 
225
222
  [stdlib]: https://github.com/stdlib-js/stdlib
226
223
 
package/dist/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  /// <reference path="../docs/types/index.d.ts" />
2
- import logPDF from '../docs/types/index';
3
- export = logPDF;
2
+ import logpdf from '../docs/types/index';
3
+ export = logpdf;
package/dist/index.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../lib/main.js", "../lib/factory.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 gammaLogPDF = require( '@stdlib/stats-base-dists-gamma-logpdf' );\n\n\n// MAIN //\n\n/**\n* Evaluates the natural logarithm of the probability density function (PDF) for a chi-squared distribution with degrees of freedom `k` at a value `x`.\n*\n* @param {number} x - input value\n* @param {NonNegativeNumber} k - degrees of freedom\n* @returns {number} evaluated logPDF\n*\n* @example\n* var y = logpdf( 0.3, 4.0 );\n* // returns ~-2.74\n*\n* @example\n* var y = logpdf( 0.7, 0.7 );\n* // returns ~-1.295\n*\n* @example\n* var y = logpdf( -1.0, 0.5 );\n* // returns -Infinity\n*\n* @example\n* var y = logpdf( 0.0, NaN );\n* // returns NaN\n*\n* @example\n* var y = logpdf( NaN, 2.0 );\n* // returns NaN\n*\n* @example\n* // Negative degrees of freedom:\n* var y = logpdf( 2.0, -1.0 );\n* // returns NaN\n*/\nfunction logpdf( x, k ) {\n\treturn gammaLogPDF( x, k/2.0, 0.5 );\n}\n\n\n// EXPORTS //\n\nmodule.exports = logpdf;\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 gammaFactory = require( '@stdlib/stats-base-dists-gamma-logpdf' ).factory;\n\n\n// MAIN //\n\n/**\n* Returns a function for evaluating the natural logarithm of the probability density function (PDF) for a chi-squared distribution with degrees of freedom `k`.\n*\n* @param {NonNegativeNumber} k - degrees of freedom\n* @returns {Function} logPDF\n*\n* @example\n* var logpdf = factory( 0.5 );\n*\n* var y = logpdf( 2.0 );\n* // returns ~-2.981\n*\n* y = logpdf( 1.0 );\n* // returns ~-1.961\n*/\nfunction factory( k ) {\n\treturn gammaFactory( k/2.0, 0.5 );\n}\n\n\n// EXPORTS //\n\nmodule.exports = factory;\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* Natural logarithm of the probability density function (PDF) for a chi-squared distribution.\n*\n* @module @stdlib/stats-base-dists-chisquare-logpdf\n*\n* @example\n* var logpdf = require( '@stdlib/stats-base-dists-chisquare-logpdf' );\n*\n* var y = logpdf( 2.0, 1.0 );\n* // returns ~-2.266\n*\n* @example\n* var factory = require( '@stdlib/stats-base-dists-chisquare-logpdf' ).factory;\n*\n* var logpdf = factory( 6.0 );\n*\n* var y = logpdf( 3.0 );\n* // returns ~-2.071\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar main = require( './main.js' );\nvar factory = require( './factory.js' );\n\n\n// MAIN //\n\nsetReadOnly( main, 'factory', factory );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"],
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 gammaLogPDF = require( '@stdlib/stats-base-dists-gamma-logpdf' );\n\n\n// MAIN //\n\n/**\n* Evaluates the natural logarithm of the probability density function (PDF) for a chi-squared distribution with degrees of freedom `k` at a value `x`.\n*\n* @param {number} x - input value\n* @param {NonNegativeNumber} k - degrees of freedom\n* @returns {number} evaluated logPDF\n*\n* @example\n* var y = logpdf( 0.3, 4.0 );\n* // returns ~-2.74\n*\n* @example\n* var y = logpdf( 0.7, 0.7 );\n* // returns ~-1.295\n*\n* @example\n* var y = logpdf( -1.0, 0.5 );\n* // returns -Infinity\n*\n* @example\n* var y = logpdf( 0.0, NaN );\n* // returns NaN\n*\n* @example\n* var y = logpdf( NaN, 2.0 );\n* // returns NaN\n*\n* @example\n* // Negative degrees of freedom:\n* var y = logpdf( 2.0, -1.0 );\n* // returns NaN\n*/\nfunction logpdf( x, k ) {\n\treturn gammaLogPDF( x, k/2.0, 0.5 );\n}\n\n\n// EXPORTS //\n\nmodule.exports = logpdf;\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 gammaFactory = require( '@stdlib/stats-base-dists-gamma-logpdf' ).factory;\n\n\n// MAIN //\n\n/**\n* Returns a function for evaluating the natural logarithm of the probability density function (PDF) for a chi-squared distribution with degrees of freedom `k`.\n*\n* @param {NonNegativeNumber} k - degrees of freedom\n* @returns {Function} logPDF\n*\n* @example\n* var logpdf = factory( 0.5 );\n*\n* var y = logpdf( 2.0 );\n* // returns ~-2.981\n*\n* y = logpdf( 1.0 );\n* // returns ~-1.961\n*/\nfunction factory( k ) {\n\treturn gammaFactory( k/2.0, 0.5 );\n}\n\n\n// EXPORTS //\n\nmodule.exports = factory;\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* Natural logarithm of the probability density function (PDF) for a chi-squared distribution.\n*\n* @module @stdlib/stats-base-dists-chisquare-logpdf\n*\n* @example\n* var logpdf = require( '@stdlib/stats-base-dists-chisquare-logpdf' );\n*\n* var y = logpdf( 2.0, 1.0 );\n* // returns ~-2.266\n*\n* @example\n* var factory = require( '@stdlib/stats-base-dists-chisquare-logpdf' ).factory;\n*\n* var logpdf = factory( 6.0 );\n*\n* var y = logpdf( 3.0 );\n* // returns ~-2.075\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar main = require( './main.js' );\nvar factory = require( './factory.js' );\n\n\n// MAIN //\n\nsetReadOnly( main, 'factory', factory );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"],
5
5
  "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAc,QAAS,uCAAwC,EAqCnE,SAASC,EAAQC,EAAGC,EAAI,CACvB,OAAOH,EAAaE,EAAGC,EAAE,EAAK,EAAI,CACnC,CAKAJ,EAAO,QAAUE,IClEjB,IAAAG,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAe,QAAS,uCAAwC,EAAE,QAoBtE,SAASC,EAASC,EAAI,CACrB,OAAOF,EAAcE,EAAE,EAAK,EAAI,CACjC,CAKAH,EAAO,QAAUE,ICPjB,IAAIE,EAAc,QAAS,uDAAwD,EAC/EC,EAAO,IACPC,EAAU,IAKdF,EAAaC,EAAM,UAAWC,CAAQ,EAKtC,OAAO,QAAUD",
6
6
  "names": ["require_main", "__commonJSMin", "exports", "module", "gammaLogPDF", "logpdf", "x", "k", "require_factory", "__commonJSMin", "exports", "module", "gammaFactory", "factory", "k", "setReadOnly", "main", "factory"]
7
7
  }
@@ -100,11 +100,11 @@ interface LogPDF {
100
100
  * var mylogpdf = logpdf.factory( 6.0 );
101
101
  *
102
102
  * y = mylogpdf( 3.0 );
103
- * // returns ~-2.071
103
+ * // returns ~-2.075
104
104
  */
105
- declare var logPDF: LogPDF;
105
+ declare var logpdf: LogPDF;
106
106
 
107
107
 
108
108
  // EXPORTS //
109
109
 
110
- export = logPDF;
110
+ export = logpdf;
package/lib/index.js CHANGED
@@ -35,7 +35,7 @@
35
35
  * var logpdf = factory( 6.0 );
36
36
  *
37
37
  * var y = logpdf( 3.0 );
38
- * // returns ~-2.071
38
+ * // returns ~-2.075
39
39
  */
40
40
 
41
41
  // MODULES //
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stdlib/stats-base-dists-chisquare-logpdf",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "description": "Natural logarithm of the probability density function (PDF) for a chi-squared distribution.",
5
5
  "license": "Apache-2.0",
6
6
  "author": {
@@ -30,8 +30,8 @@
30
30
  "url": "https://github.com/stdlib-js/stdlib/issues"
31
31
  },
32
32
  "dependencies": {
33
- "@stdlib/stats-base-dists-gamma-logpdf": "^0.2.1",
34
- "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2"
33
+ "@stdlib/stats-base-dists-gamma-logpdf": "^0.3.0",
34
+ "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.3"
35
35
  },
36
36
  "devDependencies": {},
37
37
  "engines": {