File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed
lib/node_modules/@stdlib/stats/incr/nanvariance/test Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -87,9 +87,13 @@ tape( 'the accumulator function incrementally computes an unbiased sample varian
8787 NaN ,
8888 5.0
8989 ] ;
90+
9091 // Non-NaN data: [2.0, 3.0, 4.0, 5.0]
92+
9193 // Sum: 14.0
94+
9295 // Mean: 3.5
96+
9397 // Variance: 1.666...
9498
9599 expected = [
@@ -104,7 +108,10 @@ tape( 'the accumulator function incrementally computes an unbiased sample varian
104108
105109 acc = incrnanvariance ( ) ;
106110
107- actual = new Array ( data . length + 1 ) ;
111+ var actual = [ ] ;
112+ for ( i = 0 ; i < data . length + 1 ; i ++ ) {
113+ actual . push ( null ) ;
114+ }
108115 actual [ 0 ] = acc ( ) ;
109116 for ( i = 0 ; i < data . length ; i ++ ) {
110117 actual [ i + 1 ] = acc ( data [ i ] ) ;
@@ -136,11 +143,17 @@ tape( 'the accumulator function incrementally computes an unbiased sample varian
136143 NaN ,
137144 5.0
138145 ] ;
146+
139147 // Non-NaN data: [2.0, 3.0, 4.0, 5.0]
148+
140149 // Mean: 3.5
150+
141151 // Deviation: [-1.5, -0.5, 0.5, 1.5]
152+
142153 // Squared deviation: [2.25, 0.25, 0.25, 2.25]
154+
143155 // Sum of squared deviations: 5.0
156+
144157 // Variance: 1.25
145158
146159 expected = [
You can’t perform that action at this time.
0 commit comments