Skip to content

compute incrmean

kgryte edited this page May 12, 2015 · 1 revision

Returns a method to compute an arithmetic mean incrementally.

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

var mean = compute.incrmean(),
	mu;

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