You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: lib/node_modules/@stdlib/stats/base/stdevyc/README.md
+16-25Lines changed: 16 additions & 25 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -98,7 +98,7 @@ The use of the term `n-1` is commonly referred to as Bessel's correction. Note,
98
98
var stdevyc =require( '@stdlib/stats/base/stdevyc' );
99
99
```
100
100
101
-
#### stdevyc( N, correction, x, stride )
101
+
#### stdevyc( N, correction, x, strideX )
102
102
103
103
Computes the [standard deviation][standard-deviation] of a strided array `x` using a one-pass algorithm proposed by Youngs and Cramer.
104
104
@@ -114,17 +114,15 @@ The function has the following parameters:
114
114
-**N**: number of indexed elements.
115
115
-**correction**: degrees of freedom adjustment. Setting this parameter to a value other than `0` has the effect of adjusting the divisor during the calculation of the [standard deviation][standard-deviation] according to `N-c` where `c` corresponds to the provided degrees of freedom adjustment. When computing the [standard deviation][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][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).
116
116
-**x**: input [`Array`][mdn-array] or [`typed array`][mdn-typed-array].
117
-
-**stride**: index increment for `x`.
117
+
-**strideX**: stride length for `x`.
118
118
119
-
The `N` and `stride` parameters determine which elements in `x` are accessed at runtime. For example, to compute the [standard deviation][standard-deviation] of every other element in `x`,
119
+
The `N` and stride parameters determine which elements in the strided array are accessed at runtime. For example, to compute the [standard deviation][standard-deviation] of every other element in `x`,
120
120
121
121
```javascript
122
-
var floor =require( '@stdlib/math/base/special/floor' );
123
122
124
123
var x = [ 1.0, 2.0, 2.0, -7.0, -2.0, 3.0, 4.0, 2.0 ];
125
-
varN=floor( x.length/2 );
126
124
127
-
var v =stdevyc( N, 1, x, 2 );
125
+
var v =stdevyc( 4, 1, x, 2 );
128
126
// returns 2.5
129
127
```
130
128
@@ -134,18 +132,16 @@ Note that indexing is relative to the first index. To introduce an offset, use [
var x1 =newFloat64Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element
141
138
142
-
varN=floor( x0.length/2 );
143
139
144
-
var v =stdevyc( N, 1, x1, 2 );
140
+
var v =stdevyc( 4, 1, x1, 2 );
145
141
// returns 2.5
146
142
```
147
143
148
-
#### stdevyc.ndarray( N, correction, x, stride, offset )
144
+
#### stdevyc.ndarray( N, correction, x, strideX , offsetX )
149
145
150
146
Computes the [standard deviation][standard-deviation] of a strided array using a one-pass algorithm proposed by Youngs and Cramer and alternative indexing semantics.
151
147
@@ -158,17 +154,15 @@ var v = stdevyc.ndarray( x.length, 1, x, 1, 0 );
158
154
159
155
The function has the following additional parameters:
160
156
161
-
-**offset**: starting index for `x`.
157
+
-**offsetX**: starting index for `x`.
162
158
163
-
While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying `buffer`, the `offset` parameter supports indexing semantics based on a starting index. For example, to calculate the [standard deviation][standard-deviation] for every other value in `x`starting from the second value
159
+
While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying buffer, the offset parameter supports indexing semantics based on a starting index. For example, to calculate the [standard deviation][standard-deviation] for every other element in the strided array starting from the second element
164
160
165
161
```javascript
166
-
var floor =require( '@stdlib/math/base/special/floor' );
167
162
168
163
var x = [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0 ];
169
-
varN=floor( x.length/2 );
170
164
171
-
var v =stdevyc.ndarray( N, 1, x, 2, 1 );
165
+
var v =stdevyc.ndarray( 4, 1, x, 2, 1 );
172
166
// returns 2.5
173
167
```
174
168
@@ -181,6 +175,7 @@ var v = stdevyc.ndarray( N, 1, x, 2, 1 );
181
175
## Notes
182
176
183
177
- If `N <= 0`, both functions return `NaN`.
178
+
- Both functions support array-like objects having getter and setter accessors for array element access (e.g., [`@stdlib/array/base/accessor`][@stdlib/array/base/accessor]).
184
179
- If `N - c` is less than or equal to `0` (where `c` corresponds to the provided degrees of freedom adjustment), both functions return `NaN`.
185
180
- Depending on the environment, the typed versions ([`dstdevyc`][@stdlib/stats/base/dstdevyc], [`sstdevyc`][@stdlib/stats/base/sstdevyc], etc.) are likely to be significantly more performant.
186
181
@@ -195,18 +190,12 @@ var v = stdevyc.ndarray( N, 1, x, 2, 1 );
195
190
<!-- eslint no-undef: "error" -->
196
191
197
192
```javascript
198
-
var randu =require( '@stdlib/random/base/randu' );
199
-
var round =require( '@stdlib/math/base/special/round' );
0 commit comments