end FUNCTION getBuffer() 
FUNCTION: onData( W )
Returns a callback which calculates a moving mean/variance and is invoked upon receiving new data.

@private
@param {number} W - window size
@returns {function} callback
function onData( W ) {
		var buffer = getBuffer( W ),
			full = false, oldVal,
			sos = 0, mean = 0, N = 0,
			delta = 0, old_delta = 0, new_delta = 0;

		/**
		* FUNCTION: onData( newVal )
		*	Data event handler. Calculates a moving mean/variance.
		*
		* @private
		* @param {number} newVal - new streamed data value
		*/
		return function onData( newVal ) {
			// Fill the buffer:
			if ( !full ) {
				buffer[ N ] = newVal;

				N += 1;
				delta = newVal - mean;
				mean += delta / N;

				// Sum of squared differences:
				sos += delta * ( newVal - mean );

				if ( N === W ) {
					full = true;
					this.queue( [ mean, sos/(N-1) ] );
				}
				return;
			} // end IF (!full)

			// Update our buffer:
			oldVal = buffer.shift();
			buffer.push( newVal );

			// Calculate the moving mean and variance:
			delta = newVal - oldVal;
			old_delta = oldVal - mean;
			mean += delta / W;
			new_delta = newVal - mean;
			sos += delta * ( old_delta + new_delta );

			// Queue the mean-variance pair:
			this.queue( [ mean, sos/(W-1) ] );
		}; // end FUNCTION onData()
	}