@stdlib/stats-base-ztest-one-sample-results-to-string
v0.1.1
Published
Serialize a one-sample Z-test results object as a formatted string.
Downloads
263
Readme
res2str
Serialize a one-sample Z-test results object as a formatted string.
Installation
npm install @stdlib/stats-base-ztest-one-sample-results-to-stringUsage
var res2str = require( '@stdlib/stats-base-ztest-one-sample-results-to-string' );res2str( results[, options] )
Serializes a one-sample Z-test results object as a formatted string.
var Float64Results = require( '@stdlib/stats-base-ztest-one-sample-results-float64' );
var results = new Float64Results();
// ...
var s = res2str( results );
// returns <string>The function supports the following parameters:
- results: one-sample Z-test results object.
- options: function options.
The function supports the following options:
- digits: number of digits to display after decimal points. Default:
4. - decision: boolean indicating whether to show the test decision. Default:
true.
Notes
Example output:
One-sample Z-test Alternative hypothesis: True mean is less than 1.0 pValue: 0.0406 statistic: 9.9901 95% confidence interval: [9.7821, 10.4451] Test Decision: Reject null in favor of alternative at 5% significance level
Examples
var Float64Results = require( '@stdlib/stats-base-ztest-one-sample-results-float64' );
var Float64Array = require( '@stdlib/array-float64' );
var res2str = require( '@stdlib/stats-base-ztest-one-sample-results-to-string' );
var results = new Float64Results();
results.rejected = true;
results.alpha = 0.05;
results.pValue = 0.3364;
results.statistic = 11.7586;
results.nullValue = 0.0;
results.sd = 0.4563;
results.ci = new Float64Array( [ 9.9983, 11.4123 ] );
results.alternative = 'two-sided';
var s = res2str( results );
console.log( s );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.
