commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Phil Steitz <p...@steitz.com>
Subject Re: [Math] Getter methods in Frequency when there is no data
Date Thu, 12 Aug 2004 00:35:32 GMT
Brent Worden wrote:
> I agree with returning zero for the absolute frequencies.
> 
> For the relative frequencies, I would argue for returning NaN as is done in BivariateRegression
when there is insufficient data.
> 
> Brent Worden

Sounds good to me. Will make that change
> 
> -----Original Message-----
> From: Phil Steitz [mailto:phil@steitz.com]
> Sent: Wednesday, August 11, 2004 3:45 PM
> To: Jakarta Commons Users List
> Subject: RE: [Math] Getter methods in Frequency when there is no data
> 
> 
> Thanks for reporting this.
>  
> I agree that getCumFreq should return 0, but the pct and cumPct are more problematic.
 One could argue that an IllegalStateException would be more appropriate for these.  If there
have been no values added, percentages don't really make sense.  Thoughts?
>  
> Phil
> 
> 	-----Original Message----- 
> 	From: Shing Hing Man [mailto:matmsh@yahoo.com] 
> 	Sent: Wed 8/11/2004 7:41 AM 
> 	To: commonMath 
> 	Cc: 
> 	Subject: [Math] Getter methods in Frequency when there is no data
> 	
> 	
> 
> 	Hi,
> 	  I have tested all the getter methods of
> 	 org.apache.commons.math.stat.univariate.Frequency
> 	when
> 	no data has been added. (If anyone is interested, the
> 	JUnit test file
> 	is attached.)
> 	Here is a summary of the result.
> 	
> 	Method                   Result
> 	getCount                 returns 0 (as expected)
> 	getCumFreq            
> 	java.util.NoSuchElementException
> 	getCumPct              
> 	java.util.NoSuchElementException
> 	getPct                   returns NaN 
> 	f.getSumFreq             return 0 (as expected)
> 	
> 	
> 	Is it reasonable to expect all the getter methods to
> 	return 0, when
> 	there is no data ?
> 	
> 	My  version of org.apache.commons.math  is dated 10th
> 	August, 2004.
> 	
> 	regards,
> 	Shing
> 	
> 	
> 	=====
> 	Home page :
> 	  http://uk.geocities.com/matmsh/index.html
> 	
> 	
> 	       
> 	       
> 	               
> 	___________________________________________________________ALL-NEW Yahoo! Messenger
- all new features - even more fun!  http://uk.messenger.yahoo.com
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> 


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


Mime
View raw message