diff --git a/lib/node_modules/@stdlib/stats/incr/nanmaape/README.md b/lib/node_modules/@stdlib/stats/incr/nanmaape/README.md
new file mode 100644
index 000000000000..0f02a006fa35
--- /dev/null
+++ b/lib/node_modules/@stdlib/stats/incr/nanmaape/README.md
@@ -0,0 +1,179 @@
+
+
+# incrnanmaape
+
+> Compute the [mean arctangent absolute percentage error][@kim:2016a] (NANMAAPE) incrementally.
+
+
+
+The [mean arctangent absolute percentage error][@kim:2016a] is defined as
+
+
+
+```math
+\mathop{\mathrm{NANMAAPE}} = \frac{1}{n} \sum_{i=0}^{n-1} \mathop{\mathrm{arctan}}\biggl( \biggl| \frac{a_i - f_i}{a_i} \biggr| \biggr)
+```
+
+
+
+
+
+where `f_i` is the forecast value and `a_i` is the actual value.
+
+
+
+
+
+
+
+## Usage
+
+```javascript
+var incrnanmaape = require( '@stdlib/stats/incr/nanmaape' );
+```
+
+#### incrnanmaape()
+
+Returns an accumulator `function` which incrementally computes the [mean arctangent absolute percentage error][@kim:2016a].
+
+```javascript
+var accumulator = incrnanmaape();
+```
+
+#### accumulator( \[f, a] )
+
+If provided input values `f` and `a`, the accumulator function returns an updated [mean arctangent absolute percentage error][@kim:2016a]. If not provided input values `f` and `a`, the accumulator function returns the current [mean arctangent absolute percentage error][@kim:2016a].
+
+```javascript
+var accumulator = incrnanmaape();
+
+var m = accumulator( 2.0, 3.0 );
+// returns ~0.3218
+
+m = accumulator( 1.0, 4.0 );
+// returns ~0.4826
+
+m = accumulator( 3.0, 5.0 );
+// returns ~0.4486
+
+m = accumulator();
+// returns ~0.4486
+```
+
+
+
+
+
+
+
+## Notes
+
+- Input values are **not** type checked. If provided `NaN` or a value which, when used in computations, results in `NaN`, the accumulated value is `NaN` for **all** future invocations. If non-numeric inputs are possible, you are advised to type check and handle accordingly **before** passing the value to the accumulator function.
+- Note that, unlike the [mean absolute percentage error][@stdlib/stats/incr/nanmape] (NMAPE), the [mean arctangent absolute percentage error][@kim:2016a] is expressed in radians on the interval \[0,π/2].
+
+
+
+
+
+
+
+## Examples
+
+
+
+```javascript
+var randu = require( '@stdlib/random/base/randu' );
+var incrnanmaape = require( '@stdlib/stats/incr/nanmaape' );
+
+var accumulator;
+var v1;
+var v2;
+var i;
+
+// Initialize an accumulator:
+accumulator = incrnanmaape();
+
+// For each simulated datum, update the mean arctangent absolute 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() );
+```
+
+
+
+
+
+
+
+## References
+
+- Kim, Sungil, and Heeyoung Kim. 2016. "A new metric of absolute percentage error for intermittent demand forecasts." _International Journal of Forecasting_ 32 (3): 669–79. doi:[10.1016/j.ijforecast.2015.12.003][@kim:2016a].
+
+
+
+
+
+
+
+
+
+* * *
+
+## See Also
+
+- [`@stdlib/stats/incr/mae`][@stdlib/stats/incr/mae]: compute the mean absolute error (MAE) incrementally.
+- [`@stdlib/stats/incr/mape`][@stdlib/stats/incr/mape]: compute the mean absolute percentage error (MAPE) incrementally.
+- [`@stdlib/stats/incr/mean`][@stdlib/stats/incr/mean]: compute an arithmetic mean incrementally.
+- [`@stdlib/stats/incr/mmaape`][@stdlib/stats/incr/mmaape]: compute a moving arctangent mean absolute percentage error (MAAPE) incrementally.
+
+
+
+
+
+
+
+
+
+[@kim:2016a]: https://www.sciencedirect.com/science/article/pii/S0169207016000121
+
+
+
+[@stdlib/stats/incr/mae]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/stats/incr/mae
+
+[@stdlib/stats/incr/mape]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/stats/incr/mape
+
+[@stdlib/stats/incr/mean]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/stats/incr/mean
+
+[@stdlib/stats/incr/mmaape]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/stats/incr/mmaape
+
+[@stdlib/stats/incr/nanmape]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/stats/incr/nanmape
+
+
+
+
+
+
diff --git a/lib/node_modules/@stdlib/stats/incr/nanmaape/benchmark/benchmark.js b/lib/node_modules/@stdlib/stats/incr/nanmaape/benchmark/benchmark.js
new file mode 100644
index 000000000000..5813f842ae05
--- /dev/null
+++ b/lib/node_modules/@stdlib/stats/incr/nanmaape/benchmark/benchmark.js
@@ -0,0 +1,69 @@
+/**
+* @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 bench = require( '@stdlib/bench' );
+var randu = require( '@stdlib/random/base/randu' );
+var pkg = require( './../package.json' ).name;
+var incrnanmaape = require( './../lib' );
+
+
+// MAIN //
+
+bench( pkg, function benchmark( b ) {
+ var f;
+ var i;
+ b.tic();
+ for ( i = 0; i < b.iterations; i++ ) {
+ f = incrnanmaape();
+ 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 = incrnanmaape();
+
+ 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/nanmaape/docs/img/equation_mean_arctangent_absolute_percentage_error.svg b/lib/node_modules/@stdlib/stats/incr/nanmaape/docs/img/equation_mean_arctangent_absolute_percentage_error.svg
new file mode 100644
index 000000000000..00d589a7ad0c
--- /dev/null
+++ b/lib/node_modules/@stdlib/stats/incr/nanmaape/docs/img/equation_mean_arctangent_absolute_percentage_error.svg
@@ -0,0 +1,103 @@
+
\ No newline at end of file
diff --git a/lib/node_modules/@stdlib/stats/incr/nanmaape/docs/repl.txt b/lib/node_modules/@stdlib/stats/incr/nanmaape/docs/repl.txt
new file mode 100644
index 000000000000..e0fc989fe0e1
--- /dev/null
+++ b/lib/node_modules/@stdlib/stats/incr/nanmaape/docs/repl.txt
@@ -0,0 +1,37 @@
+
+{{alias}}()
+ Returns an accumulator function which incrementally computes the mean
+ arctangent absolute percentage error (NANMAAPE).
+
+ If provided input values, the accumulator function returns an updated mean
+ arctangent absolute percentage error. If not provided input values, the
+ accumulator function returns the current mean arctangent absolute percentage
+ error.
+
+ Note that, unlike the mean absolute percentage error (NANMAPE), the mean
+ arctangent absolute percentage error is expressed in radians on the interval
+ [0,π/2].
+
+ If provided `NaN` or a value which, when used in computations, results in
+ `NaN`, the accumulated value is `NaN` for all future invocations.
+
+ Returns
+ -------
+ acc: Function
+ Accumulator function.
+
+ Examples
+ --------
+ > var accumulator = {{alias}}();
+ > var m = accumulator()
+ null
+ > m = accumulator( 2.0, 3.0 )
+ ~0.3218
+ > m = accumulator( 5.0, 2.0 )
+ ~0.6523
+ > m = accumulator()
+ ~0.6523
+
+ See Also
+ --------
+
diff --git a/lib/node_modules/@stdlib/stats/incr/nanmaape/docs/types/index.d.ts b/lib/node_modules/@stdlib/stats/incr/nanmaape/docs/types/index.d.ts
new file mode 100644
index 000000000000..9fc40e6d16f9
--- /dev/null
+++ b/lib/node_modules/@stdlib/stats/incr/nanmaape/docs/types/index.d.ts
@@ -0,0 +1,62 @@
+/*
+* @license Apache-2.0
+*
+* Copyright (c) 2019 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 arctangent absolute percentage error. If not provided input values, the accumulator function returns the current mean arctangent absolute percentage error.
+*
+* ## Notes
+*
+* - Note that, unlike the mean absolute percentage error (MAPE), the mean arctangent absolute percentage error is expressed in radians on the interval [0,π/2].
+* - If provided `NaN` or a value which, when used in computations, results in `NaN`, the accumulated value is `NaN` for all future invocations.
+*
+* @param f - input value
+* @param a - input value
+* @returns mean arctangent absolute percentage error or null
+*/
+type accumulator = ( f?: number, a?: number ) => number | null;
+
+/**
+* Returns an accumulator function which incrementally computes the mean arctangent absolute percentage error.
+*
+* @returns accumulator function
+*
+* @example
+* var accumulator = incrnanmaape();
+*
+* var m = accumulator();
+* // returns null
+*
+* m = accumulator( 2.0, 3.0 );
+* // returns ~0.3218
+*
+* m = accumulator( 5.0, 2.0 );
+* // returns ~0.6523
+*
+* m = accumulator();
+* // returns ~0.6523
+*/
+declare function incrnanmaape(): accumulator;
+
+
+// EXPORTS //
+
+export = incrnanmaape;
diff --git a/lib/node_modules/@stdlib/stats/incr/nanmaape/docs/types/test.ts b/lib/node_modules/@stdlib/stats/incr/nanmaape/docs/types/test.ts
new file mode 100644
index 000000000000..e8ebaab650e8
--- /dev/null
+++ b/lib/node_modules/@stdlib/stats/incr/nanmaape/docs/types/test.ts
@@ -0,0 +1,69 @@
+/*
+* @license Apache-2.0
+*
+* Copyright (c) 2019 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 incrnanmaape = require( './index' );
+
+
+// TESTS //
+
+// The function returns an accumulator function...
+{
+ incrnanmaape(); // $ExpectType accumulator
+}
+
+// The compiler throws an error if the function is provided arguments...
+{
+ incrnanmaape( '5' ); // $ExpectError
+ incrnanmaape( 5 ); // $ExpectError
+ incrnanmaape( true ); // $ExpectError
+ incrnanmaape( false ); // $ExpectError
+ incrnanmaape( null ); // $ExpectError
+ incrnanmaape( undefined ); // $ExpectError
+ incrnanmaape( [] ); // $ExpectError
+ incrnanmaape( {} ); // $ExpectError
+ incrnanmaape( ( x: number ): number => x ); // $ExpectError
+}
+
+// The function returns an accumulator function which returns an accumulated result...
+{
+ const acc = incrnanmaape();
+
+ 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 = incrnanmaape();
+
+ 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/nanmaape/examples/index.js b/lib/node_modules/@stdlib/stats/incr/nanmaape/examples/index.js
new file mode 100644
index 000000000000..0619f52101ae
--- /dev/null
+++ b/lib/node_modules/@stdlib/stats/incr/nanmaape/examples/index.js
@@ -0,0 +1,41 @@
+/**
+* @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';
+
+var randu = require( '@stdlib/random/base/randu' );
+var incrnanmaape = require( './../lib' );
+
+var accumulator;
+var err;
+var v1;
+var v2;
+var i;
+
+// Initialize an accumulator:
+accumulator = incrnanmaape();
+
+// For each simulated datum, update the mean arctangent absolute percentage error...
+console.log( '\nValue\tValue\tNANMAAPE\n' );
+for ( i = 0; i < 100; i++ ) {
+ v1 = ( randu()*100.0 ) + 50.0;
+ v2 = ( randu()*100.0 ) + 50.0;
+ err = accumulator( v1, v2 );
+ console.log( '%d\t%d\t%d', v1.toFixed( 3 ), v2.toFixed( 3 ), err.toFixed( 3 ) );
+}
+console.log( '\nFinal NANMAAPE: %d\n', accumulator() );
diff --git a/lib/node_modules/@stdlib/stats/incr/nanmaape/lib/index.js b/lib/node_modules/@stdlib/stats/incr/nanmaape/lib/index.js
new file mode 100644
index 000000000000..f915e5cd898e
--- /dev/null
+++ b/lib/node_modules/@stdlib/stats/incr/nanmaape/lib/index.js
@@ -0,0 +1,51 @@
+/**
+* @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';
+
+/**
+* Compute the mean arctangent absolute percentage error incrementally.
+*
+* @module @stdlib/stats/incr/maape
+*
+* @example
+* var incrnanmaape = require( '@stdlib/stats/incr/nanmaape' );
+*
+* var accumulator = incrnanmaape();
+*
+* var m = accumulator();
+* // returns null
+*
+* m = accumulator( 2.0, 3.0 );
+* // returns ~0.3218
+*
+* m = accumulator( 5.0, 2.0 );
+* // returns ~0.6523
+*
+* m = accumulator();
+* // returns ~0.6523
+*/
+
+// MODULES //
+
+var main = require( './main.js' );
+
+
+// EXPORTS //
+
+module.exports = main;
diff --git a/lib/node_modules/@stdlib/stats/incr/nanmaape/lib/main.js b/lib/node_modules/@stdlib/stats/incr/nanmaape/lib/main.js
new file mode 100644
index 000000000000..aa5da58c30b1
--- /dev/null
+++ b/lib/node_modules/@stdlib/stats/incr/nanmaape/lib/main.js
@@ -0,0 +1,73 @@
+/**
+* @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 incrmean = require( '@stdlib/stats/incr/mean' );
+var abs = require( '@stdlib/math/base/special/abs' );
+var atan = require( '@stdlib/math/base/special/atan' );
+
+
+// MAIN //
+
+/**
+* Returns an accumulator function which incrementally computes the mean arctangent absolute percentage error.
+*
+* @returns {Function} accumulator function
+*
+* @example
+* var accumulator = incrnanmaape();
+*
+* var m = accumulator();
+* // returns null
+*
+* m = accumulator( 2.0, 3.0 );
+* // returns ~0.3218
+*
+* m = accumulator( 5.0, 2.0 );
+* // returns ~0.6523
+*
+* m = accumulator();
+* // returns ~0.6523
+*/
+function incrnanmaape() {
+ var mean = incrmean();
+ return accumulator;
+
+ /**
+ * If provided input values, the accumulator function returns an updated mean arctangent absolute percentage error. If not provided input values, the accumulator function returns the current mean arctangent absolute percentage error.
+ *
+ * @private
+ * @param {number} [f] - input value
+ * @param {number} [a] - input value
+ * @returns {(number|null)} mean arctangent absolute percentage error or null
+ */
+ function accumulator( f, a ) {
+ if ( arguments.length === 0 ||isNaN(f) || isNaN(a) || a === 0 ) {
+ return mean();
+ }
+ return mean( atan( abs( (a-f)/a ) ) );
+ }
+}
+
+
+// EXPORTS //
+
+module.exports = incrnanmaape;
diff --git a/lib/node_modules/@stdlib/stats/incr/nanmaape/package.json b/lib/node_modules/@stdlib/stats/incr/nanmaape/package.json
new file mode 100644
index 000000000000..197537d8fdc3
--- /dev/null
+++ b/lib/node_modules/@stdlib/stats/incr/nanmaape/package.json
@@ -0,0 +1,79 @@
+{
+ "name": "@stdlib/stats/incr/nanmaape",
+ "version": "0.0.0",
+ "description": "Compute the mean arctangent absolute percentage error (NMAAPE) 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",
+ "error",
+ "err",
+ "absolute",
+ "abs",
+ "mape",
+ "deviation",
+ "difference",
+ "diff",
+ "delta",
+ "incremental",
+ "accumulator",
+ "time series",
+ "timeseries",
+ "demand",
+ "forecasting",
+ "forecast"
+ ]
+}
diff --git a/lib/node_modules/@stdlib/stats/incr/nanmaape/test/test.js b/lib/node_modules/@stdlib/stats/incr/nanmaape/test/test.js
new file mode 100644
index 000000000000..69a3e384e58a
--- /dev/null
+++ b/lib/node_modules/@stdlib/stats/incr/nanmaape/test/test.js
@@ -0,0 +1,116 @@
+/**
+* @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 tape = require( 'tape' );
+var abs = require( '@stdlib/math/base/special/abs' );
+var atan = require( '@stdlib/math/base/special/atan' );
+var EPS = require( '@stdlib/constants/float64/eps' );
+var incrnanmaape = require( './../lib' );
+
+
+// TESTS //
+
+tape( 'main export is a function', function test( t ) {
+ t.ok( true, __filename );
+ t.strictEqual( typeof incrnanmaape, 'function', 'main export is a function' );
+ t.end();
+});
+
+tape( 'the function returns an accumulator function', function test( t ) {
+ t.equal( typeof incrnanmaape(), 'function', 'returns a function' );
+ t.end();
+});
+
+tape( 'the initial accumulated value is `null`', function test( t ) {
+ var acc = incrnanmaape();
+ t.equal( acc(), null, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the accumulator function incrementally computes the mean arctangent absolute percentage error', function test( t ) {
+ var expected;
+ var actual;
+ var delta;
+ var data;
+ var acc;
+ var sum;
+ var tol;
+ var N;
+ var x;
+ var y;
+ 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 = incrnanmaape();
+
+ sum = 0;
+ for ( i = 0; i < N; i++ ) {
+ x = data[ i ][ 0 ];
+ y = data[ i ][ 1 ];
+ sum += atan( abs( ( y-x ) / y ) );
+ expected = sum / (i+1);
+ actual = acc( x, y );
+ if ( actual === expected ) {
+ t.equal( actual, expected, 'returns expected value' );
+ } else {
+ delta = abs( expected - actual );
+ tol = 1.0 * EPS * abs( expected );
+ t.equal( delta <= tol, true, 'within tolerance. Actual: '+actual+'. Expected: '+expected+'. Delta: '+delta+'. Tol: '+tol+'.' );
+ }
+ }
+ t.end();
+});
+
+tape( 'if not provided an input value, the accumulator function returns the current mean arctangent absolute percentage error', function test( t ) {
+ var expected;
+ var actual;
+ var delta;
+ var data;
+ var acc;
+ var tol;
+ var i;
+
+ data = [
+ [ 2.0, 3.0 ],
+ [ 3.0, 5.0 ],
+ [ 10.0, 1.0 ]
+ ];
+ acc = incrnanmaape();
+ for ( i = 0; i < data.length; i++ ) {
+ acc( data[ i ][ 0 ], data[ i ][ 1 ] );
+ }
+ actual = acc();
+ expected = 1.0 / 3.0 * ( atan(1.0/3.0) + atan(2.0/5.0) + atan(9.0/1.0) );
+ delta = abs( expected - actual );
+ tol = 1.5 * EPS * abs( expected );
+ t.equal( delta <= tol, true, 'within tolerance. Actual: '+actual+'. Expected: '+expected+'. Delta: '+delta+'. Tol: '+tol+'.' );
+ t.end();
+});