Skip to content

compute incrmvariance

kgryte edited this page May 12, 2015 · 1 revision

Returns a method to compute a moving sample variance incrementally. window sets the window size, i.e., the number of values over which to compute a moving sample variance.

var data = [ 2, 4, 2, 7, 3 ];

var mvariance = compute.incrmvariance( 3 ),
	s2;

for ( var i = 0; i < data.length; i++ ) {
	s2 = mvariance( data[ i ] );
	console.log( s2 );
}
console.log( mvariance() );
Clone this wiki locally