Skip to content

Commit 352993d

Browse files
docs: improve examples of stats/base/dists/studentized-range
PR-URL: #2183 Closes: #1644 --------- Signed-off-by: Rejoan Sardar <119718513+Rejoan-Sardar@users.noreply.github.com> Co-authored-by: Philipp Burckhardt <pburckhardt@outlook.com> Reviewed-by: Philipp Burckhardt <pburckhardt@outlook.com>
1 parent b981bc3 commit 352993d

File tree

2 files changed

+34
-4
lines changed

2 files changed

+34
-4
lines changed

lib/node_modules/@stdlib/stats/base/dists/studentized-range/README.md

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,25 @@ The namespace contains the following distribution functions:
6565
<!-- eslint no-undef: "error" -->
6666

6767
```javascript
68-
var objectKeys = require( '@stdlib/utils/keys' );
6968
var tukey = require( '@stdlib/stats/base/dists/studentized-range' );
7069

71-
console.log( objectKeys( tukey ) );
70+
/*
71+
* Let's consider an example where we are analyzing the test scores of students in a class.
72+
* We're interested in using the Studentized Range Distribution to analyze the range of scores.
73+
* The distribution has parameters: r (number of means), v (degrees of freedom), and nranges (number of ranges).
74+
*/
75+
76+
var r = 5.0;
77+
var v = 20.0;
78+
var nranges = 3.0;
79+
80+
// CDF can be used to calculate the cumulative distribution function at a specific value:
81+
var out = tukey.cdf( 2.0, r, v, nranges );
82+
// returns ~0.074
83+
84+
// Quantile can also be used to calculate the quantile function at a specific probability:
85+
out = tukey.quantile( 0.9, r, v, nranges );
86+
// returns ~4.433
7287
```
7388

7489
</section>

lib/node_modules/@stdlib/stats/base/dists/studentized-range/examples/index.js

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,22 @@
1818

1919
'use strict';
2020

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

24-
console.log( objectKeys( tukey ) );
23+
/*
24+
* Let's consider an example where we are analyzing the test scores of students in a class.
25+
* We're interested in using the Studentized Range Distribution to analyze the range of scores.
26+
* The distribution has parameters: r (number of means), v (degrees of freedom), and nranges (number of ranges).
27+
*/
28+
29+
var r = 5.0;
30+
var v = 20.0;
31+
var nranges = 3.0;
32+
33+
// CDF can be used to calculate the cumulative distribution function at a specific value:
34+
console.log( tukey.cdf( 2.0, r, v, nranges ) );
35+
// => ~0.074
36+
37+
// Quantile can also be used to calculate the quantile function at a specific probability:
38+
console.log( tukey.quantile( 0.9, r, v, nranges ) );
39+
// => ~4.433

0 commit comments

Comments
 (0)