forked from stdlib-js/stdlib
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrepl.txt
More file actions
56 lines (47 loc) · 1.98 KB
/
repl.txt
File metadata and controls
56 lines (47 loc) · 1.98 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
54
55
{{alias}}( arrays )
Computes the standard deviation of a one-dimensional ndarray.
Parameters
----------
arrays: ArrayLikeObject<ndarray>
Array-like object containing two elements: a one-dimensional input
ndarray and a zero-dimensional ndarray (or ndarray-like object)
specifying the degrees of freedom adjustment. Setting the correction
value to a value other than `0` has the effect of adjusting the divisor
during the calculation of the standard deviation according to `N - c`
where `c` corresponds to the provided degrees of freedom adjustment.
When computing the standard deviation 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
corrected sample standard deviation, 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 standard deviation.
Examples
--------
// Create input ndarray:
> var xbuf = [ 1.0, -2.0, 2.0 ];
> var dt = 'generic';
> 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': 'float64' };
> var correction = {{alias:@stdlib/ndarray/from-scalar}}( 1.0, opts );
// Compute the standard deviation:
> {{alias}}( [ x, correction ] )
~2.0817
// Using Float64Array buffer:
> xbuf = new {{alias:@stdlib/array/float64}}( [ 1.0, -2.0, 3.0, 2.0, 5.0, -1.0 ] );
> dt = 'float64';
> sh = [ xbuf.length ];
> x = new {{alias:@stdlib/ndarray/ctor}}( dt, xbuf, sh, st, oo, ord );
> {{alias}}( [ x, correction ] )
~2.5820
See Also
--------