Skip to content

Commit 2f5cdab

Browse files
committed
Updated Readme.md
1 parent d73b2da commit 2f5cdab

File tree

1 file changed

+12
-14
lines changed
  • lib/node_modules/@stdlib/stats/incr/nanmvmr

1 file changed

+12
-14
lines changed

lib/node_modules/@stdlib/stats/incr/nanmvmr/README.md

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ limitations under the License.
1818
1919
-->
2020

21-
# incrmvmr
21+
# incrnanmvmr
2222

2323
> Compute a moving [variance-to-mean ratio][variance-to-mean-ratio] (VMR) incrementally.
2424
@@ -33,7 +33,7 @@ s^2 = \frac{1}{W-1} \sum_{i=0}^{W-1} ( x_i - \bar{x} )^2
3333
```
3434

3535
<!-- <div class="equation" align="center" data-raw-text="s^2 = \frac{1}{W-1} \sum_{i=0}^{W-1} ( x_i - \bar{x} )^2" data-equation="eq:unbiased_sample_variance">
36-
<img src="https://cdn.jsdelivr.net/gh/stdlib-js/stdlib@b331e5634fe726ff0e16e87814ac3f85d8164d31/lib/node_modules/@stdlib/stats/incr/mvmr/docs/img/equation_unbiased_sample_variance.svg" alt="Equation for the unbiased sample variance.">
36+
<img src="https://cdn.jsdelivr.net/gh/stdlib-js/stdlib@b331e5634fe726ff0e16e87814ac3f85d8164d31/lib/node_modules/@stdlib/stats/incr/nanmvmr/docs/img/equation_unbiased_sample_variance.svg" alt="Equation for the unbiased sample variance.">
3737
<br>
3838
</div> -->
3939

@@ -48,7 +48,7 @@ and the [arithmetic mean][arithmetic-mean] is defined as
4848
```
4949

5050
<!-- <div class="equation" align="center" data-raw-text="\bar{x} = \frac{1}{W} \sum_{i=0}^{W-1} x_i" data-equation="eq:arithmetic_mean">
51-
<img src="https://cdn.jsdelivr.net/gh/stdlib-js/stdlib@164b8f1010c4535340eed9ad0b2af32c4a19863c/lib/node_modules/@stdlib/stats/incr/mvmr/docs/img/equation_arithmetic_mean.svg" alt="Equation for the arithmetic mean.">
51+
<img src="https://cdn.jsdelivr.net/gh/stdlib-js/stdlib@164b8f1010c4535340eed9ad0b2af32c4a19863c/lib/node_modules/@stdlib/stats/incr/nanmvmr/docs/img/equation_arithmetic_mean.svg" alt="Equation for the arithmetic mean.">
5252
<br>
5353
</div> -->
5454

@@ -63,7 +63,7 @@ F = \frac{s^2}{\bar{x}}
6363
```
6464

6565
<!-- <div class="equation" align="center" data-raw-text="F = \frac{s^2}{\bar{x}}" data-equation="eq:variance_to_mean_ratio">
66-
<img src="https://cdn.jsdelivr.net/gh/stdlib-js/stdlib@b331e5634fe726ff0e16e87814ac3f85d8164d31/lib/node_modules/@stdlib/stats/incr/mvmr/docs/img/equation_variance_to_mean_ratio.svg" alt="Equation for the variance-to-mean ratio (VMR).">
66+
<img src="https://cdn.jsdelivr.net/gh/stdlib-js/stdlib@b331e5634fe726ff0e16e87814ac3f85d8164d31/lib/node_modules/@stdlib/stats/incr/nanmvmr/docs/img/equation_variance_to_mean_ratio.svg" alt="Equation for the variance-to-mean ratio (VMR).">
6767
<br>
6868
</div> -->
6969

@@ -78,29 +78,29 @@ F = \frac{s^2}{\bar{x}}
7878
## Usage
7979

8080
```javascript
81-
var incrmvmr = require( '@stdlib/stats/incr/mvmr' );
81+
var incrnanmvmr = require( '@stdlib/stats/incr/nanmvmr' );
8282
```
8383

84-
#### incrmvmr( window\[, mean] )
84+
#### incrnanmvmr( window\[, mean] )
8585

8686
Returns an accumulator `function` which incrementally computes a moving [variance-to-mean ratio][variance-to-mean-ratio]. The `window` parameter defines the number of values over which to compute the moving [variance-to-mean ratio][variance-to-mean-ratio].
8787

8888
```javascript
89-
var accumulator = incrmvmr( 3 );
89+
var accumulator = incrnanmvmr( 3 );
9090
```
9191

9292
If the mean is already known, provide a `mean` argument.
9393

9494
```javascript
95-
var accumulator = incrmvmr( 3, 5.0 );
95+
var accumulator = incrnanmvmr( 3, 5.0 );
9696
```
9797

9898
#### accumulator( \[x] )
9999

100100
If provided an input value `x`, the accumulator function returns an updated accumulated value. If not provided an input value `x`, the accumulator function returns the current accumulated value.
101101

102102
```javascript
103-
var accumulator = incrmvmr( 3 );
103+
var accumulator = incrnanmvmr( 3 );
104104

105105
var F = accumulator();
106106
// returns null
@@ -134,8 +134,6 @@ F = accumulator();
134134

135135
## Notes
136136

137-
- Input values are **not** type checked. If provided `NaN` or a value which, when used in computations, results in `NaN`, the accumulated value is `NaN` for **at least** `W-1` future invocations. If non-numeric inputs are possible, you are advised to type check and handle accordingly **before** passing the value to the accumulator function.
138-
139137
- 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.
140138

141139
- The following table summarizes how to interpret the [variance-to-mean ratio][variance-to-mean-ratio]:
@@ -165,18 +163,18 @@ F = accumulator();
165163

166164
```javascript
167165
var randu = require( '@stdlib/random/base/randu' );
168-
var incrmvmr = require( '@stdlib/stats/incr/mvmr' );
166+
var incrnanmvmr = require( '@stdlib/stats/incr/nanmvmr' );
169167

170168
var accumulator;
171169
var v;
172170
var i;
173171

174172
// Initialize an accumulator:
175-
accumulator = incrmvmr( 5 );
173+
accumulator = incrnanmvmr( 5 );
176174

177175
// For each simulated datum, update the moving variance-to-mean ratio...
178176
for ( i = 0; i < 100; i++ ) {
179-
v = randu() * 100.0;
177+
v = randu()> 0.2 ? NaN : randu() * 100.0;
180178
accumulator( v );
181179
}
182180
console.log( accumulator() );

0 commit comments

Comments
 (0)