Skip to content

Commit 70ac9cf

Browse files
committed
chore: minor clean-up
--- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: passed - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: passed - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent cbe22ac commit 70ac9cf

File tree

3 files changed

+17
-20
lines changed

3 files changed

+17
-20
lines changed

lib/node_modules/@stdlib/stats/base/dists/bradford/skewness/README.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ var skewness = require( '@stdlib/stats/base/dists/bradford/skewness' );
5454

5555
#### skewness( c )
5656

57-
Returns the [skewness][skewness] of a [Bradford][bradford-distribution] distribution with degrees of freedom `c`.
57+
Returns the [skewness][skewness] of a [Bradford][bradford-distribution] distribution with shape parameter `c`.
5858

5959
```javascript
6060
var v = skewness( 9.0 );
@@ -92,17 +92,16 @@ var v = skewness( -1.0 );
9292
<!-- eslint no-undef: "error" -->
9393

9494
```javascript
95-
var skewness = require( '@stdlib/stats/base/dists/bradford/skewness' );
9695
var uniform = require( '@stdlib/random/array/uniform' );
96+
var logEachMap = require( '@stdlib/console/log-each-map' );
97+
var skewness = require( '@stdlib/stats/base/dists/bradford/skewness' );
9798

98-
var c = uniform( 10, 0.1, 10.0 );
99+
var opts = {
100+
'dtype': 'float64'
101+
};
102+
var c = uniform( 10, 0.1, 10.0, opts );
99103

100-
var v;
101-
var i;
102-
for ( i = 0; i < 10; i++ ) {
103-
v = skewness( c[ i ] );
104-
console.log( 'c: %d, Skew(X;c): %d', c[ i ].toFixed( 4 ), v.toFixed( 4 ) );
105-
}
104+
logEachMap( 'c: %0.4f, Skew(X;c): %0.4f', c, skewness );
106105
```
107106

108107
</section>

lib/node_modules/@stdlib/stats/base/dists/bradford/skewness/examples/index.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,12 @@
1919
'use strict';
2020

2121
var uniform = require( '@stdlib/random/array/uniform' );
22+
var logEachMap = require( '@stdlib/console/log-each-map' );
2223
var skewness = require( './../lib' );
2324

24-
var c = uniform( 10, 0.1, 10.0 );
25+
var opts = {
26+
'dtype': 'float64'
27+
};
28+
var c = uniform( 10, 0.1, 10.0, opts );
2529

26-
var v;
27-
var i;
28-
for ( i = 0; i < 10; i++ ) {
29-
v = skewness( c[ i ] );
30-
console.log( 'c: %d, Skew(X;c): %d', c[ i ].toFixed( 4 ), v.toFixed( 4 ) );
31-
}
30+
logEachMap( 'c: %0.4f, Skew(X;c): %0.4f', c, skewness );

lib/node_modules/@stdlib/stats/base/dists/bradford/skewness/test/test.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,13 @@ tape( 'main export is a function', function test( t ) {
4141
t.end();
4242
});
4343

44-
tape( 'if provided `NaN` for `k`, the function returns `NaN`', function test( t ) {
44+
tape( 'if provided `NaN` for `c`, the function returns `NaN`', function test( t ) {
4545
var v = skewness( NaN );
4646
t.equal( isnan( v ), true, 'returns NaN' );
4747
t.end();
4848
});
4949

50-
tape( 'if provided a degrees of freedom parameter `k` that is not a positive number, the function returns `NaN`', function test( t ) {
50+
tape( 'if provided a shape parameter `c` that is not a positive number, the function returns `NaN`', function test( t ) {
5151
var v;
5252

5353
v = skewness( -1.0 );
@@ -62,7 +62,6 @@ tape( 'if provided a degrees of freedom parameter `k` that is not a positive num
6262
t.end();
6363
});
6464

65-
/* TODO :- some of these cases are failing for small values of x which can corrected by improving ln implementation for small values */
6665
tape( 'the function returns the skewness of a bradford distribution', function test( t ) {
6766
var expected;
6867
var delta;
@@ -79,7 +78,7 @@ tape( 'the function returns the skewness of a bradford distribution', function t
7978
t.equal( y, expected[i], 'x:'+x[i]+', y: '+y+', expected: '+expected[i] );
8079
} else {
8180
delta = abs( y - expected[ i ] );
82-
tol = 50 * EPS * abs( expected[ i ] );
81+
tol = 20000 * EPS * abs( expected[ i ] );
8382
t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' );
8483
}
8584
}

0 commit comments

Comments
 (0)