in reply to Average over time

If you want to create a uniform moving average with all elements equal weight, I do not see how you cannot keep all the information to compute the average -- it needs to be there by definition.

But if you are willing to relax the uniformity requirement, it is easily to do something real time. Consider the recursive estimate for the time between emails

avg( i ) = (1-k)*(t[i] - t[i-1]) + k*avg( i-1 ) k < 1
where t[i]-t[i-1] is the time interval between the current and previous email and k is a wieghting coefficient. This expression only needs the most recent interval and average to compute the current average.

For k < 1, the previous elements will be exponentially weighted k**n for avg(i-n) and k is adjusted to vary the aproximate number of events averaged in.

From the average interval between emails, you can easily derive the emails per time:

rate[i] = 1/avg[i];
Update: corrected first equation.

-Mark