Skip to content

Commit eebec21

Browse files
chore: fix lint errors
PR-URL: #8184 Closes: #8183 Co-authored-by: Athan Reines <kgryte@gmail.com> Reviewed-by: Athan Reines <kgryte@gmail.com>
1 parent 88af477 commit eebec21

File tree

3 files changed

+33
-67
lines changed

3 files changed

+33
-67
lines changed

lib/node_modules/@stdlib/stats/ztest/README.md

Lines changed: 26 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -35,24 +35,18 @@ var ztest = require( '@stdlib/stats/ztest' );
3535
The function performs a one-sample z-test for the null hypothesis that the data in [array][mdn-array] or [typed array][mdn-typed-array] `x` is drawn from a normal distribution with mean zero and known standard deviation `sigma`.
3636

3737
```javascript
38-
var normal = require( '@stdlib/random/base/normal' ).factory;
38+
var normal = require( '@stdlib/random/array/normal' );
3939

40-
var rnorm = normal( 0.0, 2.0, {
41-
'seed': 5776
42-
});
43-
44-
var arr = new Array( 300 );
45-
var i;
46-
for ( i = 0; i < arr.length; i++ ) {
47-
arr[ i ] = rnorm();
48-
}
40+
// Create an array of random numbers:
41+
var arr = normal( 300, 0.0, 2.0 );
4942

43+
// Test whether true mean is equal to 0.0:
5044
var out = ztest( arr, 2.0 );
5145
/* e.g., returns
5246
{
5347
'rejected': false,
5448
'pValue': ~0.155,
55-
'statistic': -1.422,
49+
'statistic': ~-1.422,
5650
'ci': [~-0.391,~0.062],
5751
// ...
5852
}
@@ -90,16 +84,13 @@ The `ztest` function accepts the following `options`:
9084
By default, the hypothesis test is carried out at a significance level of `0.05`. To choose a different significance level, set the `alpha` option.
9185

9286
```javascript
93-
var table;
94-
var out;
95-
var arr;
87+
var arr = [ 2, 4, 3, 1, 0 ];
9688

97-
arr = [ 2, 4, 3, 1, 0 ];
98-
99-
out = ztest( arr, 2.0, {
89+
var out = ztest( arr, 2.0, {
10090
'alpha': 0.01
10191
});
102-
table = out.print();
92+
93+
var table = out.print();
10394
/* e.g., returns
10495
One-sample z-test
10596
@@ -132,19 +123,16 @@ table = out.print();
132123
To test whether the data comes from a distribution with a mean different than zero, set the `mu` option.
133124

134125
```javascript
135-
var out;
136-
var arr;
137-
138-
arr = [ 4, 4, 6, 6, 5 ];
126+
var arr = [ 4, 4, 6, 6, 5 ];
139127

140-
out = ztest( arr, 1.0, {
128+
var out = ztest( arr, 1.0, {
141129
'mu': 5.0
142130
});
143131
/* e.g., returns
144132
{
145133
'rejected': false,
146-
'pValue': 1,
147-
'statistic': 0,
134+
'pValue': 1.0,
135+
'statistic': 0.0,
148136
'ci': [ ~4.123, ~5.877 ],
149137
// ...
150138
}
@@ -154,22 +142,19 @@ out = ztest( arr, 1.0, {
154142
By default, a two-sided test is performed. To perform either of the one-sided tests, set the `alternative` option to `less` or `greater`.
155143

156144
```javascript
157-
var table;
158-
var out;
159-
var arr;
160-
161-
arr = [ 4, 4, 6, 6, 5 ];
145+
var arr = [ 4, 4, 6, 6, 5 ];
162146

163-
out = ztest( arr, 1.0, {
147+
var out = ztest( arr, 1.0, {
164148
'alternative': 'less'
165149
});
166-
table = out.print();
150+
151+
var table = out.print();
167152
/* e.g., returns
168153
One-sample z-test
169154
170155
Alternative hypothesis: True mean is less than 0
171156
172-
pValue: 1
157+
pValue: 1.0
173158
statistic: 11.1803
174159
95% confidence interval: [-Infinity,5.7356]
175160
@@ -185,7 +170,7 @@ table = out.print();
185170
186171
Alternative hypothesis: True mean is greater than 0
187172
188-
pValue: 0
173+
pValue: 0.0
189174
statistic: 11.1803
190175
95% confidence interval: [4.2644,Infinity]
191176
@@ -204,38 +189,28 @@ table = out.print();
204189
<!-- eslint no-undef: "error" -->
205190

206191
```javascript
207-
var normal = require( '@stdlib/random/base/normal' ).factory;
192+
var normal = require( '@stdlib/random/array/normal' );
208193
var ztest = require( '@stdlib/stats/ztest' );
209194

210-
var rnorm;
211-
var arr;
212-
var out;
213-
var i;
214-
215-
rnorm = normal( 5.0, 4.0, {
216-
'seed': 37827
217-
});
218-
arr = new Array( 500 );
219-
for ( i = 0; i < arr.length; i++ ) {
220-
arr[ i ] = rnorm();
221-
}
195+
// Create an array of random numbers:
196+
var arr = normal( 500, 5.0, 4.0 );
222197

223-
// Test whether true mean is equal to zero:
224-
out = ztest( arr, 4.0 );
198+
// Test whether true mean is equal to 0.0:
199+
var out = ztest( arr, 4.0 );
225200
console.log( out.print() );
226201
/* e.g., =>
227202
One-sample z-test
228203
229204
Alternative hypothesis: True mean is not equal to 0
230205
231-
pValue: 0
206+
pValue: 0.0
232207
statistic: 28.6754
233208
95% confidence interval: [4.779,5.4802]
234209
235210
Test Decision: Reject null in favor of alternative at 5% significance level
236211
*/
237212

238-
// Test whether true mean is equal to five:
213+
// Test whether true mean is equal to 5.0:
239214
out = ztest( arr, 4.0, {
240215
'mu': 5.0
241216
});

lib/node_modules/@stdlib/stats/ztest/examples/index.js

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,27 +18,17 @@
1818

1919
'use strict';
2020

21-
var normal = require( '@stdlib/random/base/normal' ).factory;
21+
var normal = require( '@stdlib/random/array/normal' );
2222
var ztest = require( './../lib' );
2323

24-
var rnorm;
25-
var arr;
26-
var out;
27-
var i;
24+
// Create an array of random numbers:
25+
var arr = normal( 500, 5.0, 4.0 );
2826

29-
rnorm = normal( 5.0, 4.0, {
30-
'seed': 37827
31-
});
32-
arr = new Array( 500 );
33-
for ( i = 0; i < arr.length; i++ ) {
34-
arr[ i ] = rnorm();
35-
}
36-
37-
// Test whether true mean is equal to zero:
38-
out = ztest( arr, 4.0 );
27+
// Test whether true mean is equal to 4.0:
28+
var out = ztest( arr, 4.0 );
3929
console.log( out.print() );
4030

41-
// Test whether true mean is equal to five:
31+
// Test whether true mean is equal to 5.0:
4232
out = ztest( arr, 4.0, {
4333
'mu': 5.0
4434
});

lib/node_modules/@stdlib/utils/nonenumerable-properties-in/lib/main.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ var getOwnPropertyNames = require( '@stdlib/utils/property-names' );
2525
var getPrototypeOf = require( '@stdlib/utils/get-prototype-of' );
2626
var hasOwnProp = require( '@stdlib/assert/has-own-property' );
2727
var isNonEnumerable = require( '@stdlib/assert/is-nonenumerable-property' );
28+
var Object = require( '@stdlib/object/ctor' );
2829

2930

3031
// MAIN //

0 commit comments

Comments
 (0)