Returns an accumulator function which incrementally computes a weighted arithmetic mean.
accumulator function
var accumulator = incrwmean();
var mu = accumulator();
// returns null
mu = accumulator( 2.0, 1.0 );
// returns 2.0
mu = accumulator( 2.0, 0.5 );
// returns 2.0
mu = accumulator( 3.0, 1.5 );
// returns 2.5
mu = accumulator();
// returns 2.5
If provided both arguments, returns an updated weighted arithmetic mean; otherwise, returns the current weighted arithmetic mean.
Notes
NaN
or a value which, when used in computations, results inNaN
, the accumulated value isNaN
for all future invocations.value
weight
weighted arithmetic mean