stdlib-js

stdlib-js/stats-base-nanvariancewd

Calculate the variance of a strided array ignoring NaN values and using Welford's algorithm.

JavaScript
2
0
Apache License 2.0

to `0` is the standard choice (i.e., the provided values correspond to the entire population). When computing the [variance][variance] of a sample, setting this parameter to `1` is the standard choice (i.e., the provided values correspond to a sample drawn from a larger population; this is commonly referred to as Bessel's correction). - **x**: input `Array` or `TypedArray` whose elements are accessed by `stride`. - **strideX**: index increment for `x`. The `N` and `strideX` parameters determine which elements in `x` are accessed at runtime. For example, to calculate the [variance][variance] of every other element in `x`, ```javascript var floor = require( '@stdlib/math-base-special-floor' ); var x = [ 1.0, -2.0, NaN, 2.0, 2.0, -7.0 ]; var N = floor( x.length / 2 ); var v = nanvariancewd( N, 1, x, 2 ); // returns ~6.25 ``` Note that indexing is relative to the first index. To introduce an offset, use `x.slice()` or `typedarray.subarray

Total donated
Undistributed
Share with your subscribers:

Recipients

How the donated funds are distributed

Support the dependencies

Support the repos that depend on this repository

Top contributors

stdlib-bot's profile
stdlib-bot
83 contributions

Recent events

Kivach works on the Obyte network, and therefore you can track all donations.

No events yet