You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Albretch Mueller <lb...@gmail.com> on 2008/06/08 13:34:37 UTC

commons.apache.org/math/stat/

 as part of

 http://commons.apache.org/math/

 you have:

 http://commons.apache.org/math/apidocs/org/apache/commons/math/stat/descriptive/DescriptiveStatistics.html#addValue(double)

 however I don't see something like:

 addValue(new_val, NoV, Mean, Std_Dev, Skew)

 in order to get the new statistics based on the old one?

 It is very easy to do the Math to calculate the new Mean, Std_Dev and
Skew, based on the old values for a certain new value

 Why doesn't http://commons.apache.org/math/stat/ give you that?

 Thanks
 lbrtchx

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Re: commons.apache.org/math/stat/

Posted by Phil Steitz <ph...@steitz.com>.
Albretch Mueller wrote:
>> Anyone else have ideas on how best to do this?
>>     
> ~
>  IMHO this is so simple that I would doubt there is a "best" way to do it ;-).
>   
What I meant was the best way to define the API.  There are also 
numerical considerations. 

In the commons math descriptive statistics package, we have two kinds of 
univariate statistics - those that "store" associated data values, and 
those that do not.  The DescriptiveStatistics class aggregates 
statistics based on a "stored" dataset (so should not be used for very 
large datasets, unless "rolling" statistics are desired).  The class to 
look at to design updating functions like you are suggesting is 
SummaryStatistics, which does not store data values, but updates 
internal sums, etc.  The updating formulas for moment statistics (mean, 
variance, skewness) are not naive, so the util functions that you are 
proposing would have to be coded with care so that results would match; 
or at least be documented appropriately.

>  you are the ones that know well/own the underlying data structures and logic
> ~
>  If you take a close look at:
> ~
> http://en.wikipedia.org/wiki/Mean 
> http://en.wikipedia.org/wiki/Standard_deviation
> http://en.wikipedia.org/wiki/Skewness
> ~
>  You will see that, since these are essentially summations and their
> exponentiations, you could derive the relationship of the new stat
> values based on:
> ~
>  1) the old stat ones,
>  2) the count of how many have been computed so far, and
>  3) the new entry
> ~
>  I must run out of my place right now. If no one has done so when I
> come back (within 2 hours) I will digest to
> you/user@commons.apache.org the math, propose some pseudo code along
> with some basic java code on how to do that.
>   
Thanks!

Its probably best to take the discussion to the dev list.

Phil
 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Re: commons.apache.org/math/stat/

Posted by Albretch Mueller <lb...@gmail.com>.
> Anyone else have ideas on how best to do this?
~
 IMHO this is so simple that I would doubt there is a "best" way to do it ;-).
~
 you are the ones that know well/own the underlying data structures and logic
~
 If you take a close look at:
~
http://en.wikipedia.org/wiki/Mean
http://en.wikipedia.org/wiki/Standard_deviation
http://en.wikipedia.org/wiki/Skewness
~
 You will see that, since these are essentially summations and their
exponentiations, you could derive the relationship of the new stat
values based on:
~
 1) the old stat ones,
 2) the count of how many have been computed so far, and
 3) the new entry
~
 I must run out of my place right now. If no one has done so when I
come back (within 2 hours) I will digest to
you/user@commons.apache.org the math, propose some pseudo code along
with some basic java code on how to do that.
~
 lbrtchx
~
On Sun, Jun 8, 2008 at 8:56 AM, Phil Steitz <ph...@steitz.com> wrote:
> Albretch Mueller wrote:
>>
>>  as part of
>>
>>  http://commons.apache.org/math/
>>
>>  you have:
>>
>>
>>  http://commons.apache.org/math/apidocs/org/apache/commons/math/stat/descriptive/DescriptiveStatistics.html#addValue(double)
>>
>>  however I don't see something like:
>>
>>  addValue(new_val, NoV, Mean, Std_Dev, Skew)
>>
>>  in order to get the new statistics based on the old one?
>>
>>  It is very easy to do the Math to calculate the new Mean, Std_Dev and
>> Skew, based on the old values for a certain new value
>>
>>  Why doesn't http://commons.apache.org/math/stat/ give you that?
>>
>
> No reason, other than that no one has suggested this.  Patches are always
> welcome.  I am not sure what the best API would be for this enhancement, but
> it would probably belong in the StatUtils class.  Anyone else have ideas on
> how best to do this?
>
> Phil
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Re: commons.apache.org/math/stat/

Posted by Phil Steitz <ph...@steitz.com>.
Albretch Mueller wrote:
>  as part of
>
>  http://commons.apache.org/math/
>
>  you have:
>
>  http://commons.apache.org/math/apidocs/org/apache/commons/math/stat/descriptive/DescriptiveStatistics.html#addValue(double)
>
>  however I don't see something like:
>
>  addValue(new_val, NoV, Mean, Std_Dev, Skew)
>
>  in order to get the new statistics based on the old one?
>
>  It is very easy to do the Math to calculate the new Mean, Std_Dev and
> Skew, based on the old values for a certain new value
>
>  Why doesn't http://commons.apache.org/math/stat/ give you that?
>   
No reason, other than that no one has suggested this.  Patches are 
always welcome.  I am not sure what the best API would be for this 
enhancement, but it would probably belong in the StatUtils class.  
Anyone else have ideas on how best to do this?

Phil


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org