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
If provided an input value `x`, the accumulator function returns an updated [corrected sample standard deviation][standard-deviation]. If not provided an input value `x`, the accumulator function returns the current [corrected sample standard deviation][standard-deviation]. If provided `NaN`, the accumulator function ignores the value and returns the current [corrected sample standard deviation][standard-deviation].
70
+
If provided an input value `x`, the accumulator function returns an updated [corrected sample standard deviation][standard-deviation]. If not provided an input value `x`, the accumulator function returns the current [corrected sample standard deviation][standard-deviation]. If provided `NaN`, the accumulator function ignores the value and returns the current [corrected sample standard deviation][standard-deviation] without updating the window.
71
71
72
72
```javascript
73
73
var accumulator =incrnanmstdev( 3 );
74
74
75
75
var s =accumulator();
76
76
// returns null
77
77
78
-
// Fill the window...
78
+
// Fill the window with non-NaN values...
79
79
s =accumulator( 2.0 ); // [2.0]
80
80
// returns 0.0
81
81
82
-
s =accumulator( NaN ); // [2.0, NaN]
82
+
s =accumulator( NaN ); // [2.0]
83
83
// returns 0.0
84
84
85
-
s =accumulator( 3.0 ); // [2.0, NaN, 3.0]
85
+
s =accumulator( 3.0 ); // [2.0, 3.0]
86
86
// returns ~0.7071
87
87
88
+
s =accumulator( 5.0 ); // [2.0, 3.0, 5.0]
89
+
// returns ~1.53
90
+
88
91
// Window begins sliding...
89
-
s =accumulator( -7.0 ); // [NaN, 3.0, -7.0]
90
-
// returns ~7.07
92
+
s =accumulator( -7.0 ); // [3.0, 5.0, -7.0]
93
+
// returns ~6.43
94
+
95
+
s =accumulator( NaN ); // [3.0, 5.0, -7.0]
96
+
// returns ~6.43
91
97
92
-
s =accumulator( -5.0 ); // [3.0, -7.0, -5.0]
93
-
// returns ~5.29
98
+
s =accumulator( -5.0 ); // [5.0, -7.0, -5.0]
99
+
// returns ~6.43
94
100
95
101
s =accumulator();
96
-
// returns ~5.29
102
+
// returns ~6.43
97
103
```
98
104
99
105
</section>
@@ -104,7 +110,7 @@ s = accumulator();
104
110
105
111
## Notes
106
112
107
-
- Input values are **not** type checked. If provided `NaN`, the value is ignored and the accumulator function returns the current [corrected sample standard deviation][standard-deviation]. If non-numeric inputs are possible, you are advised to type check and handle accordingly **before** passing the value to the accumulator function.
113
+
- Input values are **not** type checked. If provided `NaN`, the value is ignored and the accumulator function returns the current [corrected sample standard deviation][standard-deviation] without updating the window. If non-numeric inputs are possible, you are advised to type check and handle accordingly **before** passing the value to the accumulator function.
108
114
- As `W` values are needed to fill the window buffer, the first `W-1` returned values are calculated from smaller sample sizes. Until the window is full, each returned value is calculated from all provided values (excluding NaN values).
109
115
110
116
</section>
@@ -153,7 +159,7 @@ console.log( accumulator() );
153
159
## See Also
154
160
155
161
- <spanclass="package-name">[`@stdlib/stats/incr/mstdev`][@stdlib/stats/incr/mstdev]</span><spanclass="delimiter">: </span><spanclass="description">compute a moving corrected sample standard deviation incrementally.</span>
156
-
- <spanclass="package-name">[`@stdlib/stats/incr/nanmmean`][@stdlib/stats/incr/nanmmean]</span><spanclass="delimiter">: </span><spanclass="description">compute a moving arietic mean incrementally, iging NaN values.</span>
162
+
- <spanclass="package-name">[`@stdlib/stats/incr/mmean`][@stdlib/stats/incr/mmean]</span><spanclass="delimiter">: </span><spanclass="description">compute a moving arietic mean incrementally, iging NaN values.</span>
157
163
- <spanclass="package-name">[`@stdlib/stats/incr/msummary`][@stdlib/stats/incr/msummary]</span><spanclass="delimiter">: </span><spanclass="description">compute a moving statistical summary incrementally, ignoring NaN values.</span>
158
164
- <spanclass="package-name">[`@stdlib/stats/incr/mvariance`][@stdlib/stats/incr/mvariance]</span><spanclass="delimiter">: </span><spanclass="description">compute a moving unbiased sample variance incrementally, ignoring NaN values.</span>
159
165
- <spanclass="package-name">[`@stdlib/stats/incr/stdev`][@stdlib/stats/incr/stdev]</span><spanclass="delimiter">: </span><spanclass="description">compute a corrected sample standard deviation incrementally, ignoring NaN values.</span>
Copy file name to clipboardExpand all lines: lib/node_modules/@stdlib/stats/incr/nanmstdev/docs/types/index.d.ts
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -37,7 +37,7 @@ type accumulator = ( x?: number ) => number | null;
37
37
*
38
38
* ## Notes
39
39
*
40
-
* - The `W` parameter defines the number of values over which to compute the moving sum.
40
+
* - The `W` parameter defines the number of values over which to compute the moving corrected sample standard deviation.
41
41
* - As `W` values are needed to fill the window buffer, the first `W-1` returned values are calculated from smaller sample sizes. Until the window is full, each returned value is calculated from all provided values.
@@ -141,15 +141,24 @@ function incrnanmstdev( W, mean ) {
141
141
}else{
142
142
acc=incrmstdev(W);
143
143
}
144
-
returnfunctionaccumulator(x){
144
+
returnaccumulator;
145
+
146
+
/**
147
+
* If provided a value, the accumulator function returns an updated standard deviation. If not provided a value, the accumulator function returns the current standard deviation.
148
+
*
149
+
* @private
150
+
* @param {number} [x] - new value
151
+
* @returns {(number|null)} standard deviation or null
0 commit comments