<commit_before>Cumulative Distribution Function
===
[![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Coverage Status][codecov-image]][codecov-url] [![Dependencies][dependencies-image]][dependencies-url]

> [Negative Binomial](https://en.wikipedia.org/wiki/Negative Binomial_distribution) distribution [cumulative distribution function](https://en.wikipedia.org/wiki/Cumulative_distribution_function).

The [cumulative distribution function](https://en.wikipedia.org/wiki/Cumulative_distribution_function) for a [Negative Binomial](https://en.wikipedia.org/wiki/Negative Binomial_distribution) random variable is

<div class="equation" align="center" data-raw-text="F(x;r,p)=1-I_p(x+1,r)" data-equation="eq:cdf">
	<img src="https://cdn.rawgit.com/distributions-io/negbinomial-cdf/45a5117af4dd427f1bbd5b85ce065f68af1accd9/docs/img/eqn.svg" alt="Cumulative distribution function for a Negative Binomial distribution.">
	<br>
</div>

where `r` is the number of failures until experiment is stopped, `p` is the success probability in each trial and `I` is the [lower regularized incomplete beta function](https://github.com/compute-io/betainc).

## Installation

``` bash
$ npm install distributions-negative-binomial-cdf
```

For use in the browser, use [browserify](https://github.com/substack/node-browserify).


## Usage

``` javascript
var cdf = require( 'distributions-negative-binomial-cdf' );
```

#### cdf( x[, options] )

Evaluates the [cumulative distribution function](https://en.wikipedia.org/wiki/Cumulative_distribution_function) for the [Negative Binomial](https://en.wikipedia.org/wiki/Negative Binomial_distribution) distribution. `x` may be either a [`number`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number), an [`array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array), a [`typed array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Typed_arrays), or a [`matrix`](https://github.com/dstructs/matrix).

``` javascript
var matrix = require( 'dstructs-matrix' ),
	mat,
	out,
	x,
	i;

out = cdf( 1 );
// returns 0.75

x = [ -1, 0, 1, 2, 3 ];
out = cdf( x );
// returns [ 0, 0.5, 0.75, 0.875, 0.9375 ]

x = new Float32Array( x );
out = cdf( x );
// returns Float64Array( [0,0.5,0.75,0.875,0.9375] )

x = new Float32Array( 6 );
for ( i = 0; i < 6; i++ ) {
	x[ i ] = i;
}
mat = matrix( x, [3,2], 'float32' );
/*
	[ 0 1
	  2 3
	  4 5 ]
*/

out = cdf( mat );
/*
	[  0.5    0.75
	   0.875 ~0.938
	  ~0.969 ~0.984 ]
*/
```

The function accepts the following `options`:

*	__r__: number of failures until experiment is stopped. Default: `1`.
*	__p__: success probability. Default: `0.5`.
* 	__accessor__: accessor `function` for accessing `array` values.
* 	__dtype__: output [`typed array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Typed_arrays) or [`matrix`](https://github.com/dstructs/matrix) data type. Default: `float64`.
*	__copy__: `boolean` indicating if the `function` should return a new data structure. Default: `true`.
*	__path__: [deepget](https://github.com/kgryte/utils-deep-get)/[deepset](https://github.com/kgryte/utils-deep-set) key path.
*	__sep__: [deepget](https://github.com/kgryte/utils-deep-get)/[deepset](https://github.com/kgryte/utils-deep-set) key path separator. Default: `'.'`.

A [Negative Binomial](https://en.wikipedia.org/wiki/Negative Binomial_distribution) distribution is a function of 2 parameter(s): `r`(number of failures until experiment is stopped) and `p`(success probability). By default, `r` is equal to `1` and `p` is equal to `0.5`. To adjust either parameter, set the corresponding option(s).

``` javascript<commit_msg>[FIX] remove capitalization, Wikipedia links<commit_after>Cumulative Distribution Function
===
[![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Coverage Status][codecov-image]][codecov-url] [![Dependencies][dependencies-image]][dependencies-url]

> [Negative binomial](https://en.wikipedia.org/wiki/Negative_binomial_distribution) distribution [cumulative distribution function](https://en.wikipedia.org/wiki/Cumulative_distribution_function).

The [cumulative distribution function](https://en.wikipedia.org/wiki/Cumulative_distribution_function) for a [negative binomial](https://en.wikipedia.org/wiki/Negative_binomial_distribution) random variable is

<div class="equation" align="center" data-raw-text="F(x;r,p)=1-I_p(x+1,r)" data-equation="eq:cdf">
	<img src="https://cdn.rawgit.com/distributions-io/negbinomial-cdf/45a5117af4dd427f1bbd5b85ce065f68af1accd9/docs/img/eqn.svg" alt="Cumulative distribution function for a negative binomial distribution.">
	<br>
</div>

where `r` is the number of failures until experiment is stopped, `p` is the success probability in each trial and `I` is the [lower regularized incomplete beta function](https://github.com/compute-io/betainc).

## Installation

``` bash
$ npm install distributions-negative-binomial-cdf
```

For use in the browser, use [browserify](https://github.com/substack/node-browserify).


## Usage

``` javascript
var cdf = require( 'distributions-negative-binomial-cdf' );
```

#### cdf( x[, options] )

Evaluates the [cumulative distribution function](https://en.wikipedia.org/wiki/Cumulative_distribution_function) for the [negative binomial](https://en.wikipedia.org/wiki/Negative_binomial_distribution) distribution. `x` may be either a [`number`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number), an [`array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array), a [`typed array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Typed_arrays), or a [`matrix`](https://github.com/dstructs/matrix).

``` javascript
var matrix = require( 'dstructs-matrix' ),
	mat,
	out,
	x,
	i;

out = cdf( 1 );
// returns 0.75

x = [ -1, 0, 1, 2, 3 ];
out = cdf( x );
// returns [ 0, 0.5, 0.75, 0.875, 0.9375 ]

x = new Float32Array( x );
out = cdf( x );
// returns Float64Array( [0,0.5,0.75,0.875,0.9375] )

x = new Float32Array( 6 );
for ( i = 0; i < 6; i++ ) {
	x[ i ] = i;
}
mat = matrix( x, [3,2], 'float32' );
/*
	[ 0 1
	  2 3
	  4 5 ]
*/

out = cdf( mat );
/*
	[  0.5    0.75
	   0.875 ~0.938
	  ~0.969 ~0.984 ]
*/
```

The function accepts the following `options`:

*	__r__: number of failures until experiment is stopped. Default: `1`.
*	__p__: success probability. Default: `0.5`.
* 	__accessor__: accessor `function` for accessing `array` values.
* 	__dtype__: output [`typed array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Typed_arrays) or [`matrix`](https://github.com/dstructs/matrix) data type. Default: `float64`.
*	__copy__: `boolean` indicating if the `function` should return a new data structure. Default: `true`.
*	__path__: [deepget](https://github.com/kgryte/utils-deep-get)/[deepset](https://github.com/kgryte/utils-deep-set) key path.
*	__sep__: [deepget](https://github.com/kgryte/utils-deep-get)/[deepset](https://github.com/kgryte/utils-deep-set) key path separator. Default: `'.'`.

A [negative binomial](https://en.wikipedia.org/wiki/Negative_binomial_distribution) distribution is a function of 2 parameter(s): `r`(number of failures until experiment is stopped) and `p`(success probability). By default, `r` is equal to `1` and `p` is equal to `0.5`. To adjust either parameter, set the corresponding option(s).

``` javascript
{'fraction_non_alphanumeric': 0.1662870159453303, 'fraction_numerical': 0.02974675063647327, 'mean_word_length': 4.900395256916996, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 40, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6022736', 'n_tokens_mistral': 2767, 'n_tokens_neox': 2512, 'n_words': 593}