commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Phil Steitz" <>
Subject Re: [math] exceptions or NaN from Univariate
Date Wed, 14 May 2003 13:29:40 GMT
Mark R. Diggory wrote:
> Phil Steitz wrote:
>> A useful extension to Univariate would be to support a "rolling" 
>> capability, as follows:
>> Add a property called something like "windowSize" and change the 
>> contract to mean that getMean(), getVariance, etc. always return 
>> statistics on values {n, n-1, ... n-windowSize+1}.  Have the default 
>> windowSize "infinity" (i.e., no restriction).  This would be useful in 
>> applications (e.g simulation monitors) that need to compute "rolling 
>> averages".
>> Obviously, we would want to do this without storing all of the values 
>> {n, n-1, ... n-windowSize+1}.
>> Phil
> Is there a strategy to do this without storing all the values of the 
> current window? if your just storing sum and sumsq, I'm not sure how you 
> would "back out" of the computation at the end of the window. Of course, 
> I may be missing something.

I have not actually implemented this, so of course *I* may be missing 
something, but is seems to me that you could just hold on to value 
number n-windowSize+1 and adjust the sums as new values get added. You 
would also have to hold onto some additional values for min, max to 
handle the case where the value being "rolled off" is the current min or 


> -Mark
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message