def update(existingAggregate, newValue):
    """
    Update the count, mean, and mean square.
    
    Welford's online algorithm for calculating variance.
    
    existingAggretate : tuple
        (count, mean, M2)
    newValue : float
        f(b1) - f(b2) for newest sample
    """
    (count, mean, M2) = existingAggregate
    count += 1 
    delta = newValue - mean
    mean += delta / count
    delta2 = newValue - mean
    M2 += delta * delta2
    sampleVariance = M2/(count - 1)
    return count, mean, M2, sampleVariance