diff --git a/lib/node_modules/@stdlib/stats/incr/nanvariance/README.md b/lib/node_modules/@stdlib/stats/incr/nanvariance/README.md
new file mode 100644
index 000000000000..043f95ba9754
--- /dev/null
+++ b/lib/node_modules/@stdlib/stats/incr/nanvariance/README.md
@@ -0,0 +1,172 @@
+
+
+# incrnanvariance
+
+> Compute an [unbiased sample variance][sample-variance] incrementally, ignoring `NaN` values.
+
+
+
+The [unbiased sample variance][sample-variance] is defined as
+
+
+
+```math
+s^2 = \frac{1}{n-1} \sum_{i=0}^{n-1} ( x_i - \bar{x} )^2
+```
+
+
+
+
+
+
+
+
+
+
+
+## Usage
+
+```javascript
+var incrnanvariance = require( '@stdlib/stats/incr/nanvariance' );
+```
+
+#### incrnanvariance( \[mean] )
+
+Returns an accumulator `function` which incrementally computes an [unbiased sample variance][sample-variance].
+
+```javascript
+var accumulator = incrnanvariance();
+```
+
+If the mean is already known, provide a `mean` argument.
+
+```javascript
+var accumulator = incrnanvariance( 3.0 );
+```
+
+#### accumulator( \[x] )
+
+If provided an input value `x`, the accumulator function returns an updated [unbiased sample variance][sample-variance]. If not provided an input value `x`, the accumulator function returns the current [unbiased sample variance][sample-variance].
+
+```javascript
+var accumulator = incrnanvariance();
+
+var s2 = accumulator( 2.0 );
+// returns 0.0
+
+s2 = accumulator( 1.0 ); // => ((2-1.5)^2+(1-1.5)^2) / (2-1)
+// returns 0.5
+
+s2 = accumulator( 3.0 ); // => ((2-2)^2+(1-2)^2+(3-2)^2) / (3-1)
+// returns 1.0
+
+s2 = accumulator( NaN );
+// returns 1.0
+
+s2 = accumulator();
+// returns 1.0
+```
+
+
+
+
+
+
+
+## Notes
+
+- Input values are **not** type checked. If non-numeric inputs are possible, you are advised to type check and handle accordingly **before** passing the value to the accumulator function.
+
+
+
+
+
+
+
+## Examples
+
+
+
+```javascript
+var randu = require( '@stdlib/random/base/randu' );
+var incrnanvariance = require( '@stdlib/stats/incr/nanvariance' );
+
+var accumulator;
+var v;
+var i;
+
+// Initialize an accumulator:
+accumulator = incrnanvariance();
+
+// For each simulated datum, update the unbiased sample variance...
+for ( i = 0; i < 100; i++ ) {
+ if ( randu() < 0.2 ) {
+ v = NaN;
+ } else {
+ v = randu() * 100.0;
+ }
+ accumulator( v );
+}
+console.log( accumulator() );
+```
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+[sample-variance]: https://en.wikipedia.org/wiki/Variance
+
+
+
+[@stdlib/stats/incr/variance]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/stats/incr/variance
+
+[@stdlib/stats/incr/mean]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/stats/incr/mean
+
+[@stdlib/stats/incr/nansum]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/stats/incr/nansum
+
+
+
+
+
+
diff --git a/lib/node_modules/@stdlib/stats/incr/nanvariance/benchmark/benchmark.js b/lib/node_modules/@stdlib/stats/incr/nanvariance/benchmark/benchmark.js
new file mode 100644
index 000000000000..89885e69f671
--- /dev/null
+++ b/lib/node_modules/@stdlib/stats/incr/nanvariance/benchmark/benchmark.js
@@ -0,0 +1,92 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2025 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+'use strict';
+
+// MODULES //
+
+var bench = require( '@stdlib/bench' );
+var randu = require( '@stdlib/random/base/randu' );
+var format = require( '@stdlib/string/format' );
+var pkg = require( './../package.json' ).name;
+var incrnanvariance = require( './../lib' );
+
+
+// MAIN //
+
+bench( pkg, function benchmark( b ) {
+ var f;
+ var i;
+ b.tic();
+ for ( i = 0; i < b.iterations; i++ ) {
+ f = incrnanvariance();
+ if ( typeof f !== 'function' ) {
+ b.fail( 'should return a function' );
+ }
+ }
+ b.toc();
+ if ( typeof f !== 'function' ) {
+ b.fail( 'should return a function' );
+ }
+ b.pass( 'benchmark finished' );
+ b.end();
+});
+
+bench( format( '%s::accumulator', pkg ), function benchmark( b ) {
+ var acc;
+ var v;
+ var i;
+
+ acc = incrnanvariance();
+
+ b.tic();
+ for ( i = 0; i < b.iterations; i++ ) {
+ v = acc( randu() );
+ if ( v !== v ) {
+ b.fail( 'should not return NaN' );
+ }
+ }
+ b.toc();
+ if ( v !== v ) {
+ b.fail( 'should not return NaN' );
+ }
+ b.pass( 'benchmark finished' );
+ b.end();
+});
+
+bench( format( '%s::accumulator,known_mean' ), function benchmark( b ) {
+ var acc;
+ var v;
+ var i;
+
+ acc = incrnanvariance( 3.14 );
+
+ b.tic();
+ for ( i = 0; i < b.iterations; i++ ) {
+ v = acc( randu() );
+ if ( v !== v ) {
+ b.fail( 'should not return NaN' );
+ }
+ }
+ b.toc();
+ if ( v !== v ) {
+ b.fail( 'should not return NaN' );
+ }
+ b.pass( 'benchmark finished' );
+ b.end();
+});
diff --git a/lib/node_modules/@stdlib/stats/incr/nanvariance/docs/img/equation_unbiased_sample_variance.svg b/lib/node_modules/@stdlib/stats/incr/nanvariance/docs/img/equation_unbiased_sample_variance.svg
new file mode 100644
index 000000000000..1ae1283e7fb1
--- /dev/null
+++ b/lib/node_modules/@stdlib/stats/incr/nanvariance/docs/img/equation_unbiased_sample_variance.svg
@@ -0,0 +1,61 @@
+
\ No newline at end of file
diff --git a/lib/node_modules/@stdlib/stats/incr/nanvariance/docs/repl.txt b/lib/node_modules/@stdlib/stats/incr/nanvariance/docs/repl.txt
new file mode 100644
index 000000000000..7d96a7ed62d2
--- /dev/null
+++ b/lib/node_modules/@stdlib/stats/incr/nanvariance/docs/repl.txt
@@ -0,0 +1,36 @@
+
+{{alias}}( [mean] )
+ Returns an accumulator function which incrementally computes an unbiased
+ sample variance, ignorning `NaN` values.
+
+ If provided a value, the accumulator function returns an updated unbiased
+ sample variance. If not provided a value, the accumulator function returns
+ the current unbiased sample variance.
+
+ Parameters
+ ----------
+ mean: number (optional)
+ Known mean.
+
+ Returns
+ -------
+ acc: Function
+ Accumulator function.
+
+ Examples
+ --------
+ > var accumulator = {{alias}}();
+ > var s2 = accumulator()
+ null
+ > s2 = accumulator( 2.0 )
+ 0.0
+ > s2 = accumulator( -5.0 )
+ 24.5
+ > s2 = accumulator( NaN )
+ 24.5
+ > s2 = accumulator()
+ 24.5
+
+ See Also
+ --------
+
diff --git a/lib/node_modules/@stdlib/stats/incr/nanvariance/docs/types/index.d.ts b/lib/node_modules/@stdlib/stats/incr/nanvariance/docs/types/index.d.ts
new file mode 100644
index 000000000000..224b5c58c838
--- /dev/null
+++ b/lib/node_modules/@stdlib/stats/incr/nanvariance/docs/types/index.d.ts
@@ -0,0 +1,58 @@
+/*
+* @license Apache-2.0
+*
+* Copyright (c) 2025 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+// TypeScript Version: 4.1
+
+/**
+* If provided a value, returns an updated unbiased sample variance; otherwise, returns the current unbiased sample variance.
+*
+* @param x - value
+* @returns unbiased sample variance
+*/
+type accumulator = ( x?: number ) => number | null;
+
+/**
+* Returns an accumulator function which incrementally computes an unbiased sample variance, ignoring `NaN` values.
+*
+* @param mu - known mean
+* @returns accumulator function
+*
+* @example
+* var accumulator = incrnanvariance();
+*
+* var s2 = accumulator();
+* // returns null
+*
+* s2 = accumulator( 2.0 );
+* // returns 0.0
+*
+* s2 = accumulator( -5.0 );
+* // returns 24.5
+*
+* s2 = accumulator( NaN );
+* // returns 24.5
+*
+* s2 = accumulator();
+* // returns 24.5
+*/
+declare function incrnanvariance( mu?: number ): accumulator;
+
+
+// EXPORTS //
+
+export = incrnanvariance;
diff --git a/lib/node_modules/@stdlib/stats/incr/nanvariance/docs/types/test.ts b/lib/node_modules/@stdlib/stats/incr/nanvariance/docs/types/test.ts
new file mode 100644
index 000000000000..8a69d19f6a66
--- /dev/null
+++ b/lib/node_modules/@stdlib/stats/incr/nanvariance/docs/types/test.ts
@@ -0,0 +1,60 @@
+/*
+* @license Apache-2.0
+*
+* Copyright (c) 2025 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+import incrnanvariance = require( './index' );
+
+
+// TESTS //
+
+// The function returns an accumulator function...
+{
+ incrnanvariance(); // $ExpectType accumulator
+ incrnanvariance( 0.0 ); // $ExpectType accumulator
+}
+
+// The compiler throws an error if the function is provided invalid arguments...
+{
+ incrnanvariance( '5' ); // $ExpectError
+ incrnanvariance( true ); // $ExpectError
+ incrnanvariance( false ); // $ExpectError
+ incrnanvariance( null ); // $ExpectError
+ incrnanvariance( [] ); // $ExpectError
+ incrnanvariance( {} ); // $ExpectError
+ incrnanvariance( ( x: number ): number => x ); // $ExpectError
+}
+
+// The function returns an accumulator function which returns an accumulated result...
+{
+ const acc = incrnanvariance();
+
+ acc(); // $ExpectType number | null
+ acc( 3.14 ); // $ExpectType number | null
+}
+
+// The compiler throws an error if the returned accumulator function is provided invalid arguments...
+{
+ const acc = incrnanvariance();
+
+ acc( '5' ); // $ExpectError
+ acc( true ); // $ExpectError
+ acc( false ); // $ExpectError
+ acc( null ); // $ExpectError
+ acc( [] ); // $ExpectError
+ acc( {} ); // $ExpectError
+ acc( ( x: number ): number => x ); // $ExpectError
+}
diff --git a/lib/node_modules/@stdlib/stats/incr/nanvariance/examples/index.js b/lib/node_modules/@stdlib/stats/incr/nanvariance/examples/index.js
new file mode 100644
index 000000000000..6602179a914e
--- /dev/null
+++ b/lib/node_modules/@stdlib/stats/incr/nanvariance/examples/index.js
@@ -0,0 +1,43 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2025 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+'use strict';
+
+var randu = require( '@stdlib/random/base/randu' );
+var incrnanvariance = require( './../lib' );
+
+var accumulator;
+var s2;
+var v;
+var i;
+
+// Initialize an accumulator:
+accumulator = incrnanvariance();
+
+// For each simulated datum, update the unbiased sample variance...
+console.log( '\nValue\tVariance\n' );
+for ( i = 0; i < 100; i++ ) {
+ if ( randu() < 0.2 ) {
+ v = NaN;
+ } else {
+ v = randu() * 100.0;
+ }
+ s2 = accumulator( v );
+ console.log( '%d\t%d', v.toFixed( 4 ), s2.toFixed( 4 ) );
+}
+console.log( '\nFinal variance: %d\n', accumulator() );
diff --git a/lib/node_modules/@stdlib/stats/incr/nanvariance/lib/index.js b/lib/node_modules/@stdlib/stats/incr/nanvariance/lib/index.js
new file mode 100644
index 000000000000..edd555d1e11b
--- /dev/null
+++ b/lib/node_modules/@stdlib/stats/incr/nanvariance/lib/index.js
@@ -0,0 +1,54 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2025 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+'use strict';
+
+/**
+* Compute an unbiased sample variance incrementally, ignoring `NaN` values.
+*
+* @module @stdlib/stats/incr/nanvariance
+*
+* @example
+* var incrnanvariance = require( '@stdlib/stats/incr/nanvariance' );
+*
+* var accumulator = incrnanvariance();
+*
+* var s2 = accumulator();
+* // returns null
+*
+* s2 = accumulator( 2.0 );
+* // returns 0.0
+*
+* s2 = accumulator( -5.0 );
+* // returns 24.5
+*
+* s2 = accumulator( NaN );
+* // returns 24.5
+*
+* s2 = accumulator();
+* // returns 24.5
+*/
+
+// MODULES //
+
+var main = require( './main.js' );
+
+
+// EXPORTS //
+
+module.exports = main;
diff --git a/lib/node_modules/@stdlib/stats/incr/nanvariance/lib/main.js b/lib/node_modules/@stdlib/stats/incr/nanvariance/lib/main.js
new file mode 100644
index 000000000000..8b30f15aab46
--- /dev/null
+++ b/lib/node_modules/@stdlib/stats/incr/nanvariance/lib/main.js
@@ -0,0 +1,84 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2025 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+'use strict';
+
+// MODULES //
+
+var incrvariance = require( '@stdlib/stats/incr/variance' );
+var isnan = require( '@stdlib/math/base/assert/is-nan' );
+
+
+// MAIN //
+
+/**
+* Returns an accumulator function which incrementally computes an unbiased sample variance, ignoring `NaN` values.
+*
+* @param {number} [mean] - mean value
+* @throws {TypeError} must provide a number primitive
+* @returns {Function} accumulator function
+*
+* @example
+* var accumulator = incrnanvariance();
+*
+* var s2 = accumulator();
+* // returns null
+*
+* s2 = accumulator( 2.0 );
+* // returns 0.0
+*
+* s2 = accumulator( -5.0 );
+* // returns 24.5
+*
+* s2 = accumulator( NaN );
+* // returns 24.5
+*
+* s2 = accumulator();
+* // returns 24.5
+*
+* @example
+* var accumulator = incrnanvariance( 3.14 );
+*/
+function incrnanvariance( mean ) {
+ var variance;
+ if ( arguments.length ) {
+ variance = incrvariance( mean );
+ } else {
+ variance = incrvariance();
+ }
+ return accumulator;
+
+ /**
+ * If provided a value, the accumulator function returns an updated unbiased sample variance. If not provided a value, the accumulator function returns the current unbiased sample variance.
+ *
+ * @private
+ * @param {number} [x] - new value
+ * @returns {(number|null)} unbiased sample variance or null
+ */
+ function accumulator( x ) {
+ if ( arguments.length === 0 || isnan( x ) ) {
+ return variance();
+ }
+ return variance( x );
+ }
+}
+
+
+// EXPORTS //
+
+module.exports = incrnanvariance;
diff --git a/lib/node_modules/@stdlib/stats/incr/nanvariance/package.json b/lib/node_modules/@stdlib/stats/incr/nanvariance/package.json
new file mode 100644
index 000000000000..3388d2675f8c
--- /dev/null
+++ b/lib/node_modules/@stdlib/stats/incr/nanvariance/package.json
@@ -0,0 +1,69 @@
+{
+ "name": "@stdlib/stats/incr/nanvariance",
+ "version": "0.0.0",
+ "description": "Compute an unbiased sample variance incrementally.",
+ "license": "Apache-2.0",
+ "author": {
+ "name": "The Stdlib Authors",
+ "url": "https://github.com/stdlib-js/stdlib/graphs/contributors"
+ },
+ "contributors": [
+ {
+ "name": "The Stdlib Authors",
+ "url": "https://github.com/stdlib-js/stdlib/graphs/contributors"
+ }
+ ],
+ "main": "./lib",
+ "directories": {
+ "benchmark": "./benchmark",
+ "doc": "./docs",
+ "example": "./examples",
+ "lib": "./lib",
+ "test": "./test"
+ },
+ "types": "./docs/types",
+ "scripts": {},
+ "homepage": "https://github.com/stdlib-js/stdlib",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/stdlib-js/stdlib.git"
+ },
+ "bugs": {
+ "url": "https://github.com/stdlib-js/stdlib/issues"
+ },
+ "dependencies": {},
+ "devDependencies": {},
+ "engines": {
+ "node": ">=0.10.0",
+ "npm": ">2.7.0"
+ },
+ "os": [
+ "aix",
+ "darwin",
+ "freebsd",
+ "linux",
+ "macos",
+ "openbsd",
+ "sunos",
+ "win32",
+ "windows"
+ ],
+ "keywords": [
+ "stdlib",
+ "stdmath",
+ "statistics",
+ "stats",
+ "mathematics",
+ "math",
+ "variance",
+ "sample variance",
+ "unbiased",
+ "var",
+ "dispersion",
+ "standard deviation",
+ "stdev",
+ "central tendency",
+ "incremental",
+ "accumulator"
+ ]
+}
diff --git a/lib/node_modules/@stdlib/stats/incr/nanvariance/test/test.js b/lib/node_modules/@stdlib/stats/incr/nanvariance/test/test.js
new file mode 100644
index 000000000000..93461cdc73ed
--- /dev/null
+++ b/lib/node_modules/@stdlib/stats/incr/nanvariance/test/test.js
@@ -0,0 +1,276 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2025 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+'use strict';
+
+// MODULES //
+
+var tape = require( 'tape' );
+var zeros = require( '@stdlib/array/base/zeros' );
+var incrnanvariance = require( './../lib' );
+
+
+// TESTS //
+
+tape( 'main export is a function', function test( t ) {
+ t.ok( true, __filename );
+ t.strictEqual( typeof incrnanvariance, 'function', 'main export is a function' );
+ t.end();
+});
+
+tape( 'the function returns an accumulator function', function test( t ) {
+ t.strictEqual( typeof incrnanvariance(), 'function', 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function returns an accumulator function (known mean)', function test( t ) {
+ t.strictEqual( typeof incrnanvariance( 3.0 ), 'function', 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function throws an error if provided a non-numeric value', function test( t ) {
+ var values;
+ var i;
+
+ values = [
+ '5',
+ true,
+ false,
+ null,
+ void 0,
+ [],
+ {},
+ function noop() {}
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ incrnanvariance( value );
+ };
+ }
+});
+
+tape( 'the accumulator function incrementally computes an unbiased sample variance', function test( t ) {
+ var expected;
+ var actual;
+ var data;
+ var acc;
+ var i;
+
+ data = [ 2.0, 3.0, 2.0, 4.0, 3.0, 4.0 ];
+
+ // Test against Julia:
+ expected = [
+ 0.0,
+ 0.5,
+ 0.33333333333333337,
+ 0.9166666666666666,
+ 0.7,
+ 0.8
+ ];
+
+ acc = incrnanvariance();
+
+ actual = zeros( data.length );
+ for ( i = 0; i < data.length; i++ ) {
+ actual[ i ] = acc( data[ i ] );
+ }
+ t.deepEqual( actual, expected, 'returns expected incremental results' );
+ t.end();
+});
+
+tape( 'the accumulator function incrementally computes an unbiased sample variance (known mean)', function test( t ) {
+ var expected;
+ var actual;
+ var data;
+ var acc;
+ var i;
+
+ data = [ 2.0, 3.0, 2.0, 4.0, 3.0, 4.0 ];
+
+ // Test against Julia:
+ expected = [
+ 1.0,
+ 0.5,
+ 0.6666666666666666,
+ 0.75,
+ 0.6,
+ 0.6666666666666666
+ ];
+
+ acc = incrnanvariance( 3.0 );
+
+ actual = zeros( data.length );
+ for ( i = 0; i < data.length; i++ ) {
+ actual[ i ] = acc( data[ i ] );
+ }
+ t.deepEqual( actual, expected, 'returns expected incremental results' );
+ t.end();
+});
+
+tape( 'if not provided an input value, the accumulator function returns the current unbiased sample variance', function test( t ) {
+ var data;
+ var acc;
+ var i;
+
+ data = [ 2.0, 3.0, 1.0 ];
+ acc = incrnanvariance();
+ for ( i = 0; i < data.length; i++ ) {
+ acc( data[ i ] );
+ }
+ t.strictEqual( acc(), 1.0, 'returns the current accumulated unbiased sample variance' );
+ t.end();
+});
+
+tape( 'if not provided an input value, the accumulator function returns the current unbiased sample variance (known mean)', function test( t ) {
+ var data;
+ var acc;
+ var i;
+
+ data = [ 2.0, 3.0, 1.0 ];
+ acc = incrnanvariance( 2.0 );
+ for ( i = 0; i < data.length; i++ ) {
+ acc( data[ i ] );
+ }
+ t.strictEqual( acc(), 0.6666666666666666, 'returns the current accumulated unbiased sample variance' );
+ t.end();
+});
+
+tape( 'the sample variance is `null` until at least 1 datum has been provided (unknown mean)', function test( t ) {
+ var acc;
+ var s2;
+
+ acc = incrnanvariance();
+
+ s2 = acc();
+ t.strictEqual( s2, null, 'returns expected value' );
+
+ s2 = acc( 3.0 );
+ t.notEqual( s2, null, 'does not return null' );
+
+ s2 = acc();
+ t.notEqual( s2, null, 'does not return null' );
+
+ t.end();
+});
+
+tape( 'the sample variance is `null` until at least 1 datum has been provided (known mean)', function test( t ) {
+ var acc;
+ var s2;
+
+ acc = incrnanvariance( 3.0 );
+
+ s2 = acc();
+ t.strictEqual( s2, null, 'returns expected value' );
+
+ s2 = acc( 3.0 );
+ t.notEqual( s2, null, 'does not return null' );
+
+ s2 = acc();
+ t.notEqual( s2, null, 'does not return null' );
+
+ t.end();
+});
+
+tape( 'the sample variance is `0` until at least 2 datums have been provided (unknown mean)', function test( t ) {
+ var acc;
+ var s2;
+
+ acc = incrnanvariance();
+
+ s2 = acc( 2.0 );
+ t.strictEqual( s2, 0.0, 'returns expected value' );
+
+ s2 = acc();
+ t.strictEqual( s2, 0.0, 'returns expected value' );
+
+ s2 = acc( 3.0 );
+ t.notEqual( s2, 0.0, 'does not return 0' );
+
+ s2 = acc();
+ t.notEqual( s2, 0.0, 'does not return 0' );
+
+ t.end();
+});
+
+tape( 'if provided a `NaN`, the accumulator function returns the current unbiased sample variance (unknown mean)', function test( t ) {
+ var expected;
+ var actual;
+ var data;
+ var acc;
+ var i;
+
+ data = [ 2.0, 1.0, 2.0, NaN, 3.0, 4.0, 5.0, 6.0, NaN, 7.0 ];
+
+ // Test against Julia:
+ expected = [
+ 0,
+ 0.5,
+ 0.3333333333333333,
+ 0.3333333333333333,
+ 0.6666666666666666,
+ 1.3,
+ 2.166666666666667,
+ 3.2380952380952386,
+ 3.2380952380952386,
+ 4.5
+ ];
+
+ acc = incrnanvariance();
+ actual = zeros( data.length );
+ for ( i = 0; i < data.length; i++ ) {
+ actual[ i ] = acc( data[ i ] );
+ }
+ t.deepEqual( actual, expected, 'returns expected value' );
+ t.end();
+});
+
+tape( 'if provided a `NaN`, the accumulator function returns the current unbiased sample variance (known mean)', function test( t ) {
+ var expected;
+ var actual;
+ var data;
+ var acc;
+ var i;
+
+ data = [ 2.0, 1.0, 2.0, NaN, 3.0, 4.0, 5.0, 6.0, NaN, 7.0 ];
+
+ // Test against Julia:
+ expected = [
+ 1.2996000000000003,
+ 2.9396000000000004,
+ 2.3929333333333336,
+ 2.3929333333333336,
+ 1.7996,
+ 1.5876000000000001,
+ 1.8996000000000002,
+ 2.7967428571428568,
+ 2.7967428571428568,
+ 4.3096
+ ];
+ acc = incrnanvariance( 3.14 );
+ actual = zeros( data.length );
+ for ( i = 0; i < data.length; i++ ) {
+ actual[ i ] = acc( data[ i ] );
+ }
+ t.deepEqual( actual, expected, 'returns expected value' );
+ t.end();
+});