diff --git a/lib/node_modules/@stdlib/stats/incr/nanmhmean/README.md b/lib/node_modules/@stdlib/stats/incr/nanmhmean/README.md
new file mode 100644
index 000000000000..5c2ab74257ff
--- /dev/null
+++ b/lib/node_modules/@stdlib/stats/incr/nanmhmean/README.md
@@ -0,0 +1,160 @@
+
+
+# incrnanmhmean
+
+> Compute a moving [harmonic mean][harmonic-mean] incrementally, ignoring `NaN` values.
+
+
+
+The [harmonic mean][harmonic-mean] of positive real numbers `x_0, x_1, ..., x_{n-1}` is defined as
+
+
+
+```math
+\begin{align}H &= \frac{n}{\frac{1}{x_0} + \frac{1}{x_1} + \cdots + \frac{1}{x_{n-1}}} \\ &= \frac{n}{\displaystyle\sum_{i=0}^{n-1} \frac{1}{x_i}} \\ &= \biggl( \frac{\displaystyle\sum_{i=0}^{n-1} \frac{1}{x_i}}{n} \biggr)^{-1}\end{align}
+```
+
+
+
+
+
+
+
+
+
+
+
+## Usage
+
+```javascript
+var incrnanmhmean = require( '@stdlib/stats/incr/nanmhmean' );
+```
+
+#### incrmhmean( window )
+
+Returns an accumulator `function` which incrementally computes a moving [harmonic mean][harmonic-mean], ignoring `NaN` values. The `window` parameter defines the number of values over which to compute the moving [harmonic mean][harmonic-mean].
+
+```javascript
+var accumulator = incrnanmhmean( 3 );
+```
+
+#### accumulator( \[x] )
+
+If provided an input value `x`, the accumulator function returns an updated [harmonic mean][harmonic-mean], ignoring `NaN` values. If not provided an input value `x`, the accumulator function returns the current [harmonic-mean][harmonic-mean].
+
+```javascript
+var accumulator = incrnanmhmean( 3 );
+
+var v = accumulator();
+// returns null
+
+// Fill the window...
+v = accumulator( 2.0 ); // [2.0]
+// returns 2.0
+
+v = accumulator( 1.0 ); // [2.0, 1.0]
+// returns ~1.33
+
+v = accumulator( 3.0 ); // [2.0, 1.0, 3.0]
+// returns ~1.64
+
+// Window begins sliding...
+v = accumulator( 7.0 ); // [1.0, 3.0, 7.0]
+// returns ~2.03
+
+v = accumulator( NaN ); // [1.0, 3.0, 7.0]
+// returns ~2.03
+
+v = accumulator( 5.0 ); // [3.0, 7.0, 5.0]
+// returns ~4.44
+
+v = accumulator();
+// returns ~4.44
+```
+
+
+
+
+
+
+
+## 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.
+- As `W` values are needed to fill the window buffer, the first `W-1` returned values are calculated from smaller sample sizes. Until the window is full, each returned value is calculated from all provided values.
+
+
+
+
+
+
+
+## Examples
+
+
+
+```javascript
+var randu = require( '@stdlib/random/base/randu' );
+var incrnanmhmean = require( '@stdlib/stats/incr/nanmhmean' );
+
+var accumulator;
+var v;
+var i;
+
+// Initialize an accumulator:
+accumulator = incrnanmhmean( 5 );
+
+// For each simulated datum, update the moving harmonic mean...
+for ( i = 0; i < 100; i++ ) {
+ v = randu() * 100.0;
+ accumulator( v );
+}
+console.log( accumulator() );
+```
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+[harmonic-mean]: https://en.wikipedia.org/wiki/Harmonic_mean
+
+
+
+
+
+
+
+
diff --git a/lib/node_modules/@stdlib/stats/incr/nanmhmean/benchmark/benchmark.js b/lib/node_modules/@stdlib/stats/incr/nanmhmean/benchmark/benchmark.js
new file mode 100644
index 000000000000..2a69075b5fda
--- /dev/null
+++ b/lib/node_modules/@stdlib/stats/incr/nanmhmean/benchmark/benchmark.js
@@ -0,0 +1,69 @@
+/**
+* @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 pkg = require( './../package.json' ).name;
+var incrnanmhmean = require( './../lib' );
+
+
+// MAIN //
+
+bench( pkg, function benchmark( b ) {
+ var f;
+ var i;
+ b.tic();
+ for ( i = 0; i < b.iterations; i++ ) {
+ f = incrnanmhmean( (i%5)+1 );
+ 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( pkg+'::accumulator', function benchmark( b ) {
+ var acc;
+ var v;
+ var i;
+
+ acc = incrnanmhmean( 5 );
+
+ 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/nanmhmean/docs/img/equation_harmonic_mean.svg b/lib/node_modules/@stdlib/stats/incr/nanmhmean/docs/img/equation_harmonic_mean.svg
new file mode 100644
index 000000000000..495851a8151e
--- /dev/null
+++ b/lib/node_modules/@stdlib/stats/incr/nanmhmean/docs/img/equation_harmonic_mean.svg
@@ -0,0 +1,148 @@
+
\ No newline at end of file
diff --git a/lib/node_modules/@stdlib/stats/incr/nanmhmean/docs/repl.txt b/lib/node_modules/@stdlib/stats/incr/nanmhmean/docs/repl.txt
new file mode 100644
index 000000000000..122edbe6710f
--- /dev/null
+++ b/lib/node_modules/@stdlib/stats/incr/nanmhmean/docs/repl.txt
@@ -0,0 +1,49 @@
+
+{{alias}}( W )
+ Returns an accumulator function which incrementally computes a moving
+ harmonic mean, ignoring `NaN` values.
+
+ The `W` parameter defines the number of values over which to compute the
+ moving harmonic mean.
+
+ If provided a value, the accumulator function returns an updated moving
+ harmonic mean. If not provided a value, the accumulator function returns the
+ current moving harmonic mean.
+
+ As `W` values are needed to fill the window buffer, the first `W-1` returned
+ values are calculated from smaller sample sizes. Until the window is full,
+ each returned value is calculated from all provided values.
+
+ Parameters
+ ----------
+ W: integer
+ Window size.
+
+ Returns
+ -------
+ acc: Function
+ Accumulator function.
+
+ Examples
+ --------
+ > var accumulator = {{alias}}( 3 );
+ > var v = accumulator()
+ null
+ > v = accumulator( 2.0 )
+ 2.0
+ > v = accumulator( 5.0 )
+ ~2.86
+ > v = accumulator( NaN )
+ ~2.86
+ > v = accumulator( 3.0 )
+ ~2.90
+ > v = accumulator( 5.0 )
+ ~4.09
+ > v = accumulator( NaN )
+ ~4.09
+ > v = accumulator()
+ ~4.09
+
+ See Also
+ --------
+
diff --git a/lib/node_modules/@stdlib/stats/incr/nanmhmean/docs/types/index.d.ts b/lib/node_modules/@stdlib/stats/incr/nanmhmean/docs/types/index.d.ts
new file mode 100644
index 000000000000..de373c233e7b
--- /dev/null
+++ b/lib/node_modules/@stdlib/stats/incr/nanmhmean/docs/types/index.d.ts
@@ -0,0 +1,75 @@
+/*
+* @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 harmonic mean; otherwise, returns the current harmonic mean, ignoring `NaN` values.
+*
+* @param x - value
+* @returns harmonic mean
+*/
+type accumulator = ( x?: number ) => number | null;
+
+/**
+* Returns an accumulator function which incrementally computes a moving harmonic mean, ignoring `NaN` values.
+*
+* ## Notes
+*
+* - The `W` parameter defines the number of values over which to compute the moving harmonic mean.
+* - As `W` values are needed to fill the window buffer, the first `W-1` returned values are calculated from smaller sample sizes. Until the window is full, each returned value is calculated from all provided values.
+*
+* @param W - window size
+* @throws must provide a positive integer
+* @returns accumulator function
+*
+* @example
+* var accumulator = incrmhmean( 3 );
+*
+* var v = accumulator();
+* // returns null
+*
+* v = accumulator( 2.0 );
+* // returns 2.0
+*
+* v = accumulator( 5.0 );
+* // returns ~2.86
+*
+* v = accumulator( NaN );
+* // returns ~2.86
+*
+* v = accumulator( 3.0 );
+* // returns ~2.90
+*
+* v = accumulator( 5.0 );
+* // returns ~4.09
+*
+* v = accumulator( NaN );
+* // returns ~4.09
+*
+* v = accumulator();
+* // returns ~4.09
+*/
+declare function incrnanmhmean( W: number ): accumulator;
+
+
+// EXPORTS //
+
+export = incrnanmhmean;
diff --git a/lib/node_modules/@stdlib/stats/incr/nanmhmean/docs/types/test.ts b/lib/node_modules/@stdlib/stats/incr/nanmhmean/docs/types/test.ts
new file mode 100644
index 000000000000..42c83d699711
--- /dev/null
+++ b/lib/node_modules/@stdlib/stats/incr/nanmhmean/docs/types/test.ts
@@ -0,0 +1,66 @@
+/*
+* @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 incrnanmhmean = require( './index' );
+
+
+// TESTS //
+
+// The function returns an accumulator function...
+{
+ incrnanmhmean( 3 ); // $ExpectType accumulator
+}
+
+// The compiler throws an error if the function is provided an argument that is not a number...
+{
+ incrnanmhmean( '5' ); // $ExpectError
+ incrnanmhmean( true ); // $ExpectError
+ incrnanmhmean( false ); // $ExpectError
+ incrnanmhmean( null ); // $ExpectError
+ incrnanmhmean( undefined ); // $ExpectError
+ incrnanmhmean( [] ); // $ExpectError
+ incrnanmhmean( {} ); // $ExpectError
+ incrnanmhmean( ( x: number ): number => x ); // $ExpectError
+}
+
+// The compiler throws an error if the function is provided an invalid number of arguments...
+{
+ incrnanmhmean(); // $ExpectError
+ incrnanmhmean( 2, 3 ); // $ExpectError
+}
+
+// The function returns an accumulator function which returns an accumulated result...
+{
+ const acc = incrnanmhmean( 3 );
+
+ 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 = incrnanmhmean( 3 );
+
+ 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/nanmhmean/examples/index.js b/lib/node_modules/@stdlib/stats/incr/nanmhmean/examples/index.js
new file mode 100644
index 000000000000..c64392c9f56d
--- /dev/null
+++ b/lib/node_modules/@stdlib/stats/incr/nanmhmean/examples/index.js
@@ -0,0 +1,42 @@
+/**
+* @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 incrnanmhmean = require( './../lib' );
+
+var accumulator;
+var m;
+var v;
+var i;
+
+// Initialize an accumulator:
+accumulator = incrnanmhmean( 5 );
+
+// For each simulated datum, update the moving harmonic mean...
+console.log( '\nValue\tHarmonic Mean\n' );
+for ( i = 0; i < 100; i++ ) {
+ if ( randu() < 0.2 ) {
+ v = NaN;
+ } else {
+ v = randu() * 100.0;
+ }
+ m = accumulator( v );
+ console.log( '%d\t%d', v.toFixed( 4 ), ( m === null ) ? NaN : m.toFixed( 4 ) );
+}
diff --git a/lib/node_modules/@stdlib/stats/incr/nanmhmean/lib/index.js b/lib/node_modules/@stdlib/stats/incr/nanmhmean/lib/index.js
new file mode 100644
index 000000000000..08831cb05ed1
--- /dev/null
+++ b/lib/node_modules/@stdlib/stats/incr/nanmhmean/lib/index.js
@@ -0,0 +1,63 @@
+/**
+* @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 a moving harmonic mean incrementally, ignoring `NaN` values.
+*
+* @module @stdlib/stats/incr/nanmhmean
+*
+* @example
+* var incrnanmhmean = require( '@stdlib/stats/incr/nanmhmean' );
+*
+* var accumulator = incrnanmhmean( 3 );
+*
+* var v = accumulator();
+* // returns null
+*
+* v = accumulator( 2.0 );
+* // returns 2.0
+*
+* v = accumulator( 5.0 );
+* // returns ~2.86
+*
+* v = accumulator( NaN );
+* // returns ~2.86
+*
+* v = accumulator( 3.0 );
+* // returns ~2.90
+*
+* v = accumulator( 5.0 );
+* // returns ~4.09
+*
+* v = accumulator( NaN );
+* // returns ~4.09
+*
+* v = accumulator();
+* // returns ~4.09
+*/
+
+// MODULES //
+
+var main = require( './main.js' );
+
+
+// EXPORTS //
+
+module.exports = main;
diff --git a/lib/node_modules/@stdlib/stats/incr/nanmhmean/lib/main.js b/lib/node_modules/@stdlib/stats/incr/nanmhmean/lib/main.js
new file mode 100644
index 000000000000..27e21caa0bd4
--- /dev/null
+++ b/lib/node_modules/@stdlib/stats/incr/nanmhmean/lib/main.js
@@ -0,0 +1,115 @@
+/**
+* @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 isPositiveInteger = require( '@stdlib/assert/is-positive-integer' ).isPrimitive;
+var incrmmean = require( '@stdlib/stats/incr/mmean' );
+var format = require( '@stdlib/string/format' );
+var isnan = require( '@stdlib/math/base/assert/is-nan' );
+
+
+// MAIN //
+
+/**
+* Returns an accumulator function which incrementally computes a moving harmonic mean, ignoring `NaN` values.
+*
+* ## Method
+*
+* - The harmonic mean of positive real numbers \\(x_0, x_1, \ldots, x_{n-1}\\) is defined as
+*
+* ```tex
+* \begin{align*}
+* H &= \frac{n}{\frac{1}{x_0} + \frac{1}{x_1} + \cdots + \frac{1}{x_{n-1}}} \\
+* &= \frac{n}{\sum_{i=0}^{n-1} \frac{1}{x_i}}
+* \end{align*}
+* ```
+*
+* which may be expressed
+*
+* ```tex
+* H = \biggl( \frac{\sum_{i=0}^{n-1} \frac{1}{x_i}}{n} \biggr)^{-1}
+* ```
+*
+* - Accordingly, to compute the harmonic mean for each window incrementally, ignoring `NaN` values, we can simply compute the arithmetic mean of reciprocal values and then compute the reciprocal of the result.
+*
+* @param {PositiveInteger} W - window size
+* @throws {TypeError} must provide a positive integer
+* @returns {Function} accumulator function
+*
+* @example
+* var accumulator = incrnanmhmean( 3 );
+*
+* var v = accumulator();
+* // returns null
+*
+* v = accumulator( 2.0 );
+* // returns 2.0
+*
+* v = accumulator( 5.0 );
+* // returns ~2.86
+*
+* v = accumulator( NaN );
+* // returns ~2.86
+*
+* v = accumulator( 3.0 );
+* // returns ~2.90
+*
+* v = accumulator( 5.0 );
+* // returns ~4.09
+*
+* v = accumulator( NaN );
+* // returns ~4.09
+*
+* v = accumulator();
+* // returns ~4.09
+*/
+function incrnanmhmean( W ) {
+ var mmean;
+ if ( !isPositiveInteger( W ) ) {
+ throw new TypeError( format( 'invalid argument. Must provide a positive integer. Value: `%s`.', W ) );
+ }
+ mmean = incrmmean( W );
+ return accumulator;
+
+ /**
+ * If provided a value, the accumulator function returns an updated harmonic mean. If not provided a value, the accumulator function returns the current harmonic mean.
+ *
+ * @private
+ * @param {number} [x] - input value
+ * @returns {(number|null)} harmonic mean or null
+ */
+ function accumulator( x ) {
+ var v;
+ if ( arguments.length === 0 || isnan(x) ) {
+ v = mmean();
+ if ( v === null ) {
+ return v;
+ }
+ return 1.0 / v;
+ }
+ return 1.0 / mmean( 1.0/x );
+ }
+}
+
+
+// EXPORTS //
+
+module.exports = incrnanmhmean;
diff --git a/lib/node_modules/@stdlib/stats/incr/nanmhmean/package.json b/lib/node_modules/@stdlib/stats/incr/nanmhmean/package.json
new file mode 100644
index 000000000000..ceebe7bc3f23
--- /dev/null
+++ b/lib/node_modules/@stdlib/stats/incr/nanmhmean/package.json
@@ -0,0 +1,74 @@
+{
+ "name": "@stdlib/stats/incr/nanmhmean",
+ "version": "0.0.0",
+ "description": "Compute a moving harmonic mean incrementally, ignoring `NaN` values.",
+ "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",
+ "average",
+ "avg",
+ "harmonic",
+ "mean",
+ "nan",
+ "harmonic mean",
+ "central tendency",
+ "incremental",
+ "accumulator",
+ "moving mean",
+ "moving average",
+ "sliding window",
+ "sliding",
+ "window",
+ "moving"
+ ]
+}
diff --git a/lib/node_modules/@stdlib/stats/incr/nanmhmean/test/test.js b/lib/node_modules/@stdlib/stats/incr/nanmhmean/test/test.js
new file mode 100644
index 000000000000..e762946ce7fb
--- /dev/null
+++ b/lib/node_modules/@stdlib/stats/incr/nanmhmean/test/test.js
@@ -0,0 +1,141 @@
+/**
+* @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 abs = require( '@stdlib/math/base/special/abs' );
+var EPSILON = require( '@stdlib/constants/float64/eps' );
+var incrnanmhmean = require( '@stdlib/stats/incr/nanmhmean/lib' );
+
+
+// TESTS //
+
+tape( 'main export is a function', function test( t ) {
+ t.ok( true, __filename );
+ t.strictEqual( typeof incrnanmhmean, 'function', 'main export is a function' );
+ t.end();
+});
+
+tape( 'the function throws an error if not provided a positive integer', function test( t ) {
+ var values;
+ var i;
+
+ values = [
+ '5',
+ -5.0,
+ 0.0,
+ 3.14,
+ true,
+ null,
+ void 0,
+ NaN,
+ [],
+ {},
+ 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() {
+ incrnanmhmean( value );
+ };
+ }
+});
+
+tape( 'the function returns an accumulator function', function test( t ) {
+ t.equal( typeof incrnanmhmean( 3 ), 'function', 'returns a function' );
+ t.end();
+});
+
+tape( 'the accumulator function computes a moving harmonic mean incrementally', function test( t ) {
+ var expected;
+ var actual;
+ var delta;
+ var data;
+ var tol;
+ var acc;
+ var N;
+ var i;
+
+ data = [ 2.0, 3.0, NaN, 2.0, 4.0, 3.0, NaN, 4.0 ];
+ N = data.length;
+
+ acc = incrnanmhmean( 3 );
+
+ actual = [];
+ for ( i = 0; i < N; i++ ) {
+ actual.push( acc( data[ i ] ) );
+ }
+ // Note: computed by hand using textbook formula:
+ expected = [
+ 2.0,
+ 2.4,
+ 2.4,
+ 2.25,
+ 2.7692307692307696,
+ 2.7692307692307696,
+ 2.7692307692307696,
+ 3.6
+ ];
+
+ for ( i = 0; i < N; i++ ) {
+ if ( actual[ i ] === expected[ i ] ) {
+ t.equal( actual[ i ], expected[ i ], 'returns expected value' );
+ } else {
+ delta = abs( expected[ i ] - actual[ i ] );
+ tol = EPSILON * abs( expected[ i ] );
+ t.equal( delta <= tol, true, 'within tolerance. Expected: '+expected[ i ]+'. Actual: '+actual[ i ]+'. Delta: '+delta+'. Tol: '+tol+'.' );
+ }
+ }
+ t.end();
+});
+
+tape( 'if not provided an input value, the accumulator function returns the current harmonic mean', function test( t ) {
+ var expected;
+ var actual;
+ var delta;
+ var data;
+ var acc;
+ var tol;
+ var i;
+
+ data = [ 2.0, NaN, 3.0, NaN, 5.0 ];
+ acc = incrnanmhmean( 2 );
+ for ( i = 0; i < data.length; i++ ) {
+ acc( data[ i ] );
+ }
+ actual = acc();
+ expected = 3.75; // Note: computed by hand using textbook formula
+ delta = abs( expected - actual );
+ tol = 1.1 * EPSILON * abs( expected );
+ t.equal( delta <= tol, true, 'within tolerance. Expected: '+expected+'. Actual: '+actual+'. Delta: '+delta+'. Tol: '+tol+'.' );
+ t.end();
+});
+
+tape( 'if data has yet to be provided, the accumulator function returns `null`', function test( t ) {
+ var acc = incrnanmhmean( 3 );
+ t.equal( acc(), null, 'returns null' );
+ t.end();
+});