Skip to content

Commit c74cbd6

Browse files
committed
fix: fixed repl documentation
--- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: passed - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent c73c60e commit c74cbd6

File tree

1 file changed

+33
-17
lines changed
  • lib/node_modules/@stdlib/stats/base/ndarray/svariance/docs

1 file changed

+33
-17
lines changed

lib/node_modules/@stdlib/stats/base/ndarray/svariance/docs/repl.txt

Lines changed: 33 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,27 @@
33
Computes the variance of a one-dimensional single-precision
44
floating-point ndarray.
55

6+
If provided an empty one-dimensional ndarray, the function returns `NaN`.
7+
8+
If `N - c` is less than or equal to `0` (where `N` corresponds to the number
9+
of elements in the input ndarray and `c` corresponds to the provided degrees
10+
of freedom adjustment), the function returns `NaN`.
11+
612
Parameters
713
----------
8-
arrays: Array<ndarray>
9-
Array-like object containing a one-dimensional input ndarray and a
10-
zero-dimensional ndarray specifying a degrees of freedom adjustment.
14+
arrays: ArrayLikeObject<ndarray>
15+
Array-like object containing two elements: a one-dimensional input
16+
ndarray and a zero-dimensional ndarray specifying the degrees of freedom
17+
adjustment. Providing a non-zero degrees of freedom adjustment has the
18+
effect of adjusting the divisor during the calculation of the variance
19+
according to `N-c` where `N` is the number of elements in the input
20+
ndarray and `c` corresponds to the provided degrees of freedom
21+
adjustment. When computing the variance of a population, setting this
22+
parameter to `0` is the standard choice (i.e., the provided array
23+
contains data constituting an entire population). When computing the
24+
unbiased sample variance, setting this parameter to `1` is the standard
25+
choice (i.e., the provided array contains data sampled from a larger
26+
population; this is commonly referred to as Bessel's correction).
1127

1228
Returns
1329
-------
@@ -16,22 +32,22 @@
1632

1733
Examples
1834
--------
19-
// Standard Usage:
20-
> var Float32Array = require( '@stdlib/array/float32' );
21-
> var scalar2ndarray = require( '@stdlib/ndarray/from-scalar' );
22-
> var ndarray = require( '@stdlib/ndarray/base/ctor' );
23-
> var xbuf = new Float32Array( [ 1.0, -2.0, 2.0 ] );
24-
> var x = new ndarray( 'float32', xbuf, [ 3 ], [ 1 ], 0, 'row-major' );
25-
> var correction = scalar2ndarray( 1.0, { 'dtype': 'float32' } );
26-
> {{alias}}( [ x, correction ] )
27-
~4.333333
35+
// Create input ndarray:
36+
> var xbuf = new {{alias:@stdlib/array/float32}}( [ 1.0, -2.0, 2.0 ] );
37+
> var dt = 'float32';
38+
> var sh = [ xbuf.length ];
39+
> var st = [ 1 ];
40+
> var oo = 0;
41+
> var ord = 'row-major';
42+
> var x = new {{alias:@stdlib/ndarray/ctor}}( dt, xbuf, sh, st, oo, ord );
43+
44+
// Create correction ndarray:
45+
> var opts = { 'dtype': dt };
46+
> var correction = {{alias:@stdlib/ndarray/from-scalar}}( 1.0, opts );
2847

29-
// Using ndarray properties:
30-
> xbuf = new Float32Array( [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0 ] );
31-
> x = new ndarray( 'float32', xbuf, [ 4 ], [ 2 ], 1, 'row-major' );
32-
> correction = scalar2ndarray( 1.0, { 'dtype': 'float32' } );
48+
// Compute the variance:
3349
> {{alias}}( [ x, correction ] )
34-
6.25
50+
~4.333333
3551

3652
See Also
3753
--------

0 commit comments

Comments
 (0)