From 71360b843005c0a1fd51e2829d9538480b247cfe Mon Sep 17 00:00:00 2001 From: AaryaBalwadkarPHC Date: Tue, 18 Mar 2025 17:03:01 +0530 Subject: [PATCH 1/5] feat(stats): add nanmeanstdev package --- .../@stdlib/stats/incr/nanmeanstdev/README.md | 231 ++++++++++++++++++ .../incr/nanmeanstdev/benchmark/benchmark.js | 69 ++++++ .../docs/img/equation_arithmetic_mean.svg | 43 ++++ ...on_corrected_sample_standard_deviation.svg | 73 ++++++ .../stats/incr/nanmeanstdev/docs/repl.txt | 40 +++ .../incr/nanmeanstdev/docs/types/index.d.ts | 70 ++++++ .../incr/nanmeanstdev/docs/types/test.ts | 61 +++++ .../stats/incr/nanmeanstdev/examples/index.js | 72 ++++++ .../stats/incr/nanmeanstdev/lib/index.js | 60 +++++ .../stats/incr/nanmeanstdev/lib/main.js | 74 ++++++ .../stats/incr/nanmeanstdev/package.json | 73 ++++++ .../stats/incr/nanmeanstdev/test/test.js | 185 ++++++++++++++ 12 files changed, 1051 insertions(+) create mode 100644 lib/node_modules/@stdlib/stats/incr/nanmeanstdev/README.md create mode 100644 lib/node_modules/@stdlib/stats/incr/nanmeanstdev/benchmark/benchmark.js create mode 100644 lib/node_modules/@stdlib/stats/incr/nanmeanstdev/docs/img/equation_arithmetic_mean.svg create mode 100644 lib/node_modules/@stdlib/stats/incr/nanmeanstdev/docs/img/equation_corrected_sample_standard_deviation.svg create mode 100644 lib/node_modules/@stdlib/stats/incr/nanmeanstdev/docs/repl.txt create mode 100644 lib/node_modules/@stdlib/stats/incr/nanmeanstdev/docs/types/index.d.ts create mode 100644 lib/node_modules/@stdlib/stats/incr/nanmeanstdev/docs/types/test.ts create mode 100644 lib/node_modules/@stdlib/stats/incr/nanmeanstdev/examples/index.js create mode 100644 lib/node_modules/@stdlib/stats/incr/nanmeanstdev/lib/index.js create mode 100644 lib/node_modules/@stdlib/stats/incr/nanmeanstdev/lib/main.js create mode 100644 lib/node_modules/@stdlib/stats/incr/nanmeanstdev/package.json create mode 100644 lib/node_modules/@stdlib/stats/incr/nanmeanstdev/test/test.js diff --git a/lib/node_modules/@stdlib/stats/incr/nanmeanstdev/README.md b/lib/node_modules/@stdlib/stats/incr/nanmeanstdev/README.md new file mode 100644 index 000000000000..d55082aa95be --- /dev/null +++ b/lib/node_modules/@stdlib/stats/incr/nanmeanstdev/README.md @@ -0,0 +1,231 @@ + + +# incrnanmeanstdev + +> Compute an [arithmetic mean][arithmetic-mean] and a [corrected sample standard deviation][sample-stdev] incrementally, ignoring `NaN` values. + +
+ +The [arithmetic mean][arithmetic-mean] is defined as + + + +```math +\bar{x} = \frac{1}{n} \sum_{i=0}^{n-1} x_i +``` + + + + + +and the [corrected sample standard deviation][sample-stdev] is defined as + + + +```math +s = \sqrt{\frac{1}{n-1} \sum_{i=0}^{n-1} ( x_i - \bar{x} )^2} +``` + + + + + +
+ +## Usage + +```javascript +var incrnanmeanstdev = require( '@stdlib/stats/incr/nanmeanstdev' ); +``` + +#### incrnanmeanstdev( \[out] ) + +Returns an accumulator `function` which incrementally computes an [arithmetic mean][arithmetic-mean] and [corrected sample standard deviation][sample-stdev], ignoring `NaN` values. + +```javascript +var accumulator = incrnanmeanstdev(); +``` + +By default, the returned accumulator `function` returns the accumulated values as a two-element `array`. To avoid unnecessary memory allocation, the function supports providing an output (destination) object. + +```javascript +var Float64Array = require( '@stdlib/array/float64' ); + +var accumulator = incrnanmeanstdev( new Float64Array( 2 ) ); +``` + +#### accumulator( \[x] ) + +If provided an input value `x`, the accumulator function returns updated accumulated values. If not provided an input value `x`, the accumulator function returns the current accumulated values. + +```javascript +var accumulator = incrmeanstdev(); + +var ms = accumulator(); +// returns null + +var ms = accumulator( NaN ); +// returns null + +ms = accumulator( 2.0 ); +// returns [ 2.0, 0.0 ] + +ms = accumulator( 1.0 ); +// returns [ 1.5, ~0.71 ] + +ms = accumulator( 3.0 ); +// returns [ 2.0, 1.0 ] + +ms = accumulator( -7.0 ); +// returns [ -0.25, ~4.57 ] + +ms = accumulator( -5.0 ); +// returns [ -1.2, ~4.49 ] + +ms = accumulator(); +// returns [ -1.2, ~4.49 ] +``` + +
+ + + +
+ +## 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 Float64Array = require( '@stdlib/array/float64' ); +var ArrayBuffer = require( '@stdlib/array/buffer' ); +var incrnanmeanstdev = require( '@stdlib/stats/incr/nanmeanstdev' ); + +var offset; +var acc; +var buf; +var out; +var ms; +var N; +var v; +var i; +var j; + +// Define the number of accumulators: +N = 5; + +// Create an array buffer for storing accumulator output: +buf = new ArrayBuffer( N*2*8 ); // 8 bytes per element + +// Initialize accumulators: +acc = []; +for ( i = 0; i < N; i++ ) { + // Compute the byte offset: + offset = i * 2 * 8; // stride=2, bytes_per_element=8 + + // Create a new view for storing accumulated values: + out = new Float64Array( buf, offset, 2 ); + + // Initialize an accumulator which will write results to the view: + acc.push( incrmeanstdev( out ) ); +} + +// Simulate data and update the sample means and standard deviations... +for ( i = 0; i < 100; i++ ) { + for ( j = 0; j < N; j++ ) { + if ( randu() < 0.1 ){ + v = NaN; + } else { + v = randu() * 100.0 * (j+1); + } + acc[ j ]( v ); + } +} + +// Print the final results: +console.log( 'Mean\tStDev' ); +for ( i = 0; i < N; i++ ) { + ms = acc[ i ](); + console.log( '%d\t%d', ms[ 0 ].toFixed( 3 ), ms[ 1 ].toFixed( 3 ) ); +} +``` + +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/stats/incr/nanmeanstdev/benchmark/benchmark.js b/lib/node_modules/@stdlib/stats/incr/nanmeanstdev/benchmark/benchmark.js new file mode 100644 index 000000000000..728300a49f95 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/incr/nanmeanstdev/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 incrnanmeanstdev = require( './../lib' ); + + +// MAIN // + +bench( pkg, function benchmark( b ) { + var f; + var i; + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + f = incrnanmeanstdev(); + 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 = incrnanmeanstdev(); + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + v = acc( randu() ); + if ( v.length !== 2 ) { + b.fail( 'should contain two elements' ); + } + } + b.toc(); + if ( v[ 0 ] !== v[ 0 ] || v[ 1 ] !== v[ 1 ] ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/stats/incr/nanmeanstdev/docs/img/equation_arithmetic_mean.svg b/lib/node_modules/@stdlib/stats/incr/nanmeanstdev/docs/img/equation_arithmetic_mean.svg new file mode 100644 index 000000000000..aea7a5f6687a --- /dev/null +++ b/lib/node_modules/@stdlib/stats/incr/nanmeanstdev/docs/img/equation_arithmetic_mean.svg @@ -0,0 +1,43 @@ + +x overbar equals StartFraction 1 Over n EndFraction sigma-summation Underscript i equals 0 Overscript n minus 1 Endscripts x Subscript i + + + \ No newline at end of file diff --git a/lib/node_modules/@stdlib/stats/incr/nanmeanstdev/docs/img/equation_corrected_sample_standard_deviation.svg b/lib/node_modules/@stdlib/stats/incr/nanmeanstdev/docs/img/equation_corrected_sample_standard_deviation.svg new file mode 100644 index 000000000000..6af85c9d5732 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/incr/nanmeanstdev/docs/img/equation_corrected_sample_standard_deviation.svg @@ -0,0 +1,73 @@ + +s equals StartRoot StartFraction 1 Over n minus 1 EndFraction sigma-summation Underscript i equals 0 Overscript n minus 1 Endscripts left-parenthesis x Subscript i Baseline minus x overbar right-parenthesis squared EndRoot + + + \ No newline at end of file diff --git a/lib/node_modules/@stdlib/stats/incr/nanmeanstdev/docs/repl.txt b/lib/node_modules/@stdlib/stats/incr/nanmeanstdev/docs/repl.txt new file mode 100644 index 000000000000..1dd5c54c6fe8 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/incr/nanmeanstdev/docs/repl.txt @@ -0,0 +1,40 @@ + +{{alias}}( [out] ) + Returns an accumulator function which incrementally computes an arithmetic + mean and corrected sample standard deviation, ignoring `NaN` values. + + If provided a value, the accumulator function returns updated accumulated + values. If not provided a value, the accumulator function returns the + current accumulated values. + + Parameters + ---------- + out: Array|TypedArray (optional) + Output array. + + Returns + ------- + acc: Function + Accumulator function. + + Examples + -------- + > var accumulator = {{alias}}(); + > var ms = accumulator() + null + > ms = accumulator( NaN ) + null + > ms = accumulator( 2.0 ) + [ 2.0, 0.0 ] + > ms = accumulator( -5.0 ) + [ -1.5, ~4.95 ] + > ms = accumulator( 3.0 ) + [ 0.0, ~4.36 ] + > ms = accumulator( 5.0 ) + [ 1.25, ~4.35 ] + > ms = accumulator() + [ 1.25, ~4.35 ] + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/stats/incr/nanmeanstdev/docs/types/index.d.ts b/lib/node_modules/@stdlib/stats/incr/nanmeanstdev/docs/types/index.d.ts new file mode 100644 index 000000000000..6b632bde2643 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/incr/nanmeanstdev/docs/types/index.d.ts @@ -0,0 +1,70 @@ +/* +* @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 + +/// + +import { ArrayLike } from '@stdlib/types/array'; + +/** +* If provided a value, the accumulator function returns updated results. If not provided a value, the accumulator function returns the current results. +* +* ## Notes +* +* @param x - input value +* @returns output array or null +*/ +type accumulator = ( x?: number ) => ArrayLike | null; + +/** +* Returns an accumulator function which incrementally computes an arithmetic mean and corrected sample standard deviation, ignoring `NaN` values. +* +* @param out - output array +* @returns accumulator function +* +* @example +* var accumulator = incrmeanstdev(); +* +* var ms = accumulator(); +* // returns null +* +* var ms = accumulator( NaN ); +* // returns null +* +* ms = accumulator( 2.0 ); +* // returns [ 2.0, 0.0 ] +* +* ms = accumulator( -5.0 ); +* // returns [ -1.5, ~4.95 ] +* +* ms = accumulator( 3.0 ); +* // returns [ 0.0, ~4.36 ] +* +* ms = accumulator( 5.0 ); +* // returns [ 1.25, ~4.35 ] +* +* ms = accumulator(); +* // returns [ 1.25, ~4.35 ] +*/ +declare function incrnanmeanstdev( out?: ArrayLike ): accumulator; + + +// EXPORTS // + +export = incrnanmeanstdev; diff --git a/lib/node_modules/@stdlib/stats/incr/nanmeanstdev/docs/types/test.ts b/lib/node_modules/@stdlib/stats/incr/nanmeanstdev/docs/types/test.ts new file mode 100644 index 000000000000..76fc40bb053c --- /dev/null +++ b/lib/node_modules/@stdlib/stats/incr/nanmeanstdev/docs/types/test.ts @@ -0,0 +1,61 @@ +/* +* @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 incrnanmeanstdev = require( './index' ); + + +// TESTS // + +// The function returns an accumulator function... +{ + incrnanmeanstdev(); // $ExpectType accumulator + const out = [ 0.0, 0.0 ]; + incrnanmeanstdev( out ); // $ExpectType accumulator +} + +// The compiler throws an error if the function is provided an argument that is not an array-like object of numbers... +{ + incrnanmeanstdev( '5' ); // $ExpectError + incrnanmeanstdev( 5 ); // $ExpectError + incrnanmeanstdev( true ); // $ExpectError + incrnanmeanstdev( false ); // $ExpectError + incrnanmeanstdev( null ); // $ExpectError + incrnanmeanstdev( {} ); // $ExpectError + incrnanmeanstdev( ( x: number ): number => x ); // $ExpectError +} + +// The function returns an accumulator function which returns an accumulated result... +{ + const acc = incrnanmeanstdev(); + + acc(); // $ExpectType ArrayLike | null + acc( 3.14 ); // $ExpectType ArrayLike | null +} + +// The compiler throws an error if the returned accumulator function is provided invalid arguments... +{ + const acc = incrnanmeanstdev(); + + 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/nanmeanstdev/examples/index.js b/lib/node_modules/@stdlib/stats/incr/nanmeanstdev/examples/index.js new file mode 100644 index 000000000000..b65c54f094ef --- /dev/null +++ b/lib/node_modules/@stdlib/stats/incr/nanmeanstdev/examples/index.js @@ -0,0 +1,72 @@ +/** +* @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 Float64Array = require( '@stdlib/array/float64' ); +var ArrayBuffer = require( '@stdlib/array/buffer' ); +var incrnanmeanstdev = require( './../lib' ); + +var offset; +var acc; +var buf; +var out; +var ms; +var N; +var v; +var i; +var j; + +// Define the number of accumulators: +N = 5; + +// Create an array buffer for storing accumulator output: +buf = new ArrayBuffer( N*2*8 ); // 8 bytes per element + +// Initialize accumulators: +acc = []; +for ( i = 0; i < N; i++ ) { + // Compute the byte offset: + offset = i * 2 * 8; // stride=2, bytes_per_element=8 + + // Create a new view for storing accumulated values: + out = new Float64Array( buf, offset, 2 ); + + // Initialize an accumulator which will write results to the view: + acc.push( incrnanmeanstdev( out ) ); +} + +// Simulate data and update the sample means and standard deviations... +for ( i = 0; i < 100; i++ ) { + for ( j = 0; j < N; j++ ) { + if ( randu() < 0.1 ){ + v = NaN; + } else { + v = randu() * 100.0 * (j+1); + } + acc[ j ]( v ); + } +} + +// Print the final results: +console.log( 'Mean\tStDev' ); +for ( i = 0; i < N; i++ ) { + ms = acc[ i ](); + console.log( '%d\t%d', ms[ 0 ].toFixed( 3 ), ms[ 1 ].toFixed( 3 ) ); +} diff --git a/lib/node_modules/@stdlib/stats/incr/nanmeanstdev/lib/index.js b/lib/node_modules/@stdlib/stats/incr/nanmeanstdev/lib/index.js new file mode 100644 index 000000000000..1d28b88dd731 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/incr/nanmeanstdev/lib/index.js @@ -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. +*/ + +'use strict'; + +/** +* Compute an arithmetic mean and corrected sample standard deviation incrementally, ignoring `NaN` values. +* +* @module @stdlib/stats/incr/nanmeanstdev +* +* @example +* var incrnanmeanstdev = require( '@stdlib/stats/incr/nanmeanstdev' ); +* +* var accumulator = incrnanmeanstdev(); +* +* var ms = accumulator(); +* // returns null +* +* var ms = accumulator( NaN ); +* // returns null +* +* ms = accumulator( 2.0 ); +* // returns [ 2.0, 0.0 ] +* +* ms = accumulator( -5.0 ); +* // returns [ -1.5, ~4.95 ] +* +* ms = accumulator( 3.0 ); +* // returns [ 0.0, ~4.36 ] +* +* ms = accumulator( 5.0 ); +* // returns [ 1.25, ~4.35 ] +* +* ms = accumulator(); +* // returns [ 1.25, ~4.35 ] +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/stats/incr/nanmeanstdev/lib/main.js b/lib/node_modules/@stdlib/stats/incr/nanmeanstdev/lib/main.js new file mode 100644 index 000000000000..3022132b4197 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/incr/nanmeanstdev/lib/main.js @@ -0,0 +1,74 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2018 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 incrmeanstdev = require( '@stdlib/stats/incr/meanstdev' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); + +// MAIN // + +/** +* Returns an accumulator function which incrementally computes an arithmetic mean and corrected sample standard deviation, +* while skipping NaN values. +* +* @param {Collection} [out] - output array +* @throws {TypeError} output argument must be array-like +* @returns {Function} accumulator function +* +* @example +* var accumulator = incrnanmeanstdev(); +* +* var ms = accumulator(); +* // returns null +* +* ms = accumulator( 2.0 ); +* // returns [ 2.0, 0.0 ] +* +* ms = accumulator( NaN ); +* // returns [ 2.0, 0.0 ] +* +* ms = accumulator( -5.0 ); +* // returns [ -1.5, ~4.95 ] +* +* ms = accumulator( 3.0 ); +* // returns [ 0.0, ~4.36 ] +* +* ms = accumulator( 5.0 ); +* // returns [ 1.25, ~4.35 ] +* +* ms = accumulator(); +* // returns [ 1.25, ~4.35 ] +*/ +function incrnanmeanstdev( out ) { + var nanmeanstdev = (arguments.length === 0) ? incrmeanstdev() : incrmeanstdev(out); + return accumulator; + + function accumulator( x ) { + if ( arguments.length === 0 || isnan( x ) ) { + return nanmeanstdev(); + } + return nanmeanstdev( x ); + }; +} + +// EXPORTS // + +module.exports = incrnanmeanstdev; \ No newline at end of file diff --git a/lib/node_modules/@stdlib/stats/incr/nanmeanstdev/package.json b/lib/node_modules/@stdlib/stats/incr/nanmeanstdev/package.json new file mode 100644 index 000000000000..542f34aa6682 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/incr/nanmeanstdev/package.json @@ -0,0 +1,73 @@ +{ + "name": "@stdlib/stats/incr/meanstdev", + "version": "0.0.0", + "description": "Compute an arithmetic mean and corrected sample standard deviation 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", + "average", + "avg", + "mean", + "arithmetic mean", + "variance", + "sample variance", + "unbiased", + "var", + "dispersion", + "standard deviation", + "stdev", + "central tendency", + "incremental", + "accumulator" + ] +} diff --git a/lib/node_modules/@stdlib/stats/incr/nanmeanstdev/test/test.js b/lib/node_modules/@stdlib/stats/incr/nanmeanstdev/test/test.js new file mode 100644 index 000000000000..22f4b72d3c5d --- /dev/null +++ b/lib/node_modules/@stdlib/stats/incr/nanmeanstdev/test/test.js @@ -0,0 +1,185 @@ +/** +* @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 isnan = require( '@stdlib/math/base/assert/is-nan' ); +var sqrt = require( '@stdlib/math/base/special/sqrt' ); +var incrnanmeanstdev = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof incrnanmeanstdev, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function throws an error if not provided an array-like object for an output argument', function test( t ) { + var values; + var i; + + values = [ + '5', + -5.0, + true, + false, + 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() { + incrnanmeanstdev( value ); + }; + } +}); + +tape( 'the function returns an accumulator function', function test( t ) { + t.equal( typeof incrnanmeanstdev(), 'function', 'returns a function' ); + t.end(); +}); + +tape( 'the function returns an accumulator function (output)', function test( t ) { + t.equal( typeof incrnanmeanstdev( [ 0.0, 0.0 ] ), 'function', 'returns a function' ); + t.end(); +}); + +tape( 'the accumulator function incrementally computes an arithmetic mean and corrected sample standard deviation', function test( t ) { + var expected; + var actual; + var data; + var acc; + var N; + var i; + + data = [ 2.0, 3.0, 2.0, NaN, 4.0, NaN, 3.0, 4.0 ]; + N = data.length; + + // Test against Julia: + expected = [ + [ 2.0, 0.0 ], + [ 2.5, sqrt( 0.5 ) ], + [ 7.0/3.0, sqrt( 0.33333333333333337 ) ], + [ 7.0/3.0, sqrt( 0.33333333333333337 ) ], + [ 11.0/4.0, sqrt( 0.9166666666666666 ) ], + [ 11.0/4.0, sqrt( 0.9166666666666666 ) ], + [ 14.0/5.0, sqrt( 0.7 ) ], + [ 18.0/6.0, sqrt( 0.8 ) ] + ]; + + acc = incrnanmeanstdev(); + + for ( i = 0; i < N; i++ ) { + actual = acc( data[ i ] ); + t.deepEqual( actual, expected[ i ], 'returns expected value' ); + } + t.end(); +}); + +tape( 'the accumulator function incrementally computes an arithmetic mean and corrected sample standard deviation (output)', function test( t ) { + var expected; + var actual; + var data; + var acc; + var out; + var N; + var i; + + data = [ 2.0, 3.0, 2.0, NaN, 4.0, NaN, 3.0, 4.0 ]; + N = data.length; + + // Test against Julia: + expected = [ + [ 2.0, 0.0 ], + [ 2.5, sqrt( 0.5 ) ], + [ 7.0/3.0, sqrt( 0.33333333333333337 ) ], + [ 7.0/3.0, sqrt( 0.33333333333333337 ) ], + [ 11.0/4.0, sqrt( 0.9166666666666666 ) ], + [ 11.0/4.0, sqrt( 0.9166666666666666 ) ], + [ 14.0/5.0, sqrt( 0.7 ) ], + [ 18.0/6.0, sqrt( 0.8 ) ] + ]; + out = [ 0.0, 0.0 ]; + acc = incrnanmeanstdev( out ); + + for ( i = 0; i < N; i++ ) { + actual = acc( data[ i ] ); + t.equal( actual, out, 'returns output array' ); + t.deepEqual( actual, expected[ i ], 'returns expected value' ); + } + t.end(); +}); + +tape( 'if not provided an input value, the accumulator function returns the current mean and corrected sample standard deviation', function test( t ) { + var data; + var acc; + var i; + + data = [ 2.0, NaN, 3.0, NaN, 1.0 ]; + acc = incrnanmeanstdev(); + for ( i = 0; i < data.length; i++ ) { + acc( data[ i ] ); + } + t.deepEqual( acc(), [ 2.0, 1.0 ], 'returns expected value' ); + t.end(); +}); + +tape( 'if data has yet to be provided, the accumulator function returns `null`', function test( t ) { + var acc = incrnanmeanstdev(); + t.equal( acc(), null, 'returns null' ); + t.equal( acc(), null, 'returns null' ); + t.equal( acc(), null, 'returns null' ); + t.end(); +}); + +tape( 'the sample standard deviation is `0` until at least 2 datums have been provided', function test( t ) { + var acc; + var ms; + + acc = incrnanmeanstdev(); + + ms = acc(); + t.equal( ms, null, 'returns null' ); + + ms = acc( 3.0 ); + t.equal( ms[ 1 ], 0.0, 'returns expected value' ); + + ms = acc(); + t.equal( ms[ 1 ], 0.0, 'returns expected value' ); + + ms = acc( 5.0 ); + t.notEqual( ms[ 1 ], 0.0, 'does not return 0' ); + + ms = acc(); + t.notEqual( ms[ 1 ], 0.0, 'does not return 0' ); + + t.end(); +}); From 1ed5f4dde2700fdc0b702f9f0b883d26b002cc89 Mon Sep 17 00:00:00 2001 From: Philipp Burckhardt Date: Sun, 19 Jul 2026 00:20:54 -0500 Subject: [PATCH 2/5] fix: address review feedback --- .../@stdlib/stats/incr/nanmeanstdev/README.md | 27 +++------------ .../incr/nanmeanstdev/benchmark/benchmark.js | 5 +-- .../stats/incr/nanmeanstdev/docs/repl.txt | 3 ++ .../incr/nanmeanstdev/docs/types/index.d.ts | 8 ++--- .../incr/nanmeanstdev/docs/types/test.ts | 2 +- .../stats/incr/nanmeanstdev/examples/index.js | 4 +-- .../stats/incr/nanmeanstdev/lib/index.js | 4 +-- .../stats/incr/nanmeanstdev/lib/main.js | 33 +++++++++++++------ .../stats/incr/nanmeanstdev/package.json | 4 +-- .../stats/incr/nanmeanstdev/test/test.js | 2 +- 10 files changed, 46 insertions(+), 46 deletions(-) diff --git a/lib/node_modules/@stdlib/stats/incr/nanmeanstdev/README.md b/lib/node_modules/@stdlib/stats/incr/nanmeanstdev/README.md index d55082aa95be..444c270f5d00 100644 --- a/lib/node_modules/@stdlib/stats/incr/nanmeanstdev/README.md +++ b/lib/node_modules/@stdlib/stats/incr/nanmeanstdev/README.md @@ -2,7 +2,7 @@ @license Apache-2.0 -Copyright (c) 2025 The Stdlib Authors. +Copyright (c) 2026 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. @@ -83,12 +83,12 @@ var accumulator = incrnanmeanstdev( new Float64Array( 2 ) ); If provided an input value `x`, the accumulator function returns updated accumulated values. If not provided an input value `x`, the accumulator function returns the current accumulated values. ```javascript -var accumulator = incrmeanstdev(); +var accumulator = incrnanmeanstdev(); var ms = accumulator(); // returns null -var ms = accumulator( NaN ); +ms = accumulator( NaN ); // returns null ms = accumulator( 2.0 ); @@ -162,13 +162,13 @@ for ( i = 0; i < N; i++ ) { out = new Float64Array( buf, offset, 2 ); // Initialize an accumulator which will write results to the view: - acc.push( incrmeanstdev( out ) ); + acc.push( incrnanmeanstdev( out ) ); } // Simulate data and update the sample means and standard deviations... for ( i = 0; i < 100; i++ ) { for ( j = 0; j < N; j++ ) { - if ( randu() < 0.1 ){ + if ( randu() < 0.1 ) { v = NaN; } else { v = randu() * 100.0 * (j+1); @@ -193,15 +193,6 @@ for ( i = 0; i < N; i++ ) { @@ -216,14 +207,6 @@ for ( i = 0; i < N; i++ ) { -[@stdlib/stats/incr/mean]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/stats/incr/mean - -[@stdlib/stats/incr/meanvar]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/stats/incr/meanvar - -[@stdlib/stats/incr/mmeanstdev]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/stats/incr/mmeanstdev - -[@stdlib/stats/incr/stdev]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/stats/incr/stdev -
diff --git a/lib/node_modules/@stdlib/stats/incr/nanmeanstdev/benchmark/benchmark.js b/lib/node_modules/@stdlib/stats/incr/nanmeanstdev/benchmark/benchmark.js index 728300a49f95..2f03624d69f2 100644 --- a/lib/node_modules/@stdlib/stats/incr/nanmeanstdev/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/stats/incr/nanmeanstdev/benchmark/benchmark.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. @@ -22,6 +22,7 @@ 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 incrnanmeanstdev = require( './../lib' ); @@ -46,7 +47,7 @@ bench( pkg, function benchmark( b ) { b.end(); }); -bench( pkg+'::accumulator', function benchmark( b ) { +bench( format( '%s::accumulator', pkg ), function benchmark( b ) { var acc; var v; var i; diff --git a/lib/node_modules/@stdlib/stats/incr/nanmeanstdev/docs/repl.txt b/lib/node_modules/@stdlib/stats/incr/nanmeanstdev/docs/repl.txt index 1dd5c54c6fe8..97ff21b6f331 100644 --- a/lib/node_modules/@stdlib/stats/incr/nanmeanstdev/docs/repl.txt +++ b/lib/node_modules/@stdlib/stats/incr/nanmeanstdev/docs/repl.txt @@ -7,6 +7,9 @@ values. If not provided a value, the accumulator function returns the current accumulated values. + If provided `NaN`, the update is skipped and the accumulator continues to + return the previous accumulated values. + Parameters ---------- out: Array|TypedArray (optional) diff --git a/lib/node_modules/@stdlib/stats/incr/nanmeanstdev/docs/types/index.d.ts b/lib/node_modules/@stdlib/stats/incr/nanmeanstdev/docs/types/index.d.ts index 6b632bde2643..e3ae29b4aef5 100644 --- a/lib/node_modules/@stdlib/stats/incr/nanmeanstdev/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/stats/incr/nanmeanstdev/docs/types/index.d.ts @@ -1,7 +1,7 @@ /* * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. @@ -39,12 +39,12 @@ type accumulator = ( x?: number ) => ArrayLike | null; * @returns accumulator function * * @example -* var accumulator = incrmeanstdev(); +* var accumulator = incrnanmeanstdev(); * * var ms = accumulator(); * // returns null -* -* var ms = accumulator( NaN ); +* +* ms = accumulator( NaN ); * // returns null * * ms = accumulator( 2.0 ); diff --git a/lib/node_modules/@stdlib/stats/incr/nanmeanstdev/docs/types/test.ts b/lib/node_modules/@stdlib/stats/incr/nanmeanstdev/docs/types/test.ts index 76fc40bb053c..4598dac8e37f 100644 --- a/lib/node_modules/@stdlib/stats/incr/nanmeanstdev/docs/types/test.ts +++ b/lib/node_modules/@stdlib/stats/incr/nanmeanstdev/docs/types/test.ts @@ -1,7 +1,7 @@ /* * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. diff --git a/lib/node_modules/@stdlib/stats/incr/nanmeanstdev/examples/index.js b/lib/node_modules/@stdlib/stats/incr/nanmeanstdev/examples/index.js index b65c54f094ef..a2af2326a3de 100644 --- a/lib/node_modules/@stdlib/stats/incr/nanmeanstdev/examples/index.js +++ b/lib/node_modules/@stdlib/stats/incr/nanmeanstdev/examples/index.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. @@ -55,7 +55,7 @@ for ( i = 0; i < N; i++ ) { // Simulate data and update the sample means and standard deviations... for ( i = 0; i < 100; i++ ) { for ( j = 0; j < N; j++ ) { - if ( randu() < 0.1 ){ + if ( randu() < 0.1 ) { v = NaN; } else { v = randu() * 100.0 * (j+1); diff --git a/lib/node_modules/@stdlib/stats/incr/nanmeanstdev/lib/index.js b/lib/node_modules/@stdlib/stats/incr/nanmeanstdev/lib/index.js index 1d28b88dd731..693b2dbbcb63 100644 --- a/lib/node_modules/@stdlib/stats/incr/nanmeanstdev/lib/index.js +++ b/lib/node_modules/@stdlib/stats/incr/nanmeanstdev/lib/index.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. @@ -31,7 +31,7 @@ * var ms = accumulator(); * // returns null * -* var ms = accumulator( NaN ); +* ms = accumulator( NaN ); * // returns null * * ms = accumulator( 2.0 ); diff --git a/lib/node_modules/@stdlib/stats/incr/nanmeanstdev/lib/main.js b/lib/node_modules/@stdlib/stats/incr/nanmeanstdev/lib/main.js index 3022132b4197..598f2b42345a 100644 --- a/lib/node_modules/@stdlib/stats/incr/nanmeanstdev/lib/main.js +++ b/lib/node_modules/@stdlib/stats/incr/nanmeanstdev/lib/main.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2018 The Stdlib Authors. +* Copyright (c) 2026 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. @@ -23,11 +23,11 @@ var incrmeanstdev = require( '@stdlib/stats/incr/meanstdev' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); + // MAIN // /** -* Returns an accumulator function which incrementally computes an arithmetic mean and corrected sample standard deviation, -* while skipping NaN values. +* Returns an accumulator function which incrementally computes an arithmetic mean and corrected sample standard deviation, ignoring `NaN` values. * * @param {Collection} [out] - output array * @throws {TypeError} output argument must be array-like @@ -58,17 +58,30 @@ var isnan = require( '@stdlib/math/base/assert/is-nan' ); * // returns [ 1.25, ~4.35 ] */ function incrnanmeanstdev( out ) { - var nanmeanstdev = (arguments.length === 0) ? incrmeanstdev() : incrmeanstdev(out); + var meanstdev; + if ( arguments.length > 0 ) { + meanstdev = incrmeanstdev( out ); + } else { + meanstdev = incrmeanstdev(); + } return accumulator; - function accumulator( x ) { - if ( arguments.length === 0 || isnan( x ) ) { - return nanmeanstdev(); - } - return nanmeanstdev( x ); - }; + /** + * If provided a value, the accumulator function returns updated accumulated values. If not provided a value, the accumulator function returns the current accumulated values. + * + * @private + * @param {number} [x] - input value + * @returns {(ArrayLikeObject|null)} output array or null + */ + function accumulator( x ) { + if ( arguments.length === 0 || isnan( x ) ) { + return meanstdev(); + } + return meanstdev( x ); + } } + // EXPORTS // module.exports = incrnanmeanstdev; \ No newline at end of file diff --git a/lib/node_modules/@stdlib/stats/incr/nanmeanstdev/package.json b/lib/node_modules/@stdlib/stats/incr/nanmeanstdev/package.json index 542f34aa6682..0e31ec9c21ba 100644 --- a/lib/node_modules/@stdlib/stats/incr/nanmeanstdev/package.json +++ b/lib/node_modules/@stdlib/stats/incr/nanmeanstdev/package.json @@ -1,7 +1,7 @@ { - "name": "@stdlib/stats/incr/meanstdev", + "name": "@stdlib/stats/incr/nanmeanstdev", "version": "0.0.0", - "description": "Compute an arithmetic mean and corrected sample standard deviation incrementally.", + "description": "Compute an arithmetic mean and corrected sample standard deviation incrementally, ignoring NaN values.", "license": "Apache-2.0", "author": { "name": "The Stdlib Authors", diff --git a/lib/node_modules/@stdlib/stats/incr/nanmeanstdev/test/test.js b/lib/node_modules/@stdlib/stats/incr/nanmeanstdev/test/test.js index 22f4b72d3c5d..d5c89bb0ab58 100644 --- a/lib/node_modules/@stdlib/stats/incr/nanmeanstdev/test/test.js +++ b/lib/node_modules/@stdlib/stats/incr/nanmeanstdev/test/test.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 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. From 4a1ebfed26b64e5ccbbd7723ed92220fd9350888 Mon Sep 17 00:00:00 2001 From: Philipp Burckhardt Date: Sun, 19 Jul 2026 00:53:33 -0500 Subject: [PATCH 3/5] style: align with base package conventions --- .../@stdlib/stats/incr/nanmeanstdev/README.md | 4 ++++ .../stats/incr/nanmeanstdev/test/test.js | 18 +++++++++--------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/lib/node_modules/@stdlib/stats/incr/nanmeanstdev/README.md b/lib/node_modules/@stdlib/stats/incr/nanmeanstdev/README.md index 444c270f5d00..6e2bfc57522f 100644 --- a/lib/node_modules/@stdlib/stats/incr/nanmeanstdev/README.md +++ b/lib/node_modules/@stdlib/stats/incr/nanmeanstdev/README.md @@ -54,6 +54,10 @@ s = \sqrt{\frac{1}{n-1} \sum_{i=0}^{n-1} ( x_i - \bar{x} )^2} + + + +
## Usage diff --git a/lib/node_modules/@stdlib/stats/incr/nanmeanstdev/test/test.js b/lib/node_modules/@stdlib/stats/incr/nanmeanstdev/test/test.js index d5c89bb0ab58..790bf9987435 100644 --- a/lib/node_modules/@stdlib/stats/incr/nanmeanstdev/test/test.js +++ b/lib/node_modules/@stdlib/stats/incr/nanmeanstdev/test/test.js @@ -63,12 +63,12 @@ tape( 'the function throws an error if not provided an array-like object for an }); tape( 'the function returns an accumulator function', function test( t ) { - t.equal( typeof incrnanmeanstdev(), 'function', 'returns a function' ); + t.strictEqual( typeof incrnanmeanstdev(), 'function', 'returns expected value' ); t.end(); }); tape( 'the function returns an accumulator function (output)', function test( t ) { - t.equal( typeof incrnanmeanstdev( [ 0.0, 0.0 ] ), 'function', 'returns a function' ); + t.strictEqual( typeof incrnanmeanstdev( [ 0.0, 0.0 ] ), 'function', 'returns expected value' ); t.end(); }); @@ -132,7 +132,7 @@ tape( 'the accumulator function incrementally computes an arithmetic mean and co for ( i = 0; i < N; i++ ) { actual = acc( data[ i ] ); - t.equal( actual, out, 'returns output array' ); + t.strictEqual( actual, out, 'returns output array' ); t.deepEqual( actual, expected[ i ], 'returns expected value' ); } t.end(); @@ -154,9 +154,9 @@ tape( 'if not provided an input value, the accumulator function returns the curr tape( 'if data has yet to be provided, the accumulator function returns `null`', function test( t ) { var acc = incrnanmeanstdev(); - t.equal( acc(), null, 'returns null' ); - t.equal( acc(), null, 'returns null' ); - t.equal( acc(), null, 'returns null' ); + t.strictEqual( acc(), null, 'returns null' ); + t.strictEqual( acc(), null, 'returns null' ); + t.strictEqual( acc(), null, 'returns null' ); t.end(); }); @@ -167,13 +167,13 @@ tape( 'the sample standard deviation is `0` until at least 2 datums have been pr acc = incrnanmeanstdev(); ms = acc(); - t.equal( ms, null, 'returns null' ); + t.strictEqual( ms, null, 'returns null' ); ms = acc( 3.0 ); - t.equal( ms[ 1 ], 0.0, 'returns expected value' ); + t.strictEqual( ms[ 1 ], 0.0, 'returns expected value' ); ms = acc(); - t.equal( ms[ 1 ], 0.0, 'returns expected value' ); + t.strictEqual( ms[ 1 ], 0.0, 'returns expected value' ); ms = acc( 5.0 ); t.notEqual( ms[ 1 ], 0.0, 'does not return 0' ); From b9b8c94952416173fe233425f305f922a3fbc731 Mon Sep 17 00:00:00 2001 From: Philipp Burckhardt Date: Sun, 19 Jul 2026 01:14:10 -0500 Subject: [PATCH 4/5] docs: fix REPL doctest failures --- .../@stdlib/stats/incr/nanmeanstdev/docs/repl.txt | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/lib/node_modules/@stdlib/stats/incr/nanmeanstdev/docs/repl.txt b/lib/node_modules/@stdlib/stats/incr/nanmeanstdev/docs/repl.txt index 97ff21b6f331..8f2c70bf5534 100644 --- a/lib/node_modules/@stdlib/stats/incr/nanmeanstdev/docs/repl.txt +++ b/lib/node_modules/@stdlib/stats/incr/nanmeanstdev/docs/repl.txt @@ -27,14 +27,10 @@ null > ms = accumulator( NaN ) null - > ms = accumulator( 2.0 ) - [ 2.0, 0.0 ] - > ms = accumulator( -5.0 ) - [ -1.5, ~4.95 ] - > ms = accumulator( 3.0 ) - [ 0.0, ~4.36 ] - > ms = accumulator( 5.0 ) - [ 1.25, ~4.35 ] + > ms = accumulator( 2.0 ); + > ms = accumulator( -5.0 ); + > ms = accumulator( 3.0 ); + > ms = accumulator( 5.0 ); > ms = accumulator() [ 1.25, ~4.35 ] From 47751570cf303963d8740b51a6b8d863cedfc54a Mon Sep 17 00:00:00 2001 From: Philipp Burckhardt Date: Sun, 19 Jul 2026 01:41:18 -0500 Subject: [PATCH 5/5] docs: simplify REPL examples --- .../@stdlib/stats/incr/nanmeanstdev/docs/repl.txt | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/lib/node_modules/@stdlib/stats/incr/nanmeanstdev/docs/repl.txt b/lib/node_modules/@stdlib/stats/incr/nanmeanstdev/docs/repl.txt index 8f2c70bf5534..30e1e690ca6a 100644 --- a/lib/node_modules/@stdlib/stats/incr/nanmeanstdev/docs/repl.txt +++ b/lib/node_modules/@stdlib/stats/incr/nanmeanstdev/docs/repl.txt @@ -25,14 +25,11 @@ > var accumulator = {{alias}}(); > var ms = accumulator() null - > ms = accumulator( NaN ) - null - > ms = accumulator( 2.0 ); - > ms = accumulator( -5.0 ); - > ms = accumulator( 3.0 ); - > ms = accumulator( 5.0 ); + > accumulator( 2.0 ); + > accumulator( NaN ); + > accumulator( -5.0 ); > ms = accumulator() - [ 1.25, ~4.35 ] + [ -1.5, ~4.95 ] See Also --------