stdlib-js / stats-ztest
Showing 1 of 1 files from the diff.

@@ -26,6 +26,7 @@
Loading
26 26
var setReadOnly = require( '@stdlib/utils-define-read-only-property' );
27 27
var cdfFactory = require( '@stdlib/stats-base-dists-normal-cdf' ).factory;
28 28
var quantileFactory = require( '@stdlib/stats-base-dists-normal-quantile' ).factory;
29 +
var format = require( '@stdlib/string-format' );
29 30
var sqrt = require( '@stdlib/math-base-special-sqrt' );
30 31
var abs = require( '@stdlib/math-base-special-abs' );
31 32
var mean = require( '@stdlib/stats-base-mean' );
@@ -90,10 +91,10 @@
Loading
90 91
	var mu;
91 92
92 93
	if ( !isTypedArrayLike( x ) && !isNumberArray( x ) ) {
93 -
		throw new TypeError( 'invalid argument. First argument `x` must be a numeric array. Value: `' + x + '`.' );
94 +
		throw new TypeError( format( 'invalid argument. First argument `x` must be a numeric array. Value: `%s`.', x ) );
94 95
	}
95 96
	if ( !isPositiveNumber( sigma ) ) {
96 -
		throw new TypeError( 'invalid argument. Second argument `sigma` must be a positive number. Value: `' + sigma + '`.' );
97 +
		throw new TypeError( format( 'invalid argument. Second argument `sigma` must be a positive number. Value: `%s`.', sigma ) );
97 98
	}
98 99
	len = x.length;
99 100
	opts = {};
@@ -110,10 +111,10 @@
Loading
110 111
		alpha = opts.alpha;
111 112
	}
112 113
	if ( alpha < 0.0 || alpha > 1.0 ) {
113 -
		throw new RangeError( 'invalid argument. Option `alpha` must be a number in the range 0 to 1. Value: `' + alpha + '`.' );
114 +
		throw new RangeError( format( 'invalid argument. Option `alpha` must be a number in the range 0 to 1. Value: `%f`.', alpha ) );
114 115
	}
115 116
	if ( len < 2 ) {
116 -
		throw new Error( 'invalid argument. First argument `x` must contain at least two elements. Value: `' + x + '`' );
117 +
		throw new Error( format( 'invalid argument. First argument must contain at least two elements. Value: `%s`.', x ) );
117 118
	}
118 119
	stderr = sqrt( sigma*sigma / len );
119 120
	xmean = mean( len, x, 1 );
@@ -141,7 +142,7 @@
Loading
141 142
		cint[ 1 ] = mu + (cint[ 1 ] * stderr);
142 143
		break;
143 144
	default:
144 -
		throw new Error( 'Invalid option. `alternative` must be either `two-sided`, `less` or `greater`. Value: `' + alt + '`' );
145 +
		throw new Error( format( 'Invalid option. `alternative` must be either `two-sided`, `less`, or `greater`. Value: `%s`.', alt ) );
145 146
	}
146 147
	out = {};
147 148
	setReadOnly( out, 'rejected', pval <= alpha );
Files Coverage
lib 100.00%
Project Totals (4 files) 100.00%
2043506404
unittests
2009705643
unittests

No yaml found.

Create your codecov.yml to customize your Codecov experience

Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading