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/varianceyc/README.md
+16-24
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 varianceyc =require( '@stdlib/stats/base/varianceyc' );
99
99
```
100
100
101
-
#### varianceyc( N, correction, x, stride )
101
+
#### varianceyc( N, correction, x, strideX )
102
102
103
103
Computes the [variance][variance] of a strided array `x` using a one-pass algorithm proposed by Youngs and Cramer.
104
104
@@ -114,17 +114,16 @@ 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 [variance][variance] according to `N-c` where `c` corresponds to the provided degrees of freedom adjustment. When computing the [variance][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][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).
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 [variance][variance] 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 [variance][variance] of every other element in `x`,
120
120
121
121
```javascript
122
122
var floor =require( '@stdlib/math/base/special/floor' );
123
123
124
124
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
125
127
-
var v =varianceyc( N, 1, x, 2 );
126
+
var v =varianceyc( 4, 1, x, 2 );
128
127
// returns 6.25
129
128
```
130
129
@@ -139,13 +138,11 @@ var floor = require( '@stdlib/math/base/special/floor' );
var x1 =newFloat64Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element
141
140
142
-
varN=floor( x0.length/2 );
143
-
144
-
var v =varianceyc( N, 1, x1, 2 );
141
+
var v =varianceyc( 4, 1, x1, 2 );
145
142
// returns 6.25
146
143
```
147
144
148
-
#### varianceyc.ndarray( N, correction, x, stride, offset )
145
+
#### varianceyc.ndarray( N, correction, x, strideX, offsetX )
149
146
150
147
Computes the [variance][variance] of a strided array using a one-pass algorithm proposed by Youngs and Cramer and alternative indexing semantics.
151
148
@@ -158,17 +155,14 @@ var v = varianceyc.ndarray( x.length, 1, x, 1, 0 );
158
155
159
156
The function has the following additional parameters:
160
157
161
-
-**offset**: starting index for `x`.
158
+
-**offsetX**: starting index for `x`.
162
159
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 [variance][variance] for every other value in `x` starting from the second value
160
+
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 [variance][variance] for every other value in `x` starting from the second value
164
161
165
162
```javascript
166
-
var floor =require( '@stdlib/math/base/special/floor' );
167
-
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 =varianceyc.ndarray( N, 1, x, 2, 1 );
165
+
var v =varianceyc.ndarray( 4, 1, x, 2, 1 );
172
166
// returns 6.25
173
167
```
174
168
@@ -183,6 +177,7 @@ var v = varianceyc.ndarray( N, 1, x, 2, 1 );
183
177
- If `N <= 0`, both functions return `NaN`.
184
178
- 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
179
- Depending on the environment, the typed versions ([`dvarianceyc`][@stdlib/stats/base/dvarianceyc], [`svarianceyc`][@stdlib/stats/base/svarianceyc], etc.) are likely to be significantly more performant.
180
+
- 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]).
186
181
187
182
</section>
188
183
@@ -195,18 +190,13 @@ var v = varianceyc.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' );
193
+
var uniform =require( '@stdlib/random/array/uniform' );
0 commit comments