About stdlib...
We believe in a future in which the web is a preferred environment for numerical computation. To help realize this future, we've built stdlib. stdlib is a standard library, with an emphasis on numerical and scientific computation, written in JavaScript (and C) for execution in browsers and in Node.js.
The library is fully decomposable, being architected in such a way that you can swap out and mix and match APIs and functionality to cater to your exact preferences and use cases.
When you use stdlib, you can be absolutely certain that you are using the most thorough, rigorous, well-written, studied, documented, tested, measured, and high-quality code out there.
To join us in bringing numerical computing to the web, get started by checking us out on GitHub, and please consider financially supporting stdlib. We greatly appreciate your continued support!
Base (i.e., lower-level) statistical functions.
npm install @stdlib/stats-baseAlternatively,
- To load the package in a website via a
scripttag without installation and bundlers, use the ES Module available on theesmbranch (see README). - If you are using Deno, visit the
denobranch (see README for usage intructions). - For use in Observable, or in browser/node environments, use the Universal Module Definition (UMD) build available on the
umdbranch (see README).
The branches.md file summarizes the available branches and displays a diagram illustrating their relationships.
To view installation and usage instructions specific to each branch build, be sure to explicitly navigate to the respective README files on each branch, as linked to above.
var stats = require( '@stdlib/stats-base' );Namespace containing "base" (i.e., lower-level) statistical functions.
var ns = stats;
// returns {...}The namespace contains the following sub-namespaces:
dists: base (i.e., lower-level) probability distribution modules.
The namespace contains the following statistical functions:
cumax( N, x, strideX, y, strideY ): calculate the cumulative maximum of a strided array.cumaxabs( N, x, strideX, y, strideY ): calculate the cumulative maximum absolute value of a strided array.cumin( N, x, strideX, y, strideY ): calculate the cumulative minimum of a strided array.cuminabs( N, x, strideX, y, strideY ): calculate the cumulative minimum absolute value of a strided array.ndarray: base ndarray statistical functions.sdsnanmean( N, x, stride ): calculate the arithmetic mean of a single-precision floating-point strided array, ignoringNaNvalues and using extended accumulation.snanstdev( N, correction, x, stride ): calculate the standard deviation of a single-precision floating-point strided array ignoringNaNvalues.snanstdevch( N, correction, x, stride ): calculate the standard deviation of a single-precision floating-point strided array ignoringNaNvalues and using a one-pass trial mean algorithm.snanstdevpn( N, correction, x, stride ): calculate the standard deviation of a single-precision floating-point strided array ignoringNaNvalues and using a two-pass algorithm.snanstdevtk( N, correction, x, stride ): calculate the standard deviation of a single-precision floating-point strided array ignoringNaNvalues and using a one-pass textbook algorithm.snanstdevwd( N, correction, x, stride ): calculate the standard deviation of a single-precision floating-point strided array ignoringNaNvalues and using Welford's algorithm.snanstdevyc( N, correction, x, stride ): calculate the standard deviation of a single-precision floating-point strided array ignoringNaNvalues and using a one-pass algorithm proposed by Youngs and Cramer.snanvariance( N, correction, x, stride ): calculate the variance of a single-precision floating-point strided array ignoringNaNvalues.snanvariancech( N, correction, x, stride ): calculate the variance of a single-precision floating-point strided array ignoringNaNvalues and using a one-pass trial mean algorithm.snanvariancepn( N, correction, x, stride ): calculate the variance of a single-precision floating-point strided array ignoringNaNvalues and using a two-pass algorithm.snanvariancetk( N, correction, x, stride ): calculate the variance of a single-precision floating-point strided array ignoringNaNvalues and using a one-pass textbook algorithm.snanvariancewd( N, correction, x, stride ): calculate the variance of a single-precision floating-point strided array ignoringNaNvalues and using Welford's algorithm.snanvarianceyc( N, correction, x, stride ): calculate the variance of a single-precision floating-point strided array ignoringNaNvalues and using a one-pass algorithm proposed by Youngs and Cramer.
var objectKeys = require( '@stdlib/utils-keys' );
var ns = require( '@stdlib/stats-base' );
console.log( objectKeys( ns ) );This package is part of 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, see the main project repository.
See LICENSE.
Copyright © 2016-2025. The Stdlib Authors.