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
@@ -70,17 +70,16 @@ where `s` is the sample [standard deviation][standard-deviation].
70
70
var dsemch =require( '@stdlib/stats/base/dsemch' );
71
71
```
72
72
73
-
#### dsemch( N, correction, x, stride )
73
+
#### dsemch( N, correction, x, strideX )
74
74
75
75
Computes the [standard error of the mean][standard-error] of a double-precision floating-point strided array `x` using a one-pass trial mean algorithm.
@@ -89,18 +88,16 @@ The function has the following parameters:
89
88
-**N**: number of indexed elements.
90
89
-**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).
The `N` and `stride` parameters determine which elements in `x` are accessed at runtime. For example, to compute the [standard error of the mean][standard-error] of every other element in `x`,
93
+
The `N` and stride parameters determine which elements in the strided array are accessed at runtime. For example, to compute the [standard error of the mean][standard-error] of every other element in `x`,
var x1 =newFloat64Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element
117
113
118
-
varN=floor( x0.length/2 );
119
-
120
-
var v =dsemch( N, 1, x1, 2 );
114
+
var v =dsemch( 4, 1, x1, 2 );
121
115
// returns 1.25
122
116
```
123
117
124
-
#### dsemch.ndarray( N, correction, x, stride, offset )
118
+
#### dsemch.ndarray( N, correction, x, strideX, offsetX )
125
119
126
120
Computes the [standard error of the mean][standard-error] of a double-precision floating-point strided array using a one-pass trial mean algorithm and alternative indexing semantics.
The function has the following additional parameters:
139
132
140
-
-**offset**: starting index for `x`.
133
+
-**offsetX**: starting index for `x`.
141
134
142
-
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 error of the mean][standard-error] for every other value in `x` starting from the second value
135
+
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 error of the mean][standard-error] for every other element in `x` starting from the second element
var discreteUniform =require( '@stdlib/random/array/discrete-uniform' );
181
170
var dsemch =require( '@stdlib/stats/base/dsemch' );
182
171
183
-
var x;
184
-
var i;
185
-
186
-
x =newFloat64Array( 10 );
187
-
for ( i =0; i <x.length; i++ ) {
188
-
x[ i ] =round( (randu()*100.0) -50.0 );
189
-
}
172
+
var x =discreteUniform( 10, -50, 50, {
173
+
'dtype':'float64'
174
+
});
190
175
console.log( x );
191
176
192
177
var v =dsemch( x.length, 1, x, 1 );
@@ -197,6 +182,125 @@ console.log( v );
197
182
198
183
<!-- /.examples -->
199
184
185
+
<!-- C interface documentation. -->
186
+
187
+
* * *
188
+
189
+
<sectionclass="c">
190
+
191
+
## C APIs
192
+
193
+
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
194
+
195
+
<sectionclass="intro">
196
+
197
+
</section>
198
+
199
+
<!-- /.intro -->
200
+
201
+
<!-- C usage documentation. -->
202
+
203
+
<sectionclass="usage">
204
+
205
+
### Usage
206
+
207
+
```c
208
+
#include"stdlib/stats/base/dsemch.h"
209
+
```
210
+
211
+
#### stdlib_strided_dsemch( N, correction, \*X, strideX )
212
+
213
+
Computes the [standard error of the mean][standard-error] of a double-precision floating-point strided array using a one-pass trial mean algorithm.
214
+
215
+
```c
216
+
constdouble x[] = { 1.0, -2.0, 2.0 };
217
+
218
+
double v = stdlib_strided_dsemch( 3, 1.0, x, 1 );
219
+
// returns ~1.20185
220
+
```
221
+
222
+
The function accepts the following arguments:
223
+
224
+
- **N**: `[in] CBLAS_INT` number of indexed elements.
225
+
- **correction**: `[in] double` 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).
226
+
- **X**: `[in] double*` input array.
227
+
- **strideX**: `[in] CBLAS_INT` stride length for `X`.
#### stdlib_strided_dsemch_ndarray( N, correction, \*X, strideX, offsetX )
234
+
235
+
Computes the [standard error of the mean][standard-error] of a double-precision floating-point strided array using a one-pass trial mean algorithm and alternative indexing semantics.
236
+
237
+
```c
238
+
constdouble x[] = { 1.0, -2.0, 2.0 };
239
+
240
+
double v = stdlib_strided_dsemch_ndarray( 3, 1.0, x, 1, 0 );
241
+
// returns ~1.20185
242
+
```
243
+
244
+
The function accepts the following arguments:
245
+
246
+
- **N**: `[in] CBLAS_INT` number of indexed elements.
247
+
- **correction**: `[in] double` 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).
248
+
- **X**: `[in] double*` input array.
249
+
- **strideX**: `[in] CBLAS_INT` stride length for `X`.
250
+
- **offsetX**: `[in] CBLAS_INT` starting index for `X`.
0 commit comments