# Stats

[![NPM version][npm-image]][npm-url] [![Build Status][test-image]][test-url] [![Coverage Status][coverage-image]][coverage-url] [![dependencies][dependencies-image]][dependencies-url]

> Standard library statistical functions.

## Installation

```bash
npm install @stdlib/stats
```


## Usage

```javascript
var statistics = require( '@stdlib/stats' );
```

#### statistics

Standard library statistical functions.

```javascript
var stats = statistics;
// returns {...}
```

The namespace exposes the following statistical tests:

-   [`anova1( x, factor[, opts] )`][@stdlib/stats/anova1]: perform a one-way analysis of variance.
-   [`bartlettTest( a[,b,...,k][, opts] )`][@stdlib/stats/bartlett-test]: compute Bartlett’s test for equal variances.
-   [`binomialTest( x[, n][, opts] )`][@stdlib/stats/binomial-test]: exact test for the success probability in a Bernoulli experiment.
-   [`chi2gof( x, y[, ...args][, opts] )`][@stdlib/stats/chi2gof]: perform a chi-square goodness-of-fit test.
-   [`chi2test( x[, opts] )`][@stdlib/stats/chi2test]: perform a chi-square independence test.
-   [`flignerTest( a[,b,...,k][, opts] )`][@stdlib/stats/fligner-test]: compute the Fligner-Killeen test for equal variances.
-   [`kruskalTest( a[,b,...,k][, opts] )`][@stdlib/stats/kruskal-test]: compute the Kruskal-Wallis test for equal medians.
-   [`kstest( x, y[, ...params][, opts] )`][@stdlib/stats/kstest]: one-sample Kolmogorov-Smirnov goodness-of-fit test.
-   [`leveneTest( x[, y, ..., z][, opts] )`][@stdlib/stats/levene-test]: compute Levene's test for equal variances.
-   [`pcorrtest( x, y[, opts] )`][@stdlib/stats/pcorrtest]: compute a Pearson product-moment correlation test between paired samples.
-   [`ttest( x[, y][, opts] )`][@stdlib/stats/ttest]: one-sample and paired Student's t-Test.
-   [`ttest2( x, y[, opts] )`][@stdlib/stats/ttest2]: two-sample Student's t-Test.
-   [`vartest( x, y[, opts] )`][@stdlib/stats/vartest]: two-sample F-test for equal variances.
-   [`wilcoxon( x[, y][, opts] )`][@stdlib/stats/wilcoxon]: one-sample and paired Wilcoxon signed rank test.
-   [`ztest( x, sigma[, opts] )`][@stdlib/stats/ztest]: one-sample z-Test.
-   [`ztest2( x, y, sigmax, sigmay[, opts] )`][@stdlib/stats/ztest2]: two-sample z-Test.

In addition, it contains an assortment of functions for computing statistics incrementally as part of the `incr` sub-namespace and functions for computing statistics over iterators in the `iterators` namespace.

-   [`incr`][@stdlib/stats/incr]: standard library functions for computing statistics incrementally.
-   [`iterators`][@stdlib/stats/iter]: standard library functions for computing statistics over iterators.

The `base` sub-namespace contains functions to calculate statistics alongside a `dists` namespace containing functions related to a wide assortment of probability distributions.

Other statistical functions included are:

-   [`kde2d()`][@stdlib/stats/kde2d]: two-dimensional kernel density estimation.
-   [`lowess( x, y[, opts] )`][@stdlib/stats/lowess]: locally-weighted polynomial regression via the LOWESS algorithm.
-   [`padjust( pvals, method[, comparisons] )`][@stdlib/stats/padjust]: adjust supplied p-values for multiple comparisons.
-   [`ranks( arr[, opts] )`][@stdlib/stats/ranks]: compute ranks for values of an array-like object.

## Examples

```javascript
var objectKeys = require( '@stdlib/utils/keys' );
var statistics = require( '@stdlib/stats' );

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


* * *

## Notice

This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more.

For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib].

#### Community

[![Chat][chat-image]][chat-url]

---

## License

See [LICENSE][stdlib-license].

## Copyright

Copyright © 2016-2021. The Stdlib [Authors][stdlib-authors].

[npm-image]: http://img.shields.io/npm/v/@stdlib/stats.svg
[npm-url]: https://npmjs.org/package/@stdlib/stats

[test-image]: https://github.com/stdlib-js/stats/actions/workflows/test.yml/badge.svg
[test-url]: https://github.com/stdlib-js/stats/actions/workflows/test.yml

[coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/stats/main.svg
[coverage-url]: https://codecov.io/github/stdlib-js/stats?branch=main

[dependencies-image]: https://img.shields.io/david/stdlib-js/stats.svg
[dependencies-url]: https://david-dm.org/stdlib-js/stats/main

[chat-image]: https://img.shields.io/gitter/room/stdlib-js/stdlib.svg
[chat-url]: https://gitter.im/stdlib-js/stdlib/

[stdlib]: https://github.com/stdlib-js/stdlib

[stdlib-authors]: https://github.com/stdlib-js/stdlib/graphs/contributors

[stdlib-license]: https://raw.githubusercontent.com/stdlib-js/stats/main/LICENSE

[@stdlib/stats/kde2d]: https://github.com/stdlib-js/stats/tree/main/kde2d

[@stdlib/stats/lowess]: https://github.com/stdlib-js/stats/tree/main/lowess

[@stdlib/stats/padjust]: https://github.com/stdlib-js/stats/tree/main/padjust

[@stdlib/stats/ranks]: https://github.com/stdlib-js/stats/tree/main/ranks

[@stdlib/stats/incr]: https://github.com/stdlib-js/stats/tree/main/incr

[@stdlib/stats/iter]: https://github.com/stdlib-js/stats/tree/main/iter

[@stdlib/stats/anova1]: https://github.com/stdlib-js/stats/tree/main/anova1

[@stdlib/stats/bartlett-test]: https://github.com/stdlib-js/stats/tree/main/bartlett-test

[@stdlib/stats/binomial-test]: https://github.com/stdlib-js/stats/tree/main/binomial-test

[@stdlib/stats/chi2gof]: https://github.com/stdlib-js/stats/tree/main/chi2gof

[@stdlib/stats/chi2test]: https://github.com/stdlib-js/stats/tree/main/chi2test

[@stdlib/stats/fligner-test]: https://github.com/stdlib-js/stats/tree/main/fligner-test

[@stdlib/stats/kruskal-test]: https://github.com/stdlib-js/stats/tree/main/kruskal-test

[@stdlib/stats/kstest]: https://github.com/stdlib-js/stats/tree/main/kstest

[@stdlib/stats/levene-test]: https://github.com/stdlib-js/stats/tree/main/levene-test

[@stdlib/stats/pcorrtest]: https://github.com/stdlib-js/stats/tree/main/pcorrtest

[@stdlib/stats/ttest]: https://github.com/stdlib-js/stats/tree/main/ttest

[@stdlib/stats/ttest2]: https://github.com/stdlib-js/stats/tree/main/ttest2

[@stdlib/stats/vartest]: https://github.com/stdlib-js/stats/tree/main/vartest

[@stdlib/stats/wilcoxon]: https://github.com/stdlib-js/stats/tree/main/wilcoxon

[@stdlib/stats/ztest]: https://github.com/stdlib-js/stats/tree/main/ztest

[@stdlib/stats/ztest2]: https://github.com/stdlib-js/stats/tree/main/ztest2

