Skip to content

docs: improve README examples of stats/base/dists/signrank namespace #1849

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
101 changes: 100 additions & 1 deletion lib/node_modules/@stdlib/stats/base/dists/signrank/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@ var signrank = require( '@stdlib/stats/base/dists/signrank' );

Distribution of the Wilcoxon signed rank test statistic.

The Wilcoxon distribution is a discrete, bell-shaped, non-negative distribution, which describes the distribution of the U-statistic in the Mann-Whitney-Wilcoxon Rank-Sum test when comparing two unpaired samples drawn from the same arbitrary distribution. The rank-sum test is perhaps the most commonly used non-parametric significance test in statistics to detect when one distribution is stochastically greater (or not-equal) to another without making assumption that the underlying distributions are normally distributed.

Reference: <br>
- [Wikipedia](https://en.wikipedia.org/wiki/Wilcoxon_signed-rank_test) <br>
- [Analytica](https://docs.analytica.com/index.php/Wilcoxon_Distribution)


```javascript
var dist = signrank;
// returns {...}
Expand Down Expand Up @@ -63,15 +70,107 @@ The namespace contains the following distribution functions:

<!-- TODO: better examples -->

<!-- eslint no-undef: "error" -->

<!-- eslint no-undef: "error" -->
### Object Keys
```javascript
var objectKeys = require( '@stdlib/utils/keys' );
var signrank = require( '@stdlib/stats/base/dists/signrank' );

console.log( objectKeys( signrank ) );
```

### Cumulative Distribution Function (CDF)
```javascript
var cdf = require( '@stdlib/stats/base/dists/signrank/cdf' );
```
#### cdf( x, n )

Evaluates the [cumulative distribution function][cdf] of the Wilcoxon signed rank test statistic with `n` observations.

```javascript
var y = cdf( 7.0, 9 );
// returns ~0.037

y = cdf( 7.0, 6 );
// returns ~0.281

y = cdf( -1.0, 40 );
// returns 0.0
```

#### cdf.factory( n )

Returns a function for evaluating the [cumulative distribution function][cdf] of the Wilcoxon signed rank test statistic with `n` observations.

```javascript
var mycdf = cdf.factory( 8 );
var y = mycdf( 3.9 );
// returns ~0.027

y = mycdf( 17.0 );
// returns ~0.473
```

### Probability Distribution Function (PDF)
```javascript
var pdf = require( '@stdlib/stats/base/dists/signrank/pdf' );
```
#### pdf( x, n )
Evaluates the [probability density function][pdf] of the Wilcoxon signed rank test statistic with `n` observations.
```javascript
var y = pdf( 7.0, 9 );
// returns ~0.0098

y = pdf( 7.0, 6 );
// returns ~0.063

y = pdf( -1.0, 40 );
// returns 0.0
```

#### pdf.factory( n )
Returns a function for evaluating the [probability density function][pdf] of the Wilcoxon signed rank test statistic with `n` observations.
```javascript
var mypdf = pdf.factory( 8 );
var y = mypdf( 4.0 );
// returns ~0.008

y = mypdf( 17.0 );
// returns ~0.051
```

### Quantile Function
```javascript
var quantile = require( '@stdlib/stats/base/dists/signrank/quantile' );
```
#### quantile( p, n )

Evaluates the [quantile function][quantile-function] for the Wilcoxon signed rank test statistic with `n` observations.

```javascript
var y = quantile( 0.8, 5 );
// returns 11

y = quantile( 0.5, 3 );
// returns 3
```

#### quantile.factory( n )

Returns a function for evaluating the [quantile function][quantile-function] of the Wilcoxon signed rank test statistic with `n` observations.

```javascript
var myQuantile = quantile.factory( 8 );

var y = myQuantile( 0.4 );
// returns 16

y = myQuantile( 1.0 );
// returns 36
```


</section>

<!-- /.examples -->
Expand Down