repl.txt (3945B)
1 2 {{alias}}( N, correction, x, stride ) 3 Computes the standard deviation of a strided array ignoring `NaN` values. 4 5 The `N` and `stride` parameters determine which elements in `x` are accessed 6 at runtime. 7 8 Indexing is relative to the first index. To introduce an offset, use a typed 9 array view. 10 11 If `N <= 0`, the function returns `NaN`. 12 13 If every indexed element is `NaN`, the function returns `NaN`. 14 15 Parameters 16 ---------- 17 N: integer 18 Number of indexed elements. 19 20 correction: number 21 Degrees of freedom adjustment. Setting this parameter to a value other 22 than `0` has the effect of adjusting the divisor during the calculation 23 of the standard deviation according to `N - c` where `c` corresponds to 24 the provided degrees of freedom adjustment. When computing the standard 25 deviation of a population, setting this parameter to `0` is the standard 26 choice (i.e., the provided array contains data constituting an entire 27 population). When computing the corrected sample standard deviation, 28 setting this parameter to `1` is the standard choice (i.e., the provided 29 array contains data sampled from a larger population; this is commonly 30 referred to as Bessel's correction). 31 32 x: Array<number>|TypedArray 33 Input array. 34 35 stride: integer 36 Index increment. 37 38 Returns 39 ------- 40 out: number 41 The standard deviation. 42 43 Examples 44 -------- 45 // Standard Usage: 46 > var x = [ 1.0, -2.0, NaN, 2.0 ]; 47 > {{alias}}( x.length, 1, x, 1 ) 48 ~2.0817 49 50 // Using `N` and `stride` parameters: 51 > x = [ -2.0, 1.0, 1.0, -5.0, 2.0, -1.0 ]; 52 > var N = {{alias:@stdlib/math/base/special/floor}}( x.length / 2 ); 53 > {{alias}}( N, 1, x, 2 ) 54 ~2.0817 55 56 // Using view offsets: 57 > var x0 = new {{alias:@stdlib/array/float64}}( [ 1.0, -2.0, 3.0, 2.0, 5.0, -1.0 ] ); 58 > var x1 = new {{alias:@stdlib/array/float64}}( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); 59 > N = {{alias:@stdlib/math/base/special/floor}}( x0.length / 2 ); 60 > {{alias}}( N, 1, x1, 2 ) 61 ~2.0817 62 63 {{alias}}.ndarray( N, correction, x, stride, offset ) 64 Computes the standard deviation of a strided array ignoring `NaN` values and 65 using alternative indexing semantics. 66 67 While typed array views mandate a view offset based on the underlying 68 buffer, the `offset` parameter supports indexing semantics based on a 69 starting index. 70 71 Parameters 72 ---------- 73 N: integer 74 Number of indexed elements. 75 76 correction: number 77 Degrees of freedom adjustment. Setting this parameter to a value other 78 than `0` has the effect of adjusting the divisor during the calculation 79 of the standard deviation according to `N - c` where `c` corresponds to 80 the provided degrees of freedom adjustment. When computing the standard 81 deviation of a population, setting this parameter to `0` is the standard 82 choice (i.e., the provided array contains data constituting an entire 83 population). When computing the corrected sample standard deviation, 84 setting this parameter to `1` is the standard choice (i.e., the provided 85 array contains data sampled from a larger population; this is commonly 86 referred to as Bessel's correction). 87 88 x: Array<number>|TypedArray 89 Input array. 90 91 stride: integer 92 Index increment. 93 94 offset: integer 95 Starting index. 96 97 Returns 98 ------- 99 out: number 100 The standard deviation. 101 102 Examples 103 -------- 104 // Standard Usage: 105 > var x = [ 1.0, -2.0, NaN, 2.0 ]; 106 > {{alias}}.ndarray( x.length, 1, x, 1, 0 ) 107 ~2.0817 108 109 // Using offset parameter: 110 > var x = [ 1.0, -2.0, 3.0, 2.0, 5.0, -1.0 ]; 111 > var N = {{alias:@stdlib/math/base/special/floor}}( x.length / 2 ); 112 > {{alias}}.ndarray( N, 1, x, 2, 1 ) 113 ~2.0817 114 115 See Also 116 -------- 117