-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Expand file tree
/
Copy pathrepl.txt
More file actions
53 lines (44 loc) · 2 KB
/
repl.txt
File metadata and controls
53 lines (44 loc) · 2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
{{alias}}( arrays )
Computes the variance of a one-dimensional single-precision
floating-point ndarray.
If provided an empty one-dimensional ndarray, the function returns `NaN`.
If `N - c` is less than or equal to `0` (where `N` corresponds to the number
of elements in the input ndarray and `c` corresponds to the provided degrees
of freedom adjustment), the function returns `NaN`.
Parameters
----------
arrays: ArrayLikeObject<ndarray>
Array-like object containing two elements: a one-dimensional input
ndarray and a zero-dimensional ndarray specifying the degrees of freedom
adjustment. Providing a non-zero degrees of freedom adjustment has the
effect of adjusting the divisor during the calculation of the variance
according to `N-c` where `N` is the number of elements in the input
ndarray and `c` corresponds to the provided degrees of freedom
adjustment. When computing the variance of a population, setting this
parameter to `0` is the standard choice (i.e., the provided array
contains data constituting an entire population). When computing the
unbiased sample variance, setting this parameter to `1` is the standard
choice (i.e., the provided array contains data sampled from a larger
population; this is commonly referred to as Bessel's correction).
Returns
-------
out: number
The variance.
Examples
--------
// Create input ndarray:
> var xbuf = new {{alias:@stdlib/array/float32}}( [ 1.0, -2.0, 2.0 ] );
> var dt = 'float32';
> var sh = [ xbuf.length ];
> var st = [ 1 ];
> var oo = 0;
> var ord = 'row-major';
> var x = new {{alias:@stdlib/ndarray/ctor}}( dt, xbuf, sh, st, oo, ord );
// Create correction ndarray:
> var opts = { 'dtype': dt };
> var correction = {{alias:@stdlib/ndarray/from-scalar}}( 1.0, opts );
// Compute the variance:
> {{alias}}( [ x, correction ] )
~4.333333
See Also
--------