README.md (10554B)
1 <!-- 2 3 @license Apache-2.0 4 5 Copyright (c) 2018 The Stdlib Authors. 6 7 Licensed under the Apache License, Version 2.0 (the "License"); 8 you may not use this file except in compliance with the License. 9 You may obtain a copy of the License at 10 11 http://www.apache.org/licenses/LICENSE-2.0 12 13 Unless required by applicable law or agreed to in writing, software 14 distributed under the License is distributed on an "AS IS" BASIS, 15 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 See the License for the specific language governing permissions and 17 limitations under the License. 18 19 --> 20 21 # Stats 22 23 [![NPM version][npm-image]][npm-url] [![Build Status][test-image]][test-url] [![Coverage Status][coverage-image]][coverage-url] [![dependencies][dependencies-image]][dependencies-url] 24 25 > Standard library statistical functions. 26 27 <section class="installation"> 28 29 ## Installation 30 31 ```bash 32 npm install @stdlib/stats 33 ``` 34 35 </section> 36 37 <section class="usage"> 38 39 ## Usage 40 41 ```javascript 42 var statistics = require( '@stdlib/stats' ); 43 ``` 44 45 #### statistics 46 47 Standard library statistical functions. 48 49 ```javascript 50 var stats = statistics; 51 // returns {...} 52 ``` 53 54 The namespace exposes the following statistical tests: 55 56 <!-- <toc pattern="+(*test*|chi2gof|anova1|wilcoxon)"> --> 57 58 <div class="namespace-toc"> 59 60 - <span class="signature">[`anova1( x, factor[, opts] )`][@stdlib/stats/anova1]</span><span class="delimiter">: </span><span class="description">perform a one-way analysis of variance.</span> 61 - <span class="signature">[`bartlettTest( a[,b,...,k][, opts] )`][@stdlib/stats/bartlett-test]</span><span class="delimiter">: </span><span class="description">compute Bartlett’s test for equal variances.</span> 62 - <span class="signature">[`binomialTest( x[, n][, opts] )`][@stdlib/stats/binomial-test]</span><span class="delimiter">: </span><span class="description">exact test for the success probability in a Bernoulli experiment.</span> 63 - <span class="signature">[`chi2gof( x, y[, ...args][, opts] )`][@stdlib/stats/chi2gof]</span><span class="delimiter">: </span><span class="description">perform a chi-square goodness-of-fit test.</span> 64 - <span class="signature">[`chi2test( x[, opts] )`][@stdlib/stats/chi2test]</span><span class="delimiter">: </span><span class="description">perform a chi-square independence test.</span> 65 - <span class="signature">[`flignerTest( a[,b,...,k][, opts] )`][@stdlib/stats/fligner-test]</span><span class="delimiter">: </span><span class="description">compute the Fligner-Killeen test for equal variances.</span> 66 - <span class="signature">[`kruskalTest( a[,b,...,k][, opts] )`][@stdlib/stats/kruskal-test]</span><span class="delimiter">: </span><span class="description">compute the Kruskal-Wallis test for equal medians.</span> 67 - <span class="signature">[`kstest( x, y[, ...params][, opts] )`][@stdlib/stats/kstest]</span><span class="delimiter">: </span><span class="description">one-sample Kolmogorov-Smirnov goodness-of-fit test.</span> 68 - <span class="signature">[`leveneTest( x[, y, ..., z][, opts] )`][@stdlib/stats/levene-test]</span><span class="delimiter">: </span><span class="description">compute Levene's test for equal variances.</span> 69 - <span class="signature">[`pcorrtest( x, y[, opts] )`][@stdlib/stats/pcorrtest]</span><span class="delimiter">: </span><span class="description">compute a Pearson product-moment correlation test between paired samples.</span> 70 - <span class="signature">[`ttest( x[, y][, opts] )`][@stdlib/stats/ttest]</span><span class="delimiter">: </span><span class="description">one-sample and paired Student's t-Test.</span> 71 - <span class="signature">[`ttest2( x, y[, opts] )`][@stdlib/stats/ttest2]</span><span class="delimiter">: </span><span class="description">two-sample Student's t-Test.</span> 72 - <span class="signature">[`vartest( x, y[, opts] )`][@stdlib/stats/vartest]</span><span class="delimiter">: </span><span class="description">two-sample F-test for equal variances.</span> 73 - <span class="signature">[`wilcoxon( x[, y][, opts] )`][@stdlib/stats/wilcoxon]</span><span class="delimiter">: </span><span class="description">one-sample and paired Wilcoxon signed rank test.</span> 74 - <span class="signature">[`ztest( x, sigma[, opts] )`][@stdlib/stats/ztest]</span><span class="delimiter">: </span><span class="description">one-sample z-Test.</span> 75 - <span class="signature">[`ztest2( x, y, sigmax, sigmay[, opts] )`][@stdlib/stats/ztest2]</span><span class="delimiter">: </span><span class="description">two-sample z-Test.</span> 76 77 </div> 78 79 <!-- </toc> --> 80 81 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. 82 83 <!-- <toc pattern="+(incr|iter)"> --> 84 85 <div class="namespace-toc"> 86 87 - <span class="signature">[`incr`][@stdlib/stats/incr]</span><span class="delimiter">: </span><span class="description">standard library functions for computing statistics incrementally.</span> 88 - <span class="signature">[`iterators`][@stdlib/stats/iter]</span><span class="delimiter">: </span><span class="description">standard library functions for computing statistics over iterators.</span> 89 90 </div> 91 92 <!-- </toc> --> 93 94 The `base` sub-namespace contains functions to calculate statistics alongside a `dists` namespace containing functions related to a wide assortment of probability distributions. 95 96 Other statistical functions included are: 97 98 <!-- <toc pattern="*" ignore="+(*test*|chi2gof|anova1)" ignore="incr" ignore="iterators" > --> 99 100 <div class="namespace-toc"> 101 102 - <span class="signature">[`kde2d()`][@stdlib/stats/kde2d]</span><span class="delimiter">: </span><span class="description">two-dimensional kernel density estimation.</span> 103 - <span class="signature">[`lowess( x, y[, opts] )`][@stdlib/stats/lowess]</span><span class="delimiter">: </span><span class="description">locally-weighted polynomial regression via the LOWESS algorithm.</span> 104 - <span class="signature">[`padjust( pvals, method[, comparisons] )`][@stdlib/stats/padjust]</span><span class="delimiter">: </span><span class="description">adjust supplied p-values for multiple comparisons.</span> 105 - <span class="signature">[`ranks( arr[, opts] )`][@stdlib/stats/ranks]</span><span class="delimiter">: </span><span class="description">compute ranks for values of an array-like object.</span> 106 107 </div> 108 109 <!-- </toc> --> 110 111 </section> 112 113 <!-- /.usage --> 114 115 <section class="examples"> 116 117 ## Examples 118 119 <!-- TODO: better examples --> 120 121 <!-- eslint no-undef: "error" --> 122 123 ```javascript 124 var objectKeys = require( '@stdlib/utils/keys' ); 125 var statistics = require( '@stdlib/stats' ); 126 127 console.log( objectKeys( statistics ) ); 128 ``` 129 130 </section> 131 132 <!-- /.examples --> 133 134 135 <section class="main-repo" > 136 137 * * * 138 139 ## Notice 140 141 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. 142 143 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]. 144 145 #### Community 146 147 [![Chat][chat-image]][chat-url] 148 149 --- 150 151 ## License 152 153 See [LICENSE][stdlib-license]. 154 155 156 ## Copyright 157 158 Copyright © 2016-2021. The Stdlib [Authors][stdlib-authors]. 159 160 </section> 161 162 <!-- /.stdlib --> 163 164 <!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> 165 166 <section class="links"> 167 168 [npm-image]: http://img.shields.io/npm/v/@stdlib/stats.svg 169 [npm-url]: https://npmjs.org/package/@stdlib/stats 170 171 [test-image]: https://github.com/stdlib-js/stats/actions/workflows/test.yml/badge.svg 172 [test-url]: https://github.com/stdlib-js/stats/actions/workflows/test.yml 173 174 [coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/stats/main.svg 175 [coverage-url]: https://codecov.io/github/stdlib-js/stats?branch=main 176 177 [dependencies-image]: https://img.shields.io/david/stdlib-js/stats.svg 178 [dependencies-url]: https://david-dm.org/stdlib-js/stats/main 179 180 [chat-image]: https://img.shields.io/gitter/room/stdlib-js/stdlib.svg 181 [chat-url]: https://gitter.im/stdlib-js/stdlib/ 182 183 [stdlib]: https://github.com/stdlib-js/stdlib 184 185 [stdlib-authors]: https://github.com/stdlib-js/stdlib/graphs/contributors 186 187 [stdlib-license]: https://raw.githubusercontent.com/stdlib-js/stats/main/LICENSE 188 189 <!-- <toc-links> --> 190 191 [@stdlib/stats/kde2d]: https://www.npmjs.com/package/@stdlib/stats/tree/main/kde2d 192 193 [@stdlib/stats/lowess]: https://www.npmjs.com/package/@stdlib/stats/tree/main/lowess 194 195 [@stdlib/stats/padjust]: https://www.npmjs.com/package/@stdlib/stats/tree/main/padjust 196 197 [@stdlib/stats/ranks]: https://www.npmjs.com/package/@stdlib/stats/tree/main/ranks 198 199 [@stdlib/stats/incr]: https://www.npmjs.com/package/@stdlib/stats/tree/main/incr 200 201 [@stdlib/stats/iter]: https://www.npmjs.com/package/@stdlib/stats/tree/main/iter 202 203 [@stdlib/stats/anova1]: https://www.npmjs.com/package/@stdlib/stats/tree/main/anova1 204 205 [@stdlib/stats/bartlett-test]: https://www.npmjs.com/package/@stdlib/stats/tree/main/bartlett-test 206 207 [@stdlib/stats/binomial-test]: https://www.npmjs.com/package/@stdlib/stats/tree/main/binomial-test 208 209 [@stdlib/stats/chi2gof]: https://www.npmjs.com/package/@stdlib/stats/tree/main/chi2gof 210 211 [@stdlib/stats/chi2test]: https://www.npmjs.com/package/@stdlib/stats/tree/main/chi2test 212 213 [@stdlib/stats/fligner-test]: https://www.npmjs.com/package/@stdlib/stats/tree/main/fligner-test 214 215 [@stdlib/stats/kruskal-test]: https://www.npmjs.com/package/@stdlib/stats/tree/main/kruskal-test 216 217 [@stdlib/stats/kstest]: https://www.npmjs.com/package/@stdlib/stats/tree/main/kstest 218 219 [@stdlib/stats/levene-test]: https://www.npmjs.com/package/@stdlib/stats/tree/main/levene-test 220 221 [@stdlib/stats/pcorrtest]: https://www.npmjs.com/package/@stdlib/stats/tree/main/pcorrtest 222 223 [@stdlib/stats/ttest]: https://www.npmjs.com/package/@stdlib/stats/tree/main/ttest 224 225 [@stdlib/stats/ttest2]: https://www.npmjs.com/package/@stdlib/stats/tree/main/ttest2 226 227 [@stdlib/stats/vartest]: https://www.npmjs.com/package/@stdlib/stats/tree/main/vartest 228 229 [@stdlib/stats/wilcoxon]: https://www.npmjs.com/package/@stdlib/stats/tree/main/wilcoxon 230 231 [@stdlib/stats/ztest]: https://www.npmjs.com/package/@stdlib/stats/tree/main/ztest 232 233 [@stdlib/stats/ztest2]: https://www.npmjs.com/package/@stdlib/stats/tree/main/ztest2 234 235 <!-- </toc-links> --> 236 237 </section> 238 239 <!-- /.links -->