From 1cf40c7dfa2b8e1eb514fef28d715dcf35976d65 Mon Sep 17 00:00:00 2001 From: lohithganni Date: Thu, 10 Apr 2025 09:18:02 +0000 Subject: [PATCH 1/6] feat: add stats/incr/nanmmpe --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: passed - task: lint_package_json status: passed - task: lint_repl_help status: passed - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: passed - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: passed - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: passed - task: lint_license_headers status: passed --- --- .../@stdlib/stats/incr/nanmmpe/README.md | 181 ++++++++++++ .../stats/incr/nanmmpe/benchmark/benchmark.js | 69 +++++ .../img/equation_mean_percentage_error.svg | 65 +++++ .../@stdlib/stats/incr/nanmmpe/docs/repl.txt | 45 +++ .../stats/incr/nanmmpe/docs/types/index.d.ts | 77 +++++ .../stats/incr/nanmmpe/docs/types/test.ts | 74 +++++ .../stats/incr/nanmmpe/examples/index.js | 41 +++ .../@stdlib/stats/incr/nanmmpe/lib/index.js | 63 +++++ .../@stdlib/stats/incr/nanmmpe/lib/main.js | 86 ++++++ .../@stdlib/stats/incr/nanmmpe/package.json | 83 ++++++ .../@stdlib/stats/incr/nanmmpe/test/test.js | 262 ++++++++++++++++++ 11 files changed, 1046 insertions(+) create mode 100644 lib/node_modules/@stdlib/stats/incr/nanmmpe/README.md create mode 100644 lib/node_modules/@stdlib/stats/incr/nanmmpe/benchmark/benchmark.js create mode 100644 lib/node_modules/@stdlib/stats/incr/nanmmpe/docs/img/equation_mean_percentage_error.svg create mode 100644 lib/node_modules/@stdlib/stats/incr/nanmmpe/docs/repl.txt create mode 100644 lib/node_modules/@stdlib/stats/incr/nanmmpe/docs/types/index.d.ts create mode 100644 lib/node_modules/@stdlib/stats/incr/nanmmpe/docs/types/test.ts create mode 100644 lib/node_modules/@stdlib/stats/incr/nanmmpe/examples/index.js create mode 100644 lib/node_modules/@stdlib/stats/incr/nanmmpe/lib/index.js create mode 100644 lib/node_modules/@stdlib/stats/incr/nanmmpe/lib/main.js create mode 100644 lib/node_modules/@stdlib/stats/incr/nanmmpe/package.json create mode 100644 lib/node_modules/@stdlib/stats/incr/nanmmpe/test/test.js diff --git a/lib/node_modules/@stdlib/stats/incr/nanmmpe/README.md b/lib/node_modules/@stdlib/stats/incr/nanmmpe/README.md new file mode 100644 index 000000000000..102177632426 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/incr/nanmmpe/README.md @@ -0,0 +1,181 @@ + + +# incrnanmmpe + +> Compute a moving [mean percentage error][mean-percentage-error] (MPE) incrementally ignoring NaN values. + +
+ +For a window of size `W`, the [mean percentage error][mean-percentage-error] is defined as + + + +```math +\mathop{\mathrm{MPE}} = \frac{100}{W} \sum_{i=0}^{W-1} \frac{a_i - f_i}{a_i} +``` + + + + + +where `f_i` is the forecast value and `a_i` is the actual value. + +
+ + + +
+ +## Usage + +```javascript +var incrnanmmpe = require( '@stdlib/stats/incr/mmpe' ); +``` + +#### incrnanmmpe( window ) + +Returns an accumulator `function` which incrementally computes a moving [mean percentage error][mean-percentage-error]. The `window` parameter defines the number of values over which to compute the moving [mean percentage error][mean-percentage-error]. + +```javascript +var accumulator = incrnanmmpe( 3 ); +``` + +#### accumulator( \[f, a] ) + +If provided input values `f` and `a`, the accumulator function returns an updated [mean percentage error][mean-percentage-error]. If not provided input values `f` and `a`, the accumulator function returns the current [mean percentage error][mean-percentage-error]. + +```javascript +var accumulator = incrnanmmpe( 3 ); + +var m = accumulator(); +// returns null + +// Fill the window... +m = accumulator( 2.0, 3.0 ); // [(2.0,3.0)] +// returns ~33.33 + +m = accumulator( 1.0, 4.0 ); // [(2.0,3.0), (1.0,4.0)] +// returns ~54.17 + +// Ignored +m = accumulator( NaN, 1.0 ); // [(2.0,3.0), (1.0,4.0)] +// returns ~54.17 + +m = accumulator( 3.0, 9.0 ); // [(2.0,3.0), (1.0,4.0), (3.0,9.0)] +// returns ~58.33 + +// Window begins sliding... +m = accumulator( 7.0, 3.0 ); // [(1.0,4.0), (3.0,9.0), (7.0,3.0)] +// returns ~2.78 + +m = accumulator( 5.0, 3.0 ); // [(3.0,9.0), (7.0,3.0), (5.0,3.0)] +// returns ~-44.44 + +m = accumulator(); +// returns ~-44.44 +``` + +
+ + + +
+ +## Notes + +- Input values are type checked. If provided `NaN` or a value which, when used in computations, the accumulator function ignores it. If non-numeric inputs are possible, you are advised to use nanmmpe instead of mmpe. +- As `W` (f,a) pairs 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. +- Be careful when interpreting the [mean percentage error][mean-percentage-error] as errors can cancel. This stated, that errors can cancel makes the [mean percentage error][mean-percentage-error] suitable for measuring the bias in forecasts. +- **Warning**: the [mean percentage error][mean-percentage-error] is **not** suitable for intermittent demand patterns (i.e., when `a_i` is `0`). Interpretation is most straightforward when actual and forecast values are positive valued (e.g., number of widgets sold). + +
+ + + +
+ +## Examples + + + +```javascript +var randu = require( '@stdlib/random/base/randu' ); +var incrnanmmpe = require( '@stdlib/stats/incr/mmpe' ); + +var accumulator; +var v1; +var v2; +var i; + +// Initialize an accumulator: +accumulator = incrnanmmpe( 5 ); + +// For each simulated datum, update the moving mean percentage error... +for ( i = 0; i < 100; i++ ) { + v1 = ( randu()*100.0 ) + 50.0; + v2 = ( randu()*100.0 ) + 50.0; + accumulator( v1, v2 ); +} +console.log( accumulator() ); +``` + +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/stats/incr/nanmmpe/benchmark/benchmark.js b/lib/node_modules/@stdlib/stats/incr/nanmmpe/benchmark/benchmark.js new file mode 100644 index 000000000000..4b21f0f44bd1 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/incr/nanmmpe/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 incrnanmmpe = require( './../lib' ); + + +// MAIN // + +bench( pkg, function benchmark( b ) { + var f; + var i; + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + f = incrnanmmpe( (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 = incrnanmmpe( 5 ); + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + v = acc( randu()+0.5, randu()+0.5 ); + 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/nanmmpe/docs/img/equation_mean_percentage_error.svg b/lib/node_modules/@stdlib/stats/incr/nanmmpe/docs/img/equation_mean_percentage_error.svg new file mode 100644 index 000000000000..db2d43ae137d --- /dev/null +++ b/lib/node_modules/@stdlib/stats/incr/nanmmpe/docs/img/equation_mean_percentage_error.svg @@ -0,0 +1,65 @@ + +upper M upper P upper E equals StartFraction 100 Over upper W EndFraction sigma-summation Underscript i equals 0 Overscript upper W minus 1 Endscripts StartFraction a Subscript i Baseline minus f Subscript i Baseline Over a Subscript i Baseline EndFraction + + + \ No newline at end of file diff --git a/lib/node_modules/@stdlib/stats/incr/nanmmpe/docs/repl.txt b/lib/node_modules/@stdlib/stats/incr/nanmmpe/docs/repl.txt new file mode 100644 index 000000000000..b49eb4db27f9 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/incr/nanmmpe/docs/repl.txt @@ -0,0 +1,45 @@ + +{{alias}}( W ) + Returns an accumulator function which incrementally computes a moving + mean percentage error (MPE). + + The `W` parameter defines the number of values over which to compute the + moving mean percentage error. + + If provided input values, the accumulator function returns an updated moving + mean percentage error. If not provided input values, the accumulator + function returns the current moving mean percentage error. + + As `W` (f,a) pairs 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 m = accumulator() + null + > m = accumulator( 2.0, 3.0 ) + ~33.33 + > m = accumulator( 5.0, 2.0 ) + ~-58.33 + > m = accumulator( 3.0, 2.0 ) + ~-55.56 + > m = accumulator( 2.0, 5.0 ) + ~-46.67 + > m = accumulator() + ~-46.67 + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/stats/incr/nanmmpe/docs/types/index.d.ts b/lib/node_modules/@stdlib/stats/incr/nanmmpe/docs/types/index.d.ts new file mode 100644 index 000000000000..4d31c958e2df --- /dev/null +++ b/lib/node_modules/@stdlib/stats/incr/nanmmpe/docs/types/index.d.ts @@ -0,0 +1,77 @@ +/* +* @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 input values, the accumulator function returns an updated mean percentage error. If not provided input values, the accumulator function returns the current mean percentage error. +* +* ## Notes +* +* - If provided `NaN` or a value which, when used in computations, results in `NaN`, the accumulator ignores the NaN value and returns the current mean percentage. +* +* @param f - input value +* @param a - input value +* @returns mean percentage error or null +*/ +type accumulator = ( f?: number, a?: number ) => number | null; + +/** +* Returns an accumulator function which incrementally computes a moving mean percentage error. +* +* ## Notes +* +* - The `W` parameter defines the number of values over which to compute the moving mean percentage error. +* - As `W` (f,a) pairs 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 = incrnanmmpe( 3 ); +* +* var m = accumulator(); +* // returns null +* +* m = accumulator( 2.0, 3.0 ); +* // returns ~33.33 +* +* m = accumulator( 5.0, 2.0 ); +* // returns ~-58.33 +* +* m = accumulator( NaN, 2.0 ); +* // returns ~-58.33 +* +* m = accumulator( 3.0, 2.0 ); +* // returns ~-55.56 +* +* m = accumulator( 2.0, 5.0 ); +* // returns ~-46.67 +* +* m = accumulator(); +* // returns ~-46.67 +*/ +declare function incrnanmmpe( W: number ): accumulator; + + +// EXPORTS // + +export = incrnanmmpe; diff --git a/lib/node_modules/@stdlib/stats/incr/nanmmpe/docs/types/test.ts b/lib/node_modules/@stdlib/stats/incr/nanmmpe/docs/types/test.ts new file mode 100644 index 000000000000..7e1f9e4ade54 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/incr/nanmmpe/docs/types/test.ts @@ -0,0 +1,74 @@ +/* +* @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 incrnanmmpe = require( './index' ); + + +// TESTS // + +// The function returns an accumulator function... +{ + incrnanmmpe( 2 ); // $ExpectType accumulator +} + +// The compiler throws an error if the function is provided an argument which is not a number... +{ + incrnanmmpe( '5' ); // $ExpectError + incrnanmmpe( true ); // $ExpectError + incrnanmmpe( false ); // $ExpectError + incrnanmmpe( null ); // $ExpectError + incrnanmmpe( undefined ); // $ExpectError + incrnanmmpe( [] ); // $ExpectError + incrnanmmpe( {} ); // $ExpectError + incrnanmmpe( ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the function is provided an invalid number of arguments... +{ + incrnanmmpe(); // $ExpectError + incrnanmmpe( 2, 3 ); // $ExpectError +} + +// The function returns an accumulator function which returns an accumulated result... +{ + const acc = incrnanmmpe( 3 ); + + acc(); // $ExpectType number | null + acc( 3.14, 2.0 ); // $ExpectType number | null +} + +// The compiler throws an error if the returned accumulator function is provided invalid arguments... +{ + const acc = incrnanmmpe( 3 ); + + acc( '5', 2.0 ); // $ExpectError + acc( true, 2.0 ); // $ExpectError + acc( false, 2.0 ); // $ExpectError + acc( null, 2.0 ); // $ExpectError + acc( [], 2.0 ); // $ExpectError + acc( {}, 2.0 ); // $ExpectError + acc( ( x: number ): number => x, 2.0 ); // $ExpectError + + acc( 3.14, '5' ); // $ExpectError + acc( 3.14, true ); // $ExpectError + acc( 3.14, false ); // $ExpectError + acc( 3.14, null ); // $ExpectError + acc( 3.14, [] ); // $ExpectError + acc( 3.14, {} ); // $ExpectError + acc( 3.14, ( x: number ): number => x ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/stats/incr/nanmmpe/examples/index.js b/lib/node_modules/@stdlib/stats/incr/nanmmpe/examples/index.js new file mode 100644 index 000000000000..78fbabf3147d --- /dev/null +++ b/lib/node_modules/@stdlib/stats/incr/nanmmpe/examples/index.js @@ -0,0 +1,41 @@ +/** +* @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 bernoulli = require( '@stdlib/random/base/bernoulli' ); +var incrnanmmpe = require( './../lib' ); + +var accumulator; +var err; +var v1; +var v2; +var i; + +// Initialize an accumulator: +accumulator = incrnanmmpe( 5 ); + +// For each simulated datum, update the moving mean percentage error... +console.log( '\nValue\tValue\tPercentage\n' ); +for ( i = 0; i < 100; i++ ) { + v1 = ( bernoulli( 0.8 ) < 1 ) ? NaN : ( randu()*100.0 ) + 50.0; + v2 = ( bernoulli( 0.8 ) < 1 ) ? NaN : ( randu()*100.0 ) + 50.0; + err = accumulator( v1, v2 ); + console.log( '%d\t%d\t%d', v1.toFixed( 3 ), v2.toFixed( 3 ), err ); +} diff --git a/lib/node_modules/@stdlib/stats/incr/nanmmpe/lib/index.js b/lib/node_modules/@stdlib/stats/incr/nanmmpe/lib/index.js new file mode 100644 index 000000000000..1a0d553ec233 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/incr/nanmmpe/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 mean percentage error incrementally, ignoring `NaN` values. +* +* @module @stdlib/stats/incr/nanmmpe +* +* @example +* var incrnanmmpe = require( '@stdlib/stats/incr/nanmmpe' ); +* +* var accumulator = incrnanmmpe( 3 ); +* +* var m = accumulator(); +* // returns null +* +* m = accumulator( 2.0, 3.0 ); +* // returns ~33.33 +* +* m = accumulator( 5.0, 2.0 ); +* // returns ~-58.33 +* +* m = accumulator( NaN, 2.0 ); +* // returns ~-58.33 +* +* m = accumulator( 2.0, NaN ); +* // returns ~-58.33 +* +* m = accumulator( 3.0, 2.0 ); +* // returns ~-55.56 +* +* m = accumulator( 2.0, 5.0 ); +* // returns ~-46.67 +* +* m = accumulator(); +* // returns ~-46.67 +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/stats/incr/nanmmpe/lib/main.js b/lib/node_modules/@stdlib/stats/incr/nanmmpe/lib/main.js new file mode 100644 index 000000000000..203a16ef0989 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/incr/nanmmpe/lib/main.js @@ -0,0 +1,86 @@ +/** +* @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 isnan = require( '@stdlib/math/base/assert/is-nan' ); +var incrmmpe = require( '@stdlib/stats/incr/mmpe' ); + + +// MAIN // + +/** +* Returns an accumulator function which incrementally computes a moving mean percentage error, ignoring `NaN` values. +* +* @param {PositiveInteger} W - window size +* @throws {TypeError} must provide a positive integer +* @returns {Function} accumulator function +* +* @example +* var accumulator = incrnanmmpe( 3 ); +* +* var m = accumulator(); +* // returns null +* +* m = accumulator( 2.0, 3.0 ); +* // returns ~33.33 +* +* m = accumulator( 5.0, 2.0 ); +* // returns ~-58.33 +* +* m = accumulator( NaN, 2.0 ); +* // returns ~-58.33 +* +* m = accumulator( 2.0, NaN ); +* // returns ~-58.33 +* +* m = accumulator( 3.0, 2.0 ); +* // returns ~-55.56 +* +* m = accumulator( 2.0, 5.0 ); +* // returns ~-46.67 +* +* m = accumulator(); +* // returns ~-46.67 +*/ +function incrnanmmpe( W ) { + var m = incrmmpe( W ); + return accumulator; + + /** + * If provided input values, the accumulator function returns an updated mean percentage error. If not provided input values, the accumulator function returns the current mean percentage error. + * + * @private + * @param {number} [f] - input value + * @param {number} [a] - input value + * @returns {(number|null)} mean percentage error or null + */ + function accumulator( f, a ) { + if ( arguments.length === 0 || isnan( f ) || isnan( a ) ) { + return m(); + } + return m( f, a ); + } +} + + +// EXPORTS // + +module.exports = incrnanmmpe; diff --git a/lib/node_modules/@stdlib/stats/incr/nanmmpe/package.json b/lib/node_modules/@stdlib/stats/incr/nanmmpe/package.json new file mode 100644 index 000000000000..c27d7eb81506 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/incr/nanmmpe/package.json @@ -0,0 +1,83 @@ +{ + "name": "@stdlib/stats/incr/nanmmpe", + "version": "0.0.0", + "description": "Compute a moving mean percentage error (MPE) 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", + "mean", + "error", + "err", + "mpe", + "percentage", + "percent", + "incremental", + "accumulator", + "moving mean", + "moving average", + "sliding window", + "sliding", + "window", + "moving", + "time series", + "timeseries", + "forecasting", + "forecast", + "difference", + "diff", + "delta", + "bias" + ] +} diff --git a/lib/node_modules/@stdlib/stats/incr/nanmmpe/test/test.js b/lib/node_modules/@stdlib/stats/incr/nanmmpe/test/test.js new file mode 100644 index 000000000000..1a59f2834259 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/incr/nanmmpe/test/test.js @@ -0,0 +1,262 @@ +/** +* @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 abs = require( '@stdlib/math/base/special/abs' ); +var EPS = require( '@stdlib/constants/float64/eps' ); +var incrnanmmpe = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof incrnanmmpe, '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() { + incrnanmmpe( value ); + }; + } +}); + +tape( 'the function returns an accumulator function', function test( t ) { + t.equal( typeof incrnanmmpe( 3 ), 'function', 'returns a function' ); + t.end(); +}); + +tape( 'the accumulator function computes a moving mean percentage error incrementally', function test( t ) { + var expected; + var actual; + var delta; + var data; + var acc; + var tol; + var N; + var i; + + data = [ + [ 2.0, 3.0 ], + [ 3.0, 1.0 ], + [ 2.0, 5.0 ], + [ 4.0, 4.0 ], + [ 3.0, 10.0 ], + [ 4.0, 5.0 ] + ]; + N = data.length; + + acc = incrnanmmpe( 3 ); + + // Note: manually computed + expected = [ + (100.0/1.0)*( ((3.0-2.0)/3.0) ), + (100.0/2.0)*( ((3.0-2.0)/3.0)+((1.0-3.0)/1.0) ), + (100.0/3.0)*( ((3.0-2.0)/3.0)+((1.0-3.0)/1.0)+((5.0-2.0)/5.0) ), + (100.0/3.0)*( ((1.0-3.0)/1.0)+((5.0-2.0)/5.0)+((4.0-4.0)/4.0) ), + (100.0/3.0)*( ((5.0-2.0)/5.0)+((4.0-4.0)/4.0)+((10.0-3.0)/10.0) ), + (100.0/3.0)*( ((4.0-4.0)/4.0)+((10.0-3.0)/10.0)+((5.0-4.0)/5.0) ) + ]; + for ( i = 0; i < N; i++ ) { + actual = acc( data[i][0], data[i][1] ); + if ( actual === expected[i] ) { + t.equal( actual, expected[i], 'returns expected value' ); + } else { + delta = abs( expected[i] - actual ); + tol = 1.0 * EPS * abs( expected[i] ); + t.equal( delta <= tol, true, 'within tolerance. Actual: '+actual+'. Expected: '+expected[i]+'. Delta: '+delta+'. Tol: '+tol+'.' ); + } + } + t.end(); +}); + +tape( 'if not provided an input value, the accumulator function returns the current mean percentage error', function test( t ) { + var data; + var acc; + var i; + + data = [ + [ 2.0, 3.0 ], + [ 3.0, 5.0 ], + [ 1.0, 10.0 ] + ]; + acc = incrnanmmpe( 2 ); + for ( i = 0; i < data.length; i++ ) { + acc( data[i][0], data[i][1] ); + } + t.equal( acc(), 65.0, 'returns expected value' ); + t.end(); +}); + +tape( 'if data has yet to be provided, the accumulator function returns `null`', function test( t ) { + var acc = incrnanmmpe( 3 ); + t.equal( acc(), null, 'returns null' ); + t.end(); +}); + +tape( 'if provided `NaN`, the accumulated value is current non-NaN mean percentage error', function test( t ) { + var expected; + var data; + var acc; + var v; + var i; + + expected = [ + null, + -214.0, + -214.0, + -214.0, + -214.0, + -214.0, + -214.0, + -214.0, + -214.0, + -214.0, + -214.0, + -214.0, + -214.0, + -214.0, + -214.0, + -214.0, + -214.0, + -214.0, + -214.0 + ]; + + data = [ + [ NaN, 1.0 ], // NaN + [ 3.14, 1.0 ], // NaN, 3.14 + [ 3.14, 1.0 ], // NaN, 3.14, 3.14 + [ NaN, 1.0 ], // 3.14, 3.14, NaN + [ 3.14, 1.0 ], // 3.14, NaN, 3.14 + [ 3.14, 1.0 ], // NaN, 3.14, 3.14 + [ 3.14, 1.0 ], // 3.14, 3.14, 3.14 + [ NaN, 1.0 ], // 3.14, 3.14, NaN + [ 3.14, 1.0 ], // 3.14, NaN, 3.14 + [ 3.14, 1.0 ], // NaN, 3.14, 3.14 + [ 3.14, 1.0 ], // 3.14, 3.14, 3.14 + [ NaN, 1.0 ], // 3.14, 3.14, NaN + [ 3.14, 1.0 ], // 3.14, NaN, 3.14 + [ 3.14, 1.0 ], // NaN, 3.14, 3.14 + [ NaN, 1.0 ], // 3.14, 3.14, NaN + [ NaN, 1.0 ], // 3.14, NaN, NaN + [ NaN, 1.0 ], // NaN, NaN, NaN + [ NaN, 1.0 ], // NaN, NaN, NaN + [ 3.14, 1.0 ] // NaN, NaN, 3.14 + ]; + + acc = incrnanmmpe( 3 ); + + for ( i = 0; i < data.length; i++ ) { + v = acc( data[i][0], data[i][1] ); + if ( isnan( expected[ i ] ) ) { + t.equal( isnan( v ), true, 'returns expected value for window '+i ); + t.equal( isnan( acc() ), true, 'returns expected value for window '+i ); + } else { + t.equal( v, expected[ i ], 'returns expected value for window '+i ); + t.equal( acc(), expected[ i ], 'returns expected value for window '+i ); + } + } + + expected = [ + null, + 214.0 / 3.14, + 214.0 / 3.14, + 214.0 / 3.14, + 214.0 / 3.14, + 214.0 / 3.14, + 214.0 / 3.14, + 214.0 / 3.14, + 214.0 / 3.14, + 214.0 / 3.14, + 214.0 / 3.14, + 214.0 / 3.14, + 214.0 / 3.14, + 214.0 / 3.14, + 214.0 / 3.14, + 214.0 / 3.14, + 214.0 / 3.14, + 214.0 / 3.14, + 214.0 / 3.14 + ]; + + data = [ + [ 1.0, NaN ], // NaN + [ 1.0, 3.14 ], // NaN, 3.14 + [ 1.0, 3.14 ], // NaN, 3.14, 3.14 + [ 1.0, NaN ], // 3.14, 3.14, NaN + [ 1.0, 3.14 ], // 3.14, NaN, 3.14 + [ 1.0, 3.14 ], // NaN, 3.14, 3.14 + [ 1.0, 3.14 ], // 3.14, 3.14, 3.14 + [ 1.0, NaN ], // 3.14, 3.14, NaN + [ 1.0, 3.14 ], // 3.14, NaN, 3.14 + [ 1.0, 3.14 ], // NaN, 3.14, 3.14 + [ 1.0, 3.14 ], // 3.14, 3.14, 3.14 + [ 1.0, NaN ], // 3.14, 3.14, NaN + [ 1.0, 3.14 ], // 3.14, NaN, 3.14 + [ 1.0, 3.14 ], // NaN, 3.14, 3.14 + [ 1.0, NaN ], // 3.14, 3.14, NaN + [ 1.0, NaN ], // 3.14, NaN, NaN + [ 1.0, NaN ], // NaN, NaN, NaN + [ 1.0, NaN ], // NaN, NaN, NaN + [ 1.0, 3.14 ] // NaN, NaN, 3.14 + ]; + + acc = incrnanmmpe( 3 ); + + for ( i = 0; i < data.length; i++ ) { + v = acc( data[i][0], data[i][1] ); + if ( isnan( expected[ i ] ) ) { + t.equal( isnan( v ), true, 'returns expected value for window '+i ); + t.equal( isnan( acc() ), true, 'returns expected value for window '+i ); + } else { + t.equal( v, expected[ i ], 'returns expected value for window '+i ); + t.equal( acc(), expected[ i ], 'returns expected value for window '+i ); + } + } + t.end(); +}); From 0c0876974c03271761607b40392fdcc5d1ab086b Mon Sep 17 00:00:00 2001 From: Philipp Burckhardt Date: Mon, 20 Jul 2026 15:30:26 -0500 Subject: [PATCH 2/6] fix: address review feedback for stats/incr/nanmmpe --- .../@stdlib/stats/incr/nanmmpe/README.md | 40 ++++++------------- .../@stdlib/stats/incr/nanmmpe/docs/repl.txt | 6 ++- .../stats/incr/nanmmpe/docs/types/index.d.ts | 9 +++-- .../stats/incr/nanmmpe/examples/index.js | 2 +- 4 files changed, 24 insertions(+), 33 deletions(-) diff --git a/lib/node_modules/@stdlib/stats/incr/nanmmpe/README.md b/lib/node_modules/@stdlib/stats/incr/nanmmpe/README.md index 102177632426..ca991d438bba 100644 --- a/lib/node_modules/@stdlib/stats/incr/nanmmpe/README.md +++ b/lib/node_modules/@stdlib/stats/incr/nanmmpe/README.md @@ -20,7 +20,7 @@ limitations under the License. # incrnanmmpe -> Compute a moving [mean percentage error][mean-percentage-error] (MPE) incrementally ignoring NaN values. +> Compute a moving [mean percentage error][mean-percentage-error] (MPE) incrementally, ignoring `NaN` values.
@@ -50,12 +50,12 @@ where `f_i` is the forecast value and `a_i` is the actual value. ## Usage ```javascript -var incrnanmmpe = require( '@stdlib/stats/incr/mmpe' ); +var incrnanmmpe = require( '@stdlib/stats/incr/nanmmpe' ); ``` #### incrnanmmpe( window ) -Returns an accumulator `function` which incrementally computes a moving [mean percentage error][mean-percentage-error]. The `window` parameter defines the number of values over which to compute the moving [mean percentage error][mean-percentage-error]. +Returns an accumulator `function` which incrementally computes a moving [mean percentage error][mean-percentage-error]. The `window` parameter defines the number of values over which to compute the moving [mean percentage error][mean-percentage-error], ignoring `NaN` values. ```javascript var accumulator = incrnanmmpe( 3 ); @@ -78,7 +78,6 @@ m = accumulator( 2.0, 3.0 ); // [(2.0,3.0)] m = accumulator( 1.0, 4.0 ); // [(2.0,3.0), (1.0,4.0)] // returns ~54.17 -// Ignored m = accumulator( NaN, 1.0 ); // [(2.0,3.0), (1.0,4.0)] // returns ~54.17 @@ -89,6 +88,9 @@ m = accumulator( 3.0, 9.0 ); // [(2.0,3.0), (1.0,4.0), (3.0,9.0)] m = accumulator( 7.0, 3.0 ); // [(1.0,4.0), (3.0,9.0), (7.0,3.0)] // returns ~2.78 +m = accumulator( 7.0, NaN ); // [(1.0,4.0), (3.0,9.0), (7.0,3.0)] +// returns ~2.78 + m = accumulator( 5.0, 3.0 ); // [(3.0,9.0), (7.0,3.0), (5.0,3.0)] // returns ~-44.44 @@ -104,7 +106,8 @@ m = accumulator(); ## Notes -- Input values are type checked. If provided `NaN` or a value which, when used in computations, the accumulator function ignores it. If non-numeric inputs are possible, you are advised to use nanmmpe instead of mmpe. +- 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` (f,a) pairs 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. - Be careful when interpreting the [mean percentage error][mean-percentage-error] as errors can cancel. This stated, that errors can cancel makes the [mean percentage error][mean-percentage-error] suitable for measuring the bias in forecasts. - **Warning**: the [mean percentage error][mean-percentage-error] is **not** suitable for intermittent demand patterns (i.e., when `a_i` is `0`). Interpretation is most straightforward when actual and forecast values are positive valued (e.g., number of widgets sold). @@ -120,8 +123,9 @@ m = accumulator(); ```javascript -var randu = require( '@stdlib/random/base/randu' ); -var incrnanmmpe = require( '@stdlib/stats/incr/mmpe' ); +var uniform = require( '@stdlib/random/base/uniform' ); +var bernoulli = require( '@stdlib/random/base/bernoulli' ); +var incrnanmmpe = require( '@stdlib/stats/incr/nanmmpe' ); var accumulator; var v1; @@ -133,8 +137,8 @@ accumulator = incrnanmmpe( 5 ); // For each simulated datum, update the moving mean percentage error... for ( i = 0; i < 100; i++ ) { - v1 = ( randu()*100.0 ) + 50.0; - v2 = ( randu()*100.0 ) + 50.0; + v1 = ( bernoulli( 0.8 ) < 1 ) ? NaN : uniform( 0.0, 100.0 ); + v2 = ( bernoulli( 0.8 ) < 1 ) ? NaN : uniform( 0.0, 100.0 ); accumulator( v1, v2 ); } console.log( accumulator() ); @@ -148,14 +152,6 @@ console.log( accumulator() ); @@ -166,16 +162,6 @@ console.log( accumulator() ); [mean-percentage-error]: https://en.wikipedia.org/wiki/Mean_percentage_error - - -[@stdlib/stats/incr/mmape]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/stats/incr/mmape - -[@stdlib/stats/incr/mme]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/stats/incr/mme - -[@stdlib/stats/incr/mpe]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/stats/incr/mpe - - -
diff --git a/lib/node_modules/@stdlib/stats/incr/nanmmpe/docs/repl.txt b/lib/node_modules/@stdlib/stats/incr/nanmmpe/docs/repl.txt index b49eb4db27f9..19d44176f87a 100644 --- a/lib/node_modules/@stdlib/stats/incr/nanmmpe/docs/repl.txt +++ b/lib/node_modules/@stdlib/stats/incr/nanmmpe/docs/repl.txt @@ -1,7 +1,7 @@ {{alias}}( W ) Returns an accumulator function which incrementally computes a moving - mean percentage error (MPE). + mean percentage error (MPE), ignoring `NaN` values. The `W` parameter defines the number of values over which to compute the moving mean percentage error. @@ -33,10 +33,14 @@ ~33.33 > m = accumulator( 5.0, 2.0 ) ~-58.33 + > m = accumulator( NaN, 2.0 ) + ~-58.33 > m = accumulator( 3.0, 2.0 ) ~-55.56 > m = accumulator( 2.0, 5.0 ) ~-46.67 + > m = accumulator( 2.0, NaN ) + ~-46.67 > m = accumulator() ~-46.67 diff --git a/lib/node_modules/@stdlib/stats/incr/nanmmpe/docs/types/index.d.ts b/lib/node_modules/@stdlib/stats/incr/nanmmpe/docs/types/index.d.ts index 4d31c958e2df..f65b9440b4d7 100644 --- a/lib/node_modules/@stdlib/stats/incr/nanmmpe/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/stats/incr/nanmmpe/docs/types/index.d.ts @@ -18,14 +18,12 @@ // TypeScript Version: 4.1 -/// - /** * If provided input values, the accumulator function returns an updated mean percentage error. If not provided input values, the accumulator function returns the current mean percentage error. * * ## Notes * -* - If provided `NaN` or a value which, when used in computations, results in `NaN`, the accumulator ignores the NaN value and returns the current mean percentage. +* - If provided `NaN` or a value which, when used in computations, results in `NaN`, the accumulator ignores the `NaN` value and returns the current mean percentage error. * * @param f - input value * @param a - input value @@ -34,7 +32,7 @@ type accumulator = ( f?: number, a?: number ) => number | null; /** -* Returns an accumulator function which incrementally computes a moving mean percentage error. +* Returns an accumulator function which incrementally computes a moving mean percentage error, ignoring `NaN` values. * * ## Notes * @@ -66,6 +64,9 @@ type accumulator = ( f?: number, a?: number ) => number | null; * m = accumulator( 2.0, 5.0 ); * // returns ~-46.67 * +* m = accumulator( 2.0, NaN ); +* // returns ~-46.67 +* * m = accumulator(); * // returns ~-46.67 */ diff --git a/lib/node_modules/@stdlib/stats/incr/nanmmpe/examples/index.js b/lib/node_modules/@stdlib/stats/incr/nanmmpe/examples/index.js index 78fbabf3147d..11c150622a7c 100644 --- a/lib/node_modules/@stdlib/stats/incr/nanmmpe/examples/index.js +++ b/lib/node_modules/@stdlib/stats/incr/nanmmpe/examples/index.js @@ -37,5 +37,5 @@ for ( i = 0; i < 100; i++ ) { v1 = ( bernoulli( 0.8 ) < 1 ) ? NaN : ( randu()*100.0 ) + 50.0; v2 = ( bernoulli( 0.8 ) < 1 ) ? NaN : ( randu()*100.0 ) + 50.0; err = accumulator( v1, v2 ); - console.log( '%d\t%d\t%d', v1.toFixed( 3 ), v2.toFixed( 3 ), err ); + console.log( '%s\t%s\t%s', v1.toFixed( 3 ), v2.toFixed( 3 ), ( err === null ) ? 'null' : err.toFixed( 4 ) ); } From 35194f7f9ef19b8de4f256450ad8ca8cb19e3b3f Mon Sep 17 00:00:00 2001 From: Philipp Burckhardt Date: Mon, 20 Jul 2026 16:03:40 -0500 Subject: [PATCH 3/6] fix: use format() for benchmark descriptions in stats/incr/nanmmpe --- .../@stdlib/stats/incr/nanmmpe/benchmark/benchmark.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/node_modules/@stdlib/stats/incr/nanmmpe/benchmark/benchmark.js b/lib/node_modules/@stdlib/stats/incr/nanmmpe/benchmark/benchmark.js index 4b21f0f44bd1..1fa84cf797b1 100644 --- a/lib/node_modules/@stdlib/stats/incr/nanmmpe/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/stats/incr/nanmmpe/benchmark/benchmark.js @@ -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 incrnanmmpe = require( './../lib' ); @@ -33,7 +34,7 @@ bench( pkg, function benchmark( b ) { var i; b.tic(); for ( i = 0; i < b.iterations; i++ ) { - f = incrnanmmpe( (i%5)+1 ); + f = incrnanmmpe( ( i % 5 ) + 1 ); if ( typeof f !== 'function' ) { b.fail( 'should return a function' ); } @@ -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; @@ -55,7 +56,7 @@ bench( pkg+'::accumulator', function benchmark( b ) { b.tic(); for ( i = 0; i < b.iterations; i++ ) { - v = acc( randu()+0.5, randu()+0.5 ); + v = acc( randu() + 0.5, randu() + 0.5 ); if ( v !== v ) { b.fail( 'should not return NaN' ); } From ee806b5606e5f2fd4470daed4a207e23a0bd593d Mon Sep 17 00:00:00 2001 From: stdlib-bot <82920195+stdlib-bot@users.noreply.github.com> Date: Mon, 20 Jul 2026 21:22:11 +0000 Subject: [PATCH 4/6] chore: update copyright years --- lib/node_modules/@stdlib/stats/incr/nanmmpe/README.md | 2 +- .../@stdlib/stats/incr/nanmmpe/benchmark/benchmark.js | 2 +- .../@stdlib/stats/incr/nanmmpe/docs/types/index.d.ts | 2 +- lib/node_modules/@stdlib/stats/incr/nanmmpe/docs/types/test.ts | 2 +- lib/node_modules/@stdlib/stats/incr/nanmmpe/examples/index.js | 2 +- lib/node_modules/@stdlib/stats/incr/nanmmpe/lib/index.js | 2 +- lib/node_modules/@stdlib/stats/incr/nanmmpe/lib/main.js | 2 +- lib/node_modules/@stdlib/stats/incr/nanmmpe/test/test.js | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/node_modules/@stdlib/stats/incr/nanmmpe/README.md b/lib/node_modules/@stdlib/stats/incr/nanmmpe/README.md index ca991d438bba..54a51d91d561 100644 --- a/lib/node_modules/@stdlib/stats/incr/nanmmpe/README.md +++ b/lib/node_modules/@stdlib/stats/incr/nanmmpe/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. diff --git a/lib/node_modules/@stdlib/stats/incr/nanmmpe/benchmark/benchmark.js b/lib/node_modules/@stdlib/stats/incr/nanmmpe/benchmark/benchmark.js index 1fa84cf797b1..f1176bddfed3 100644 --- a/lib/node_modules/@stdlib/stats/incr/nanmmpe/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/stats/incr/nanmmpe/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. diff --git a/lib/node_modules/@stdlib/stats/incr/nanmmpe/docs/types/index.d.ts b/lib/node_modules/@stdlib/stats/incr/nanmmpe/docs/types/index.d.ts index f65b9440b4d7..20cc147f1abb 100644 --- a/lib/node_modules/@stdlib/stats/incr/nanmmpe/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/stats/incr/nanmmpe/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. diff --git a/lib/node_modules/@stdlib/stats/incr/nanmmpe/docs/types/test.ts b/lib/node_modules/@stdlib/stats/incr/nanmmpe/docs/types/test.ts index 7e1f9e4ade54..8f86463fe524 100644 --- a/lib/node_modules/@stdlib/stats/incr/nanmmpe/docs/types/test.ts +++ b/lib/node_modules/@stdlib/stats/incr/nanmmpe/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/nanmmpe/examples/index.js b/lib/node_modules/@stdlib/stats/incr/nanmmpe/examples/index.js index 11c150622a7c..b554cd4c4495 100644 --- a/lib/node_modules/@stdlib/stats/incr/nanmmpe/examples/index.js +++ b/lib/node_modules/@stdlib/stats/incr/nanmmpe/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. diff --git a/lib/node_modules/@stdlib/stats/incr/nanmmpe/lib/index.js b/lib/node_modules/@stdlib/stats/incr/nanmmpe/lib/index.js index 1a0d553ec233..df0e48d829ec 100644 --- a/lib/node_modules/@stdlib/stats/incr/nanmmpe/lib/index.js +++ b/lib/node_modules/@stdlib/stats/incr/nanmmpe/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. diff --git a/lib/node_modules/@stdlib/stats/incr/nanmmpe/lib/main.js b/lib/node_modules/@stdlib/stats/incr/nanmmpe/lib/main.js index 203a16ef0989..6a8159858985 100644 --- a/lib/node_modules/@stdlib/stats/incr/nanmmpe/lib/main.js +++ b/lib/node_modules/@stdlib/stats/incr/nanmmpe/lib/main.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. diff --git a/lib/node_modules/@stdlib/stats/incr/nanmmpe/test/test.js b/lib/node_modules/@stdlib/stats/incr/nanmmpe/test/test.js index 1a59f2834259..29bf5da69012 100644 --- a/lib/node_modules/@stdlib/stats/incr/nanmmpe/test/test.js +++ b/lib/node_modules/@stdlib/stats/incr/nanmmpe/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 cd7f91613adbe5f43146fa3458c18d7ff05ccc22 Mon Sep 17 00:00:00 2001 From: Philipp Burckhardt Date: Mon, 20 Jul 2026 16:23:37 -0500 Subject: [PATCH 5/6] fix: correct equation SVG path in stats/incr/nanmmpe README --- lib/node_modules/@stdlib/stats/incr/nanmmpe/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/stats/incr/nanmmpe/README.md b/lib/node_modules/@stdlib/stats/incr/nanmmpe/README.md index 54a51d91d561..35f4a1926d7b 100644 --- a/lib/node_modules/@stdlib/stats/incr/nanmmpe/README.md +++ b/lib/node_modules/@stdlib/stats/incr/nanmmpe/README.md @@ -33,7 +33,7 @@ For a window of size `W`, the [mean percentage error][mean-percentage-error] is ``` From 2891baffc3f004bca62a38ac50bf19a15783c8b0 Mon Sep 17 00:00:00 2001 From: Philipp Burckhardt Date: Mon, 20 Jul 2026 16:57:35 -0500 Subject: [PATCH 6/6] fix: remove extraneous blank line in README Notes section --- lib/node_modules/@stdlib/stats/incr/nanmmpe/README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/node_modules/@stdlib/stats/incr/nanmmpe/README.md b/lib/node_modules/@stdlib/stats/incr/nanmmpe/README.md index 35f4a1926d7b..683b4694c32a 100644 --- a/lib/node_modules/@stdlib/stats/incr/nanmmpe/README.md +++ b/lib/node_modules/@stdlib/stats/incr/nanmmpe/README.md @@ -107,7 +107,6 @@ m = accumulator(); ## 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` (f,a) pairs 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. - Be careful when interpreting the [mean percentage error][mean-percentage-error] as errors can cancel. This stated, that errors can cancel makes the [mean percentage error][mean-percentage-error] suitable for measuring the bias in forecasts. - **Warning**: the [mean percentage error][mean-percentage-error] is **not** suitable for intermittent demand patterns (i.e., when `a_i` is `0`). Interpretation is most straightforward when actual and forecast values are positive valued (e.g., number of widgets sold).