diff --git a/lib/node_modules/@stdlib/stats/base/ttest/alternatives/README.md b/lib/node_modules/@stdlib/stats/base/ttest/alternatives/README.md new file mode 100644 index 000000000000..5497c11bf05c --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/ttest/alternatives/README.md @@ -0,0 +1,188 @@ + + +# Alternative Hypotheses + +> T-test alternative hypotheses. + + + +
+ +
+ + + + + +
+ +## Usage + +```javascript +var alternatives = require( '@stdlib/stats/base/ttest/alternatives' ); +``` + +#### alternatives() + +Returns a list of t-test alternative hypotheses. + +```javascript +var out = alternatives(); +// e.g., returns [ 'two-sided', 'less', 'greater' ] +``` + +The output array contains the following alternatives: + +- `two-sided`: mean is not equal to the null hypothesis value. +- `less`: mean is less than the null hypothesis value. +- `greater`: mean is greater than the null hypothesis value. + +
+ + + + + +
+ +
+ + + + + +
+ +## Examples + + + +```javascript +var contains = require( '@stdlib/array/base/assert/contains' ).factory; +var alternatives = require( '@stdlib/stats/base/ttest/alternatives' ); + +var isAlternative = contains( alternatives() ); + +var bool = isAlternative( 'two-sided' ); +// returns true + +bool = isAlternative( 'greater' ); +// returns true + +bool = isAlternative( 'beep' ); +// returns false +``` + +
+ + + + + +* * * + +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +#include "stdlib/stats/base/ttest/alternatives.h" +``` + +#### STDLIB_STATS_TTEST_ALTERNATIVE + +An enumeration of T-test alternative hypotheses with the following fields: + +- **STDLIB_STATS_TTEST_TWO_SIDED**: mean is not equal to the null hypothesis value. +- **STDLIB_STATS_TTEST_LESS**: mean is less than the null hypothesis value. +- **STDLIB_STATS_TTEST_GREATER**: mean is greater than the null hypothesis value. + +```c +#include "stdlib/stats/base/ttest/alternatives.h" + +const enum STDLIB_STATS_TTEST_ALTERNATIVE v = STDLIB_STATS_TTEST_TWO_SIDED; +``` + +
+ + + + + +
+ +### Notes + +- Enumeration constants should be considered opaque values, and one should **not** rely on specific integer values. + +
+ + + + + +
+ +
+ + + +
+ + + + + +
+ +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/stats/base/ttest/alternatives/benchmark/benchmark.js b/lib/node_modules/@stdlib/stats/base/ttest/alternatives/benchmark/benchmark.js new file mode 100644 index 000000000000..e122d78ede98 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/ttest/alternatives/benchmark/benchmark.js @@ -0,0 +1,48 @@ +/** +* @license Apache-2.0 +* +* 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. +* 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 isStringArray = require( '@stdlib/assert/is-string-array' ).primitives; +var pkg = require( './../package.json' ).name; +var alternatives = require( './../lib' ); + + +// MAIN // + +bench( pkg, function benchmark( b ) { + var out; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + out = alternatives(); + if ( out.length < 2 ) { + b.fail( 'should return an array' ); + } + } + b.toc(); + if ( !isStringArray( out ) ) { + b.fail( 'should return an array of strings' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/stats/base/ttest/alternatives/docs/repl.txt b/lib/node_modules/@stdlib/stats/base/ttest/alternatives/docs/repl.txt new file mode 100644 index 000000000000..1ffacbff8e9c --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/ttest/alternatives/docs/repl.txt @@ -0,0 +1,23 @@ + +{{alias}}() + Returns a list of alternative hypotheses. + + The output array contains the following alternatives: + + - two-sided: mean is not equal to null value. + - less: mean is less than null value. + - greater: mean is larger than null value. + + Returns + ------- + out: Array + List of alternatives. + + Examples + -------- + > var out = {{alias}}() + [ 'two-sided', 'less', 'greater' ] + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/stats/base/ttest/alternatives/docs/types/index.d.ts b/lib/node_modules/@stdlib/stats/base/ttest/alternatives/docs/types/index.d.ts new file mode 100644 index 000000000000..4d36315e09d2 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/ttest/alternatives/docs/types/index.d.ts @@ -0,0 +1,35 @@ +/* +* @license Apache-2.0 +* +* 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. +* 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 + +/** +* Returns a list of alternative hypotheses. +* +* @returns list of alternative hypotheses +* +* @example +* var list = alternatives(); +* // e.g., returns [ 'two-sided', 'less', 'greater' ] +*/ +declare function alternatives(): Array; + + +// EXPORTS // + +export = alternatives; diff --git a/lib/node_modules/@stdlib/stats/base/ttest/alternatives/docs/types/test.ts b/lib/node_modules/@stdlib/stats/base/ttest/alternatives/docs/types/test.ts new file mode 100644 index 000000000000..c6ed3ee951c0 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/ttest/alternatives/docs/types/test.ts @@ -0,0 +1,32 @@ +/* +* @license Apache-2.0 +* +* 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. +* 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 alternatives = require( './index' ); + + +// TESTS // + +// The function returns an array of strings... +{ + alternatives(); // $ExpectType string[] +} + +// The compiler throws an error if the function is provided any arguments... +{ + alternatives( 9 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/stats/base/ttest/alternatives/examples/index.js b/lib/node_modules/@stdlib/stats/base/ttest/alternatives/examples/index.js new file mode 100644 index 000000000000..6afadc6de495 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/ttest/alternatives/examples/index.js @@ -0,0 +1,36 @@ +/** +* @license Apache-2.0 +* +* 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. +* 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 contains = require( '@stdlib/array/base/assert/contains' ).factory; +var alternatives = require( './../lib' ); + +var isAlternative = contains( alternatives() ); + +var bool = isAlternative( 'two-sided' ); +console.log( bool ); +// => true + +bool = isAlternative( 'greater' ); +console.log( bool ); +// => true + +bool = isAlternative( 'beep' ); +console.log( bool ); +// => false diff --git a/lib/node_modules/@stdlib/stats/base/ttest/alternatives/include/stdlib/stats/base/ttest/alternatives.h b/lib/node_modules/@stdlib/stats/base/ttest/alternatives/include/stdlib/stats/base/ttest/alternatives.h new file mode 100644 index 000000000000..72df6bb0bb93 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/ttest/alternatives/include/stdlib/stats/base/ttest/alternatives.h @@ -0,0 +1,36 @@ +/** +* @license Apache-2.0 +* +* 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. +* 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. +*/ + +#ifndef STDLIB_STATS_BASE_TTEST_ALTERNATIVES_H +#define STDLIB_STATS_BASE_TTEST_ALTERNATIVES_H + +/** +* Enumeration of alternative hypotheses. +*/ +enum STDLIB_STATS_TTEST_ALTERNATIVE { + // Mean is not equal to the null hypothesis value: + STDLIB_STATS_TTEST_TWO_SIDED = 0, + + // Mean is less than the null hypothesis value: + STDLIB_STATS_TTEST_LESS, + + // Mean is greater than the null hypothesis value: + STDLIB_STATS_TTEST_GREATER +}; + +#endif // !STDLIB_STATS_BASE_TTEST_ALTERNATIVES_H diff --git a/lib/node_modules/@stdlib/stats/base/ttest/alternatives/lib/data.json b/lib/node_modules/@stdlib/stats/base/ttest/alternatives/lib/data.json new file mode 100644 index 000000000000..dee8fc1f93a6 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/ttest/alternatives/lib/data.json @@ -0,0 +1,5 @@ +[ + "two-sided", + "less", + "greater" +] diff --git a/lib/node_modules/@stdlib/stats/base/ttest/alternatives/lib/enum.js b/lib/node_modules/@stdlib/stats/base/ttest/alternatives/lib/enum.js new file mode 100644 index 000000000000..f52a772d37c8 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/ttest/alternatives/lib/enum.js @@ -0,0 +1,54 @@ +/** +* @license Apache-2.0 +* +* 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. +* 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'; + +// MAIN // + +/** +* Returns an object mapping supported alternatives to integer values for purposes of C inter-operation. +* +* ## Notes +* +* - Downstream consumers of this mapping should **not** rely on specific integer values (e.g., `TWO_SIDED == 0`). Instead, the object should be used in an opaque manner. +* - The main purpose of this function is JavaScript and C inter-operation. +* +* @returns {Object} object mapping supported alternatives to integer values +* +* @example +* var table = enumerated(); +* // returns +*/ +function enumerated() { + // NOTE: the following should match the C `alternatives.h` enumeration!!!! + return { + // Mean is not equal to the null hypothesis value: + 'two-sided': 0, + + // Mean is less than the null hypothesis value: + 'less': 1, + + // Mean is greater than the null hypothesis value: + 'greater': 2 + }; +} + + +// EXPORTS // + +module.exports = enumerated; diff --git a/lib/node_modules/@stdlib/stats/base/ttest/alternatives/lib/index.js b/lib/node_modules/@stdlib/stats/base/ttest/alternatives/lib/index.js new file mode 100644 index 000000000000..6a53e821727c --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/ttest/alternatives/lib/index.js @@ -0,0 +1,47 @@ +/** +* @license Apache-2.0 +* +* 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. +* 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'; + +/** +* Return a list of T-test alternative hypotheses. +* +* @module @stdlib/stats/base/ttest/alternatives +* +* @example +* var alternatives = require( '@stdlib/stats/base/ttest/alternatives' ); +* +* var list = alternatives(); +* // e.g., returns [ 'two-sided', 'less', 'greater' ] +*/ + +// MODULES // + +var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); +var main = require( './main.js' ); +var enumeration = require( './enum.js' ); + + +// MAIN // + +setReadOnly(main, 'enum', enumeration); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/stats/base/ttest/alternatives/lib/main.js b/lib/node_modules/@stdlib/stats/base/ttest/alternatives/lib/main.js new file mode 100644 index 000000000000..bc7bf2c3e240 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/ttest/alternatives/lib/main.js @@ -0,0 +1,44 @@ +/** +* @license Apache-2.0 +* +* 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. +* 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 DATA = require( './data.json' ); + + +// MAIN // + +/** +* Returns a list of T-test alternative hypotheses. +* +* @returns {StringArray} list of alternative hypotheses +* +* @example +* var list = alternatives(); +* // e.g., returns [ 'two-sided', 'less', 'greater' ] +*/ +function alternatives() { + return DATA.slice(); +} + + +// EXPORTS // + +module.exports = alternatives; diff --git a/lib/node_modules/@stdlib/stats/base/ttest/alternatives/manifest.json b/lib/node_modules/@stdlib/stats/base/ttest/alternatives/manifest.json new file mode 100644 index 000000000000..844d692f6439 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/ttest/alternatives/manifest.json @@ -0,0 +1,36 @@ +{ + "options": {}, + "fields": [ + { + "field": "src", + "resolve": true, + "relative": true + }, + { + "field": "include", + "resolve": true, + "relative": true + }, + { + "field": "libraries", + "resolve": false, + "relative": false + }, + { + "field": "libpath", + "resolve": true, + "relative": false + } + ], + "confs": [ + { + "src": [], + "include": [ + "./include" + ], + "libraries": [], + "libpath": [], + "dependencies": [] + } + ] +} diff --git a/lib/node_modules/@stdlib/stats/base/ttest/alternatives/package.json b/lib/node_modules/@stdlib/stats/base/ttest/alternatives/package.json new file mode 100644 index 000000000000..9e4ed2ecca60 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/ttest/alternatives/package.json @@ -0,0 +1,64 @@ +{ + "name": "@stdlib/stats/base/ttest/alternatives", + "version": "0.0.0", + "description": "T-test alternative hypotheses.", + "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", + "include": "./include", + "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", + "stats", + "statistics", + "utilities", + "utility", + "utils", + "util", + "ttest", + "t-test" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/stats/base/ttest/alternatives/test/test.js b/lib/node_modules/@stdlib/stats/base/ttest/alternatives/test/test.js new file mode 100644 index 000000000000..cb5233da7002 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/ttest/alternatives/test/test.js @@ -0,0 +1,75 @@ +/** +* @license Apache-2.0 +* +* 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. +* 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 hasOwnProp = require( '@stdlib/assert/has-own-property' ); +var isNonNegativeInteger = require( '@stdlib/assert/is-nonnegative-integer' ).isPrimitive; +var alternatives = require( './../lib' ); + + +// TESTS // + +tape('main export is a function', function test(t) { + t.ok(true, __filename); + t.strictEqual(typeof alternatives, 'function', 'main export is a function'); + t.end(); +}); + +tape('the function returns a list of alternatives', function test(t) { + var expected; + var actual; + + expected = [ + 'two-sided', + 'less', + 'greater' + ]; + actual = alternatives(); + + t.deepEqual(actual, expected, 'returns expected value'); + t.end(); +}); + +tape('attached to the main function is an `enum` method to return an object mapping alternatives to integer values for C inter-operation', function test(t) { + var obj; + var o; + var i; + + t.strictEqual(hasOwnProp(alternatives, 'enum'), true, 'has property'); + t.strictEqual(typeof alternatives.enum, 'function', 'has method'); + + obj = alternatives.enum(); + t.strictEqual(typeof obj, 'object', 'returns expected value type'); + + // List of values which should be supported... + o = [ + 'two-sided', + 'less', + 'greater' + ]; + for (i = 0; i < o.length; i++) { + t.strictEqual(hasOwnProp(obj, o[i]), true, 'has property `' + o[i] + '`'); + t.strictEqual(isNonNegativeInteger(obj[o[i]]), true, 'returns expected value'); + } + + t.end(); +});