@stdlib/stats-base-dists-f-kurtosis 0.2.2 → 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
@@ -78,7 +78,7 @@ var kurtosis = require( '@stdlib/stats-base-dists-f-kurtosis' );
78
78
 
79
79
  #### kurtosis( d1, d2 )
80
80
 
81
- Returns the [excess kurtosis][kurtosis] of a [F][f-distribution] distribution with parameters `d1` (numerator degrees of freedom) and `d2` (denominator degrees of freedom).
81
+ Returns the [excess kurtosis][kurtosis] of an [F][f-distribution] distribution with parameters `d1` (numerator degrees of freedom) and `d2` (denominator degrees of freedom).
82
82
 
83
83
  ```javascript
84
84
  var v = kurtosis( 4.0, 9.0 );
@@ -145,20 +145,109 @@ v = kurtosis( 3.0, -1.0 );
145
145
  <!-- eslint no-undef: "error" -->
146
146
 
147
147
  ```javascript
148
- var randu = require( '@stdlib/random-base-randu' );
148
+ var uniform = require( '@stdlib/random-array-uniform' );
149
+ var logEachMap = require( '@stdlib/console-log-each-map' );
149
150
  var EPS = require( '@stdlib/constants-float64-eps' );
150
151
  var kurtosis = require( '@stdlib/stats-base-dists-f-kurtosis' );
151
152
 
152
- var d1;
153
- var d2;
154
- var v;
155
- var i;
153
+ var opts = {
154
+ 'dtype': 'float64'
155
+ };
156
+ var d1 = uniform( 10, EPS, 10.0, opts );
157
+ var d2 = uniform( 10, EPS, 20.0, opts );
156
158
 
157
- for ( i = 0; i < 10; i++ ) {
158
- d1 = ( randu()*10.0 ) + EPS;
159
- d2 = ( randu()*20.0 ) + EPS;
160
- v = kurtosis( d1, d2 );
161
- console.log( 'd1: %d, d2: %d, skew(X;d1,d2): %d', d1.toFixed( 4 ), d2.toFixed( 4 ), v.toFixed( 4 ) );
159
+ logEachMap( 'd1: %0.4f, d2: %0.4f, Kurt(X;d1,d2): %0.4f', d1, d2, kurtosis );
160
+ ```
161
+
162
+ </section>
163
+
164
+ <!-- /.examples -->
165
+
166
+ <!-- C interface documentation. -->
167
+
168
+ * * *
169
+
170
+ <section class="c">
171
+
172
+ ## C APIs
173
+
174
+ <!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
175
+
176
+ <section class="intro">
177
+
178
+ </section>
179
+
180
+ <!-- /.intro -->
181
+
182
+ <!-- C usage documentation. -->
183
+
184
+ <section class="usage">
185
+
186
+ ### Usage
187
+
188
+ ```c
189
+ #include "stdlib/stats/base/dists/f/kurtosis.h"
190
+ ```
191
+
192
+ #### stdlib_base_dists_f_kurtosis( d1, d2 )
193
+
194
+ Evaluates the [excess kurtosis][kurtosis] of an [F][f-distribution] distribution with parameters `d1` (numerator degrees of freedom) and `d2` (denominator degrees of freedom).
195
+
196
+ ```c
197
+ double out = stdlib_base_dists_f_kurtosis( 3.0, 9.0 );
198
+ // returns ~124.667
199
+ ```
200
+
201
+ The function accepts the following arguments:
202
+
203
+ - **d1**: `[in] double` numerator degrees of freedom.
204
+ - **d2**: `[in] double` denominator degrees of freedom.
205
+
206
+ ```c
207
+ double stdlib_base_dists_f_kurtosis( const double d1, const double d2 );
208
+ ```
209
+
210
+ </section>
211
+
212
+ <!-- /.usage -->
213
+
214
+ <!-- C API usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
215
+
216
+ <section class="notes">
217
+
218
+ </section>
219
+
220
+ <!-- /.notes -->
221
+
222
+ <!-- C API usage examples. -->
223
+
224
+ <section class="examples">
225
+
226
+ ### Examples
227
+
228
+ ```c
229
+ #include "stdlib/stats/base/dists/f/kurtosis.h"
230
+ #include "stdlib/constants/float64/eps.h"
231
+ #include <stdlib.h>
232
+ #include <stdio.h>
233
+
234
+ static double random_uniform( const double min, const double max ) {
235
+ double v = (double)rand() / ( (double)RAND_MAX + 1.0 );
236
+ return min + ( v*(max-min) );
237
+ }
238
+
239
+ int main( void ) {
240
+ double d1;
241
+ double d2;
242
+ double y;
243
+ int i;
244
+
245
+ for ( i = 0; i < 25; i++ ) {
246
+ d1 = random_uniform( STDLIB_CONSTANT_FLOAT64_EPS, 10.0 );
247
+ d1 = random_uniform( STDLIB_CONSTANT_FLOAT64_EPS, 10.0 );
248
+ y = stdlib_base_dists_f_kurtosis( d1, d2 );
249
+ printf( "d1: %lf, d2: %lf, Kurt(X;d1,d2): %lf\n", d1, d2, y );
250
+ }
162
251
  }
163
252
  ```
164
253
 
@@ -166,6 +255,10 @@ for ( i = 0; i < 10; i++ ) {
166
255
 
167
256
  <!-- /.examples -->
168
257
 
258
+ </section>
259
+
260
+ <!-- /.c -->
261
+
169
262
  <!-- Section to include cited references. If references are included, add a horizontal rule *before* the section. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
170
263
 
171
264
  <section class="references">
@@ -208,7 +301,7 @@ See [LICENSE][stdlib-license].
208
301
 
209
302
  ## Copyright
210
303
 
211
- Copyright &copy; 2016-2024. The Stdlib [Authors][stdlib-authors].
304
+ Copyright &copy; 2016-2026. The Stdlib [Authors][stdlib-authors].
212
305
 
213
306
  </section>
214
307
 
@@ -221,8 +314,8 @@ Copyright &copy; 2016-2024. The Stdlib [Authors][stdlib-authors].
221
314
  [npm-image]: http://img.shields.io/npm/v/@stdlib/stats-base-dists-f-kurtosis.svg
222
315
  [npm-url]: https://npmjs.org/package/@stdlib/stats-base-dists-f-kurtosis
223
316
 
224
- [test-image]: https://github.com/stdlib-js/stats-base-dists-f-kurtosis/actions/workflows/test.yml/badge.svg?branch=v0.2.2
225
- [test-url]: https://github.com/stdlib-js/stats-base-dists-f-kurtosis/actions/workflows/test.yml?query=branch:v0.2.2
317
+ [test-image]: https://github.com/stdlib-js/stats-base-dists-f-kurtosis/actions/workflows/test.yml/badge.svg?branch=v0.3.0
318
+ [test-url]: https://github.com/stdlib-js/stats-base-dists-f-kurtosis/actions/workflows/test.yml?query=branch:v0.3.0
226
319
 
227
320
  [coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/stats-base-dists-f-kurtosis/main.svg
228
321
  [coverage-url]: https://codecov.io/github/stdlib-js/stats-base-dists-f-kurtosis?branch=main
@@ -234,8 +327,8 @@ Copyright &copy; 2016-2024. The Stdlib [Authors][stdlib-authors].
234
327
 
235
328
  -->
236
329
 
237
- [chat-image]: https://img.shields.io/gitter/room/stdlib-js/stdlib.svg
238
- [chat-url]: https://app.gitter.im/#/room/#stdlib-js_stdlib:gitter.im
330
+ [chat-image]: https://img.shields.io/badge/zulip-join_chat-brightgreen.svg
331
+ [chat-url]: https://stdlib.zulipchat.com
239
332
 
240
333
  [stdlib]: https://github.com/stdlib-js/stdlib
241
334
 
package/dist/index.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
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 pow = require( '@stdlib/math-base-special-pow' );\n\n\n// MAIN //\n\n/**\n* Returns the excess kurtosis of an F distribution.\n*\n* @param {PositiveNumber} d1 - numerator degrees of freedom\n* @param {PositiveNumber} d2 - denominator degrees of freedom\n* @returns {PositiveNumber} kurtosis\n*\n* @example\n* var v = kurtosis( 3.0, 9.0 );\n* // returns ~124.667\n*\n* @example\n* var v = kurtosis( 4.0, 12.0 );\n* // returns ~26.143\n*\n* @example\n* var v = kurtosis( 8.0, 9.0 );\n* // returns ~100.167\n*\n* @example\n* var v = kurtosis( 1.0, 8.0 );\n* // returns NaN\n*\n* @example\n* var v = kurtosis( 1.0, -0.1 );\n* // returns NaN\n*\n* @example\n* var v = kurtosis( -0.1, 1.0 );\n* // returns NaN\n*\n* @example\n* var v = kurtosis( 2.0, NaN );\n* // returns NaN\n*\n* @example\n* var v = kurtosis( NaN, 2.0 );\n* // returns NaN\n*/\nfunction kurtosis( d1, d2 ) {\n\tvar denom;\n\tvar num;\n\n\tif ( d1 <= 0.0 || d2 <= 8.0 ) {\n\t\treturn NaN;\n\t}\n\tnum = ( d1 * ( ( 5.0*d2 ) - 22.0 ) * ( d1+d2-2.0 ) ) +\n\t\t( ( d2-4.0 ) * pow( d2-2.0, 2.0 ) );\n\tdenom = d1 * ( d2-6.0 ) * ( d2-8.0 ) * ( d1+d2-2.0 );\n\treturn 12.0 * num / denom;\n}\n\n\n// EXPORTS //\n\nmodule.exports = kurtosis;\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* F distribution excess kurtosis.\n*\n* @module @stdlib/stats-base-dists-f-kurtosis\n*\n* @example\n* var kurtosis = require( '@stdlib/stats-base-dists-f-kurtosis' );\n*\n* var v = kurtosis( 3.0, 9.0 );\n* // returns ~124.667\n*\n* v = kurtosis( 4.0, 12.0 );\n* // returns ~26.143\n*\n* v = kurtosis( 8.0, 9.0 );\n* // returns ~100.167\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\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 pow = require( '@stdlib/math-base-special-pow' );\n\n\n// MAIN //\n\n/**\n* Returns the excess kurtosis of an F distribution.\n*\n* @param {PositiveNumber} d1 - numerator degrees of freedom\n* @param {PositiveNumber} d2 - denominator degrees of freedom\n* @returns {PositiveNumber} excess kurtosis\n*\n* @example\n* var v = kurtosis( 3.0, 9.0 );\n* // returns ~124.667\n*\n* @example\n* var v = kurtosis( 4.0, 12.0 );\n* // returns ~26.143\n*\n* @example\n* var v = kurtosis( 8.0, 9.0 );\n* // returns ~100.167\n*\n* @example\n* var v = kurtosis( 1.0, 8.0 );\n* // returns NaN\n*\n* @example\n* var v = kurtosis( 1.0, -0.1 );\n* // returns NaN\n*\n* @example\n* var v = kurtosis( -0.1, 1.0 );\n* // returns NaN\n*\n* @example\n* var v = kurtosis( 2.0, NaN );\n* // returns NaN\n*\n* @example\n* var v = kurtosis( NaN, 2.0 );\n* // returns NaN\n*/\nfunction kurtosis( d1, d2 ) {\n\tvar denom;\n\tvar num;\n\n\tif ( d1 <= 0.0 || d2 <= 8.0 ) {\n\t\treturn NaN;\n\t}\n\tnum = ( d1 * ( ( 5.0*d2 ) - 22.0 ) * ( d1+d2-2.0 ) ) +\n\t\t( ( d2-4.0 ) * pow( d2-2.0, 2.0 ) );\n\tdenom = d1 * ( d2-6.0 ) * ( d2-8.0 ) * ( d1+d2-2.0 );\n\treturn 12.0 * num / denom;\n}\n\n\n// EXPORTS //\n\nmodule.exports = kurtosis;\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* F distribution excess kurtosis.\n*\n* @module @stdlib/stats-base-dists-f-kurtosis\n*\n* @example\n* var kurtosis = require( '@stdlib/stats-base-dists-f-kurtosis' );\n*\n* var v = kurtosis( 3.0, 9.0 );\n* // returns ~124.667\n*\n* v = kurtosis( 4.0, 12.0 );\n* // returns ~26.143\n*\n* v = kurtosis( 8.0, 9.0 );\n* // returns ~100.167\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"],
5
5
  "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAM,QAAS,+BAAgC,EA4CnD,SAASC,EAAUC,EAAIC,EAAK,CAC3B,IAAIC,EACAC,EAEJ,OAAKH,GAAM,GAAOC,GAAM,EAChB,KAERE,EAAQH,GAAS,EAAIC,EAAO,KAAWD,EAAGC,EAAG,IACxCA,EAAG,GAAQH,EAAKG,EAAG,EAAK,CAAI,EACjCC,EAAQF,GAAOC,EAAG,IAAUA,EAAG,IAAUD,EAAGC,EAAG,GACxC,GAAOE,EAAMD,EACrB,CAKAL,EAAO,QAAUE,IC1CjB,IAAIK,EAAO,IAKX,OAAO,QAAUA",
6
6
  "names": ["require_main", "__commonJSMin", "exports", "module", "pow", "kurtosis", "d1", "d2", "denom", "num", "main"]
7
7
  }
@@ -0,0 +1,38 @@
1
+ /**
2
+ * @license Apache-2.0
3
+ *
4
+ * Copyright (c) 2024 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
+ #ifndef STDLIB_STATS_BASE_DISTS_F_KURTOSIS_H
20
+ #define STDLIB_STATS_BASE_DISTS_F_KURTOSIS_H
21
+
22
+ /*
23
+ * If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler.
24
+ */
25
+ #ifdef __cplusplus
26
+ extern "C" {
27
+ #endif
28
+
29
+ /**
30
+ * Returns the excess kurtosis of an F distribution.
31
+ */
32
+ double stdlib_base_dists_f_kurtosis( const double d1, const double d2 );
33
+
34
+ #ifdef __cplusplus
35
+ }
36
+ #endif
37
+
38
+ #endif // !STDLIB_STATS_BASE_DISTS_F_KURTOSIS_H
package/lib/main.js CHANGED
@@ -30,7 +30,7 @@ var pow = require( '@stdlib/math-base-special-pow' );
30
30
  *
31
31
  * @param {PositiveNumber} d1 - numerator degrees of freedom
32
32
  * @param {PositiveNumber} d2 - denominator degrees of freedom
33
- * @returns {PositiveNumber} kurtosis
33
+ * @returns {PositiveNumber} excess kurtosis
34
34
  *
35
35
  * @example
36
36
  * var v = kurtosis( 3.0, 9.0 );
package/lib/native.js ADDED
@@ -0,0 +1,75 @@
1
+ /**
2
+ * @license Apache-2.0
3
+ *
4
+ * Copyright (c) 2024 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
+ // MODULES //
22
+
23
+ var addon = require( './../src/addon.node' );
24
+
25
+
26
+ // MAIN //
27
+
28
+ /**
29
+ * Returns the excess kurtosis of an F distribution.
30
+ *
31
+ * @private
32
+ * @param {PositiveNumber} d1 - numerator degrees of freedom
33
+ * @param {PositiveNumber} d2 - denominator degrees of freedom
34
+ * @returns {PositiveNumber} excess kurtosis
35
+ *
36
+ * @example
37
+ * var v = kurtosis( 3.0, 9.0 );
38
+ * // returns ~124.667
39
+ *
40
+ * @example
41
+ * var v = kurtosis( 4.0, 12.0 );
42
+ * // returns ~26.143
43
+ *
44
+ * @example
45
+ * var v = kurtosis( 8.0, 9.0 );
46
+ * // returns ~100.167
47
+ *
48
+ * @example
49
+ * var v = kurtosis( 1.0, 8.0 );
50
+ * // returns NaN
51
+ *
52
+ * @example
53
+ * var v = kurtosis( 1.0, -0.1 );
54
+ * // returns NaN
55
+ *
56
+ * @example
57
+ * var v = kurtosis( -0.1, 1.0 );
58
+ * // returns NaN
59
+ *
60
+ * @example
61
+ * var v = kurtosis( 2.0, NaN );
62
+ * // returns NaN
63
+ *
64
+ * @example
65
+ * var v = kurtosis( NaN, 2.0 );
66
+ * // returns NaN
67
+ */
68
+ function kurtosis( d1, d2 ) {
69
+ return addon( d1, d2 );
70
+ }
71
+
72
+
73
+ // EXPORTS //
74
+
75
+ module.exports = kurtosis;
package/manifest.json ADDED
@@ -0,0 +1,78 @@
1
+ {
2
+ "options": {
3
+ "task": "build",
4
+ "wasm": false
5
+ },
6
+ "fields": [
7
+ {
8
+ "field": "src",
9
+ "resolve": true,
10
+ "relative": true
11
+ },
12
+ {
13
+ "field": "include",
14
+ "resolve": true,
15
+ "relative": true
16
+ },
17
+ {
18
+ "field": "libraries",
19
+ "resolve": false,
20
+ "relative": false
21
+ },
22
+ {
23
+ "field": "libpath",
24
+ "resolve": true,
25
+ "relative": false
26
+ }
27
+ ],
28
+ "confs": [
29
+ {
30
+ "task": "build",
31
+ "wasm": false,
32
+ "src": [
33
+ "./src/main.c"
34
+ ],
35
+ "include": [
36
+ "./include"
37
+ ],
38
+ "libraries": [],
39
+ "libpath": [],
40
+ "dependencies": [
41
+ "@stdlib/math-base-napi-binary",
42
+ "@stdlib/math-base-special-pow"
43
+ ]
44
+ },
45
+ {
46
+ "task": "benchmark",
47
+ "wasm": false,
48
+ "src": [
49
+ "./src/main.c"
50
+ ],
51
+ "include": [
52
+ "./include"
53
+ ],
54
+ "libraries": [],
55
+ "libpath": [],
56
+ "dependencies": [
57
+ "@stdlib/math-base-special-pow",
58
+ "@stdlib/constants-float64-eps"
59
+ ]
60
+ },
61
+ {
62
+ "task": "examples",
63
+ "wasm": false,
64
+ "src": [
65
+ "./src/main.c"
66
+ ],
67
+ "include": [
68
+ "./include"
69
+ ],
70
+ "libraries": [],
71
+ "libpath": [],
72
+ "dependencies": [
73
+ "@stdlib/math-base-special-pow",
74
+ "@stdlib/constants-float64-eps"
75
+ ]
76
+ }
77
+ ]
78
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stdlib/stats-base-dists-f-kurtosis",
3
- "version": "0.2.2",
3
+ "version": "0.3.0",
4
4
  "description": "F distribution excess kurtosis.",
5
5
  "license": "Apache-2.0",
6
6
  "author": {
@@ -14,9 +14,12 @@
14
14
  }
15
15
  ],
16
16
  "main": "./lib",
17
+ "gypfile": false,
17
18
  "directories": {
18
19
  "doc": "./docs",
20
+ "include": "./include",
19
21
  "lib": "./lib",
22
+ "src": "./src",
20
23
  "dist": "./dist"
21
24
  },
22
25
  "types": "./docs/types",
@@ -30,7 +33,9 @@
30
33
  "url": "https://github.com/stdlib-js/stdlib/issues"
31
34
  },
32
35
  "dependencies": {
33
- "@stdlib/math-base-special-pow": "^0.3.0"
36
+ "@stdlib/math-base-napi-binary": "^0.3.1",
37
+ "@stdlib/math-base-special-pow": "^0.3.0",
38
+ "@stdlib/utils-library-manifest": "^0.2.3"
34
39
  },
35
40
  "devDependencies": {},
36
41
  "engines": {
package/src/addon.c ADDED
@@ -0,0 +1,22 @@
1
+ /**
2
+ * @license Apache-2.0
3
+ *
4
+ * Copyright (c) 2024 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
+ #include "stdlib/stats/base/dists/f/kurtosis.h"
20
+ #include "stdlib/math/base/napi/binary.h"
21
+
22
+ STDLIB_MATH_BASE_NAPI_MODULE_DD_D( stdlib_base_dists_f_kurtosis )
package/src/main.c ADDED
@@ -0,0 +1,43 @@
1
+ /**
2
+ * @license Apache-2.0
3
+ *
4
+ * Copyright (c) 2024 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
+ #include "stdlib/stats/base/dists/f/kurtosis.h"
20
+ #include "stdlib/math/base/special/pow.h"
21
+
22
+ /**
23
+ * Returns the excess kurtosis of an F distribution.
24
+ *
25
+ * @param d1 numerator degrees of freedom
26
+ * @param d2 denominator degrees of freedom
27
+ * @return excess kurtosis
28
+ *
29
+ * @example
30
+ * double y = stdlib_base_dists_f_kurtosis( 3.0, 9.0 );
31
+ * // returns ~124.667
32
+ */
33
+ double stdlib_base_dists_f_kurtosis( const double d1, const double d2 ) {
34
+ double denom;
35
+ double num;
36
+
37
+ if ( d1 <= 0.0 || d2 <= 8.0 ) {
38
+ return 0.0/0.0; // NaN
39
+ }
40
+ num = ( d1 * ( ( 5.0*d2 ) - 22.0 ) * ( d1+d2-2.0 ) ) + ( ( d2-4.0 ) * stdlib_base_pow( d2-2.0, 2.0 ) );
41
+ denom = d1 * ( d2-6.0 ) * ( d2-8.0 ) * ( d1+d2-2.0 );
42
+ return 12.0 * num / denom;
43
+ }