commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Phil Steitz" <p...@steitz.com>
Subject Re: [math] exceptions or NaN from Univariate
Date Wed, 14 May 2003 04:13:47 GMT
O'brien, Tim wrote:
> Univariate getMean(), getVariance(), and getStandardDeviation() all
> contain a note to throw an exception if n = 0.  It should be noted that
> getVariance() and getStandardDeviation() don't make sense until n = 2.
> 
> The mean of an empty set is not a number, and currently calling (new
> Univariate("blah")).getMean() returns NaN.  I'm just wondering if
> throwing an exception is worth the trouble?  Any thoughts?
>  
> Tim
>  
> 
On second thought, I agree with you.  You are correct that if we really 
want to throw something for "insufficient data" situations, we should 
require n >= 1 for the mean and either force n >= 2 for variance, std 
dev or modify these to return 0 if n < 2.  May not be worth the trouble.

Phil
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
> 




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


Mime
View raw message