Skip to content

Commit c4066d8

Browse files
Jai0401Utkarsh Gupta
authored and
Utkarsh Gupta
committed
docs: improve README examples for stats/base/dists/t namespace
PR-URL: stdlib-js#1728 Closes: stdlib-js#1645 Reviewed-by: Athan Reines <[email protected]> Reviewed-by: Philipp Burckhardt <[email protected]>
1 parent 4ce2d22 commit c4066d8

File tree

2 files changed

+30
-4
lines changed

2 files changed

+30
-4
lines changed

Diff for: lib/node_modules/@stdlib/stats/base/dists/t/README.md

+15-2
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,23 @@ var y = dist.cdf( 0.5 );
108108
<!-- eslint no-undef: "error" -->
109109

110110
```javascript
111-
var objectKeys = require( '@stdlib/utils/keys' );
112111
var t = require( '@stdlib/stats/base/dists/t' );
113112

114-
console.log( objectKeys( t ) );
113+
var dof = 3;
114+
var x = 1.5;
115+
116+
// Evaluate the probability density function (PDF) at a specific value:
117+
var res = t.pdf( x, dof );
118+
console.log( 'PDF at x = ' + x + ': ' + res );
119+
120+
// Evaluate the cumulative distribution function (CDF) at a specific value:
121+
res = t.cdf( x, dof );
122+
console.log( 'CDF at x = ' + x + ': ' + res );
123+
124+
// Get the mean and variance of the t distribution:
125+
var mu = t.mean( dof );
126+
var v = t.variance( dof );
127+
console.log( 'Mean: ' + mu + ', Variance: ' + v );
115128
```
116129

117130
</section>

Diff for: lib/node_modules/@stdlib/stats/base/dists/t/examples/index.js

+15-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,20 @@
1818

1919
'use strict';
2020

21-
var objectKeys = require( '@stdlib/utils/keys' );
2221
var t = require( './../lib' );
2322

24-
console.log( objectKeys( t ) );
23+
var dof = 3;
24+
var x = 1.5;
25+
26+
// Evaluate the probability density function (PDF) at a specific value:
27+
var res = t.pdf( x, dof );
28+
console.log( 'PDF at x = ' + x + ': ' + res );
29+
30+
// Evaluate the cumulative distribution function (CDF) at a specific value:
31+
res = t.cdf( x, dof );
32+
console.log( 'CDF at x = ' + x + ': ' + res );
33+
34+
// Get the mean and variance of the t distribution:
35+
var mu = t.mean( dof );
36+
var v = t.variance( dof );
37+
console.log( 'Mean: ' + mu + ', Variance: ' + v );

0 commit comments

Comments
 (0)