104 online 3 members  + Join RP Base  +
FreeScript

stats-base

by stdlib-js  ·  version 2026.11.15  ·  updated 2 days ago

No reviews yet

Downloads
0
Reviews
0
Size
297 KB
Code check
Clean
Licence
Apache-2.0
Released
Nov 2026

Standard library base statistical functions.

stats-base
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 Statistics
[![NPM version][npm-image]][npm-url] [![Build Status][test-image]][test-url] [![Coverage Status][coverage-image]][coverage-url]

Base (i.e., lower-level) statistical functions.
Installation
npm install @stdlib/stats-base

Alternatively,

  • To load the package in a website via a script tag without installation and bundlers, use the [ES Module][es-module] available on the [esm][esm-url] branch (see [README][esm-readme]).
  • If you are using Deno, visit the [deno][deno-url] branch (see [README][deno-readme] for usage intructions).
  • For use in Observable, or in browser/node environments, use the [Universal Module Definition (UMD)][umd] build available on the [umd][umd-url] branch (see [README][umd-readme]).

The [branches.md][branches-url] 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.

Usage
var stats = require( '@stdlib/stats-base' );

stats
Namespace containing "base" (i.e., lower-level) statistical functions.

var ns = stats;
// returns {...}

The namespace contains the following sub-namespaces:

  • [dists][@stdlib/stats/base/dists]: base (i.e., lower-level) probability distribution modules.

The namespace contains the following statistical functions:

  • [cumax( N, x, strideX, y, strideY )][@stdlib/stats/base/cumax]: calculate the cumulative maximum of a strided array.
  • [cumaxabs( N, x, strideX, y, strideY )][@stdlib/stats/base/cumaxabs]: calculate the cumulative maximum absolute value of a strided array.
  • [cumin( N, x, strideX, y, strideY )][@stdlib/stats/base/cumin]: calculate the cumulative minimum of a strided array.
  • [cuminabs( N, x, strideX, y, strideY )][@stdlib/stats/base/cuminabs]: calculate the cumulative minimum absolute value of a strided array.
  • [ndarray][@stdlib/stats/base/ndarray]: base ndarray statistical functions.
  • [sdsnanmean( N, x, stride )][@stdlib/stats/base/sdsnanmean]: calculate the arithmetic mean of a single-precision floating-point strided array, ignoring NaN values and using extended accumulation.
  • [snanstdev( N, correction, x, stride )][@stdlib/stats/base/snanstdev]: calculate the standard deviation of a single-precision floating-point strided array ignoring NaN values.
  • [snanstdevch( N, correction, x, stride )][@stdlib/stats/base/snanstdevch]: calculate the standard deviation of a single-precision floating-point strided array ignoring NaN values and using a one-pass trial mean algorithm.
  • [snanstdevpn( N, correction, x, stride )][@stdlib/stats/base/snanstdevpn]: calculate the standard deviation of a single-precision floating-point strided array ignoring NaN values and using a two-pass algorithm.
  • [snanstdevtk( N, correction, x, stride )][@stdlib/stats/base/snanstdevtk]: calculate the standard deviation of a single-precision floating-point strided array ignoring NaN values and using a one-pass textbook algorithm.
  • [snanstdevwd( N, correction, x, stride )][@stdlib/stats/base/snanstdevwd]: calculate the standard deviation of a single-precision floating-point strided array ignoring NaN values and using Welford's algorithm.
  • [snanstdevyc( N, correction, x, stride )][@stdlib/stats/base/snanstdevyc]: calculate the standard deviation of a single-precision floating-point strided array ignoring NaN values and using a one-pass algorithm proposed by Youngs and Cramer.
  • [snanvariance( N, correction, x, stride )][@stdlib/stats/base/snanvariance]: calculate the variance of a single-precision floating-point strided array ignoring NaN values.
  • [snanvariancech( N, correction, x, stride )][@stdlib/stats/base/snanvariancech]: calculate the variance of a single-precision floating-point strided array ignoring NaN values and using a one-pass trial mean algorithm.
  • [snanvariancepn( N, correction, x, stride )][@stdlib/stats/base/snanvariancepn]: calculate the variance of a single-precision floating-point strided array ignoring NaN values and using a two-pass algorithm.
  • [snanvariancetk( N, correction, x, stride )][@stdlib/stats/base/snanvariancetk]: calculate the variance of a single-precision floating-point strided array ignoring NaN values and using a one-pass textbook algorithm.
  • [snanvariancewd( N, correction, x, stride )][@stdlib/stats/base/snanvariancewd]: calculate the variance of a single-precision floating-point strided array ignoring NaN values and using Welford's algorithm.
  • [snanvarianceyc( N, correction, x, stride )][@stdlib/stats/base/snanvarianceyc]: calculate the variance of a single-precision floating-point strided array ignoring NaN values and using a one-pass algorithm proposed by Youngs and Cramer.

Examples
var objectKeys = require( '@stdlib/utils-keys' );
var ns = require( '@stdlib/stats-base' );

console.log( objectKeys( ns ) );

  • * *
**

…