@stdlib/stats-base-ztest-two-sample-results-struct-factory
v0.1.1
Published
Create a new struct constructor tailored to a specified floating-point data type.
Readme
structFactory
Create a new
structconstructor tailored to a specified floating-point data type.
Installation
npm install @stdlib/stats-base-ztest-two-sample-results-struct-factoryUsage
var structFactory = require( '@stdlib/stats-base-ztest-two-sample-results-struct-factory' );structFactory( dtype )
Returns a new struct constructor tailored to a specified floating-point data type.
var Struct = structFactory( 'float64' );
// returns <Function>
var s = new Struct();
// returns <Struct>The function supports the following parameters:
- dtype: floating-point data type for storing floating-point results. Must be either
'float64'or'float32'.
Notes
- A
structprovides a fixed-width composite data structure for storing two-sample Z-test results and provides an ABI-stable data layout for JavaScript-C interoperation.
Examples
var resolveEnum = require( '@stdlib/stats-base-ztest-alternative-resolve-enum' );
var Float64Array = require( '@stdlib/array-float64' );
var Float32Array = require( '@stdlib/array-float32' );
var structFactory = require( '@stdlib/stats-base-ztest-two-sample-results-struct-factory' );
var Struct = structFactory( 'float64' );
var results = new Struct({
'rejected': true,
'alpha': 0.05,
'pValue': 0.0132,
'statistic': 2.4773,
'nullValue': 0.0,
'xmean': 3.7561,
'ymean': 3.0129,
'ci': new Float64Array( [ 0.1552, 1.3311 ] ),
'alternative': resolveEnum( 'two-sided' )
});
var str = results.toString({
'format': 'linear'
});
console.log( str );
Struct = structFactory( 'float32' );
results = new Struct({
'rejected': true,
'alpha': 0.05,
'pValue': 0.0132,
'statistic': 2.4773,
'nullValue': 0.0,
'xmean': 3.7561,
'ymean': 3.0129,
'ci': new Float32Array( [ 0.1552, 1.3311 ] ),
'alternative': resolveEnum( 'two-sided' )
});
str = results.toString({
'format': 'linear'
});
console.log( str );Notice
This package is part of stdlib, a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more.
For more information on the project, filing bug reports and feature requests, and guidance on how to develop stdlib, see the main project repository.
Community
License
See LICENSE.
Copyright
Copyright © 2016-2026. The Stdlib Authors.
