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/variancewd/README.md
+11-14Lines changed: 11 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -116,15 +116,12 @@ The function has the following parameters:
116
116
-**x**: input [`Array`][mdn-array] or [`typed array`][mdn-typed-array].
117
117
-**strideX**: stride length for `x`.
118
118
119
-
The `N` and `strideX` 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 strideX parameters determine which elements in the strided array are accessed at runtime. For example, to compute the minimum value 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
-
127
-
var v =variancewd( N, 1, x, 2 );
124
+
var v =variancewd( 4, 1, x, 2 );
128
125
// returns 6.25
129
126
```
130
127
@@ -134,18 +131,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
137
142
-
varN=floor( x0.length/2 );
143
138
144
-
var v =variancewd( N, 1, x1, 2 );
139
+
var v =variancewd( 4, 1, x1, 2 );
145
140
// returns 6.25
146
141
```
147
142
148
-
#### variancewd.ndarray( N, correction, x, strideX, offset )
143
+
#### variancewd.ndarray( N, correction, x, strideX, offsetX )
149
144
150
145
Computes the [variance][variance] of a strided array using Welford's algorithm and alternative indexing semantics.
151
146
@@ -160,15 +155,13 @@ The function has the following additional parameters:
160
155
161
156
-**offset**: starting index for `x`.
162
157
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
158
+
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 element in the strided array starting from the second element
164
159
165
160
```javascript
166
-
var floor =require( '@stdlib/math/base/special/floor' );
167
161
168
162
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
163
171
-
var v =variancewd.ndarray( N, 1, x, 2, 1 );
164
+
var v =variancewd.ndarray( 4, 1, x, 2, 1 );
172
165
// returns 6.25
173
166
```
174
167
@@ -181,6 +174,7 @@ var v = variancewd.ndarray( N, 1, x, 2, 1 );
181
174
## Notes
182
175
183
176
- If `N <= 0`, both functions return `NaN`.
177
+
- 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
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 ([`dvariancewd`][@stdlib/stats/base/dvariancewd], [`svariancewd`][@stdlib/stats/base/svariancewd], etc.) are likely to be significantly more performant.
186
180
@@ -199,7 +193,7 @@ var discreteUniform = require( '@stdlib/random/array/discrete-uniform' );
199
193
var variancewd =require( '@stdlib/stats/base/variancewd' );
200
194
201
195
var x =discreteUniform( 10, -50, 50, {
202
-
'dtype':'float64'
196
+
y'dtype':'float64'
203
197
});
204
198
console.log( x );
205
199
@@ -233,6 +227,7 @@ console.log( v );
233
227
## See Also
234
228
235
229
- <spanclass="package-name">[`@stdlib/stats/base/dvariancewd`][@stdlib/stats/base/dvariancewd]</span><spanclass="delimiter">: </span><spanclass="description">calculate the variance of a double-precision floating-point strided array using Welford's algorithm.</span>
230
+
- <spanclass="package-name">[`@stdlib/stats/base/nanvariancewd`][@stdlib/stats/base/nanvariancewd]</span><spanclass="delimiter">: </span><spanclass="description">calculate the variance of a strided array ignoring NaN values and using Welford's algorithm.</span>
236
231
- <spanclass="package-name">[`@stdlib/stats/base/stdevwd`][@stdlib/stats/base/stdevwd]</span><spanclass="delimiter">: </span><spanclass="description">calculate the standard deviation of a strided array using Welford's algorithm.</span>
237
232
- <spanclass="package-name">[`@stdlib/stats/base/variance`][@stdlib/stats/base/variance]</span><spanclass="delimiter">: </span><spanclass="description">calculate the variance of a strided array.</span>
0 commit comments