You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by to...@apache.org on 2004/05/23 02:56:15 UTC

cvs commit: jakarta-commons/math/src/test/org/apache/commons/math/stat StatUtilsTest.java

tobrien     2004/05/22 17:56:15

  Modified:    math/src/test/org/apache/commons/math/stat/univariate
                        StoreUnivariateImplTest.java
                        MixedListUnivariateImplTest.java
                        ListUnivariateImplTest.java
                        DescriptiveStatisticsTest.java
               math/src/java/org/apache/commons/math/stat/univariate
                        AbstractDescriptiveStatistics.java
                        DescriptiveStatistics.java
               math/src/test/org/apache/commons/math/stat
                        StatUtilsTest.java
  Log:
  Pre Issue 29012, getKurtosisClass() did not have a tolerance; therefore,
  any non-zero kurtosis was consistently mesokurtic.  Instead of getting 
  into this level of detail, getKurtosisClass() has been removed, it is a
  subjective measure not appropriate for DescStat.
  
  Revision  Changes    Path
  1.2       +1 -2      jakarta-commons/math/src/test/org/apache/commons/math/stat/univariate/StoreUnivariateImplTest.java
  
  Index: StoreUnivariateImplTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/math/src/test/org/apache/commons/math/stat/univariate/StoreUnivariateImplTest.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- StoreUnivariateImplTest.java	12 Apr 2004 02:27:50 -0000	1.1
  +++ StoreUnivariateImplTest.java	23 May 2004 00:56:15 -0000	1.2
  @@ -42,7 +42,6 @@
       private double max = 3;
       private double skewness = 0;
       private double kurtosis = 0.5;
  -    private int kClass = DescriptiveStatistics.LEPTOKURTIC;
       private double tolerance = 10E-15;
       
       public StoreUnivariateImplTest(String name) {
  
  
  
  1.2       +1 -2      jakarta-commons/math/src/test/org/apache/commons/math/stat/univariate/MixedListUnivariateImplTest.java
  
  Index: MixedListUnivariateImplTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/math/src/test/org/apache/commons/math/stat/univariate/MixedListUnivariateImplTest.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- MixedListUnivariateImplTest.java	12 Apr 2004 02:27:50 -0000	1.1
  +++ MixedListUnivariateImplTest.java	23 May 2004 00:56:15 -0000	1.2
  @@ -45,7 +45,6 @@
       private double max = 3;
       private double skewness = 0;
       private double kurtosis = 0.5;
  -    private int kClass = DescriptiveStatistics.LEPTOKURTIC;
       private double tolerance = 10E-15;
   
       private TransformerMap transformers = new TransformerMap();
  
  
  
  1.2       +1 -2      jakarta-commons/math/src/test/org/apache/commons/math/stat/univariate/ListUnivariateImplTest.java
  
  Index: ListUnivariateImplTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/math/src/test/org/apache/commons/math/stat/univariate/ListUnivariateImplTest.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ListUnivariateImplTest.java	12 Apr 2004 02:27:50 -0000	1.1
  +++ ListUnivariateImplTest.java	23 May 2004 00:56:15 -0000	1.2
  @@ -43,7 +43,6 @@
       private double max = 3;
       private double skewness = 0;
       private double kurtosis = 0.5;
  -    private int kClass = DescriptiveStatistics.LEPTOKURTIC;
       private double tolerance = 10E-15;
       
       public ListUnivariateImplTest(String name) {
  
  
  
  1.6       +1 -27     jakarta-commons/math/src/test/org/apache/commons/math/stat/univariate/DescriptiveStatisticsTest.java
  
  Index: DescriptiveStatisticsTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/math/src/test/org/apache/commons/math/stat/univariate/DescriptiveStatisticsTest.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- DescriptiveStatisticsTest.java	23 May 2004 00:30:01 -0000	1.5
  +++ DescriptiveStatisticsTest.java	23 May 2004 00:56:15 -0000	1.6
  @@ -43,7 +43,6 @@
       private double max = 3;
       private double skewness = 0;
       private double kurtosis = 0.5;
  -    private int kClass = DescriptiveStatistics.LEPTOKURTIC;
       private double tolerance = 10E-15;
       
       public DescriptiveStatisticsTest(String name) {
  @@ -408,30 +407,5 @@
           assertEquals(3.0, u.getMean(), tolerance);
       }
       
  -    public void testKurtosisClass() {
  -        DescriptiveStatistics u = DescriptiveStatistics.newInstance();
  -        u.setWindowSize(5);
  -        
  -        u.addValue(1.0);
  -        u.addValue(1.0);
  -        u.addValue(2.0);
  -        u.addValue(1.0);
  -        u.addValue(1.0);
  -        assertEquals(DescriptiveStatistics.LEPTOKURTIC, u.getKurtosisClass());
  -        
  -        u.addValue(1.0);
  -        u.addValue(2.0);
  -        u.addValue(2.0);
  -        u.addValue(2.0);
  -        u.addValue(1.0);
  -        assertEquals(DescriptiveStatistics.PLATYKURTIC, u.getKurtosisClass());
  -//        
  -//        u.addValue(1.0);
  -//        u.addValue(1.5);
  -//        u.addValue(2.0912994180548905);
  -//        u.addValue(1.5);
  -//        u.addValue(1.0);
  -//        assertEquals(DescriptiveStatistics.MESOKURTIC, u.getKurtosisClass());
  -    }
   }
   
  
  
  
  1.3       +1 -16     jakarta-commons/math/src/java/org/apache/commons/math/stat/univariate/AbstractDescriptiveStatistics.java
  
  Index: AbstractDescriptiveStatistics.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/math/src/java/org/apache/commons/math/stat/univariate/AbstractDescriptiveStatistics.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- AbstractDescriptiveStatistics.java	3 May 2004 14:32:25 -0000	1.2
  +++ AbstractDescriptiveStatistics.java	23 May 2004 00:56:15 -0000	1.3
  @@ -101,21 +101,6 @@
       }
   
       /**
  -     * @see org.apache.commons.math.stat.univariate.DescriptiveStatistics#getKurtosisClass()
  -     */
  -    public int getKurtosisClass() {
  -    	int kClass = MESOKURTIC;
  -
  -    	double kurtosis = getKurtosis();
  -    	if (kurtosis > 0) {
  -    		kClass = LEPTOKURTIC;
  -    	} else if (kurtosis < 0) {
  -    		kClass = PLATYKURTIC;
  -    	}
  -    	return (kClass);
  -    }
  -
  -    /**
        * @see org.apache.commons.math.stat.univariate.DescriptiveStatistics#getMax()
        */
       public double getMax() {
  
  
  
  1.5       +1 -25     jakarta-commons/math/src/java/org/apache/commons/math/stat/univariate/DescriptiveStatistics.java
  
  Index: DescriptiveStatistics.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/math/src/java/org/apache/commons/math/stat/univariate/DescriptiveStatistics.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- DescriptiveStatistics.java	19 May 2004 14:16:31 -0000	1.4
  +++ DescriptiveStatistics.java	23 May 2004 00:56:15 -0000	1.5
  @@ -84,19 +84,6 @@
   	public static final int INFINITE_WINDOW = -1;
   
   	/**
  -	 * A LEPTOKURTIC set has a positive kurtosis (a high peak) 
  -	 */
  -	public static int LEPTOKURTIC = 1;
  -	/**
  -	 * A MESOKURTIC set has a kurtosis of 0 - it is a normal distribution
  -	 */
  -	public static int MESOKURTIC = 0;
  -	/**
  -	 * A PLATYKURTIC set has a negative kurtosis (a flat "peak")
  -	 */
  -	public static int PLATYKURTIC = -1;
  -
  -	/**
   	 * Adds the value to the set of numbers
   	 * @param v the value to be added 
   	 */
  @@ -147,17 +134,6 @@
   	 */
   	public abstract double getKurtosis();
   
  -	/**
  -	 * Returns the Kurtosis "classification" a distribution can be 
  -	 * leptokurtic (high peak), platykurtic (flat peak), 
  -	 * or mesokurtic (zero kurtosis).  
  -	 * 
  -	 * @return A static constant defined in this interface, 
  -	 *         StoredDeviation.LEPTOKURITC, StoredDeviation.PLATYKURTIC, or 
  -	 *         StoredDeviation.MESOKURTIC
  -	 */
  -	public abstract int getKurtosisClass();
  -    
   	/** 
   	 * Returns the maximum of the available values
   	 * @return The max or Double.NaN if no values have been added.
  
  
  
  1.16      +1 -3      jakarta-commons/math/src/test/org/apache/commons/math/stat/StatUtilsTest.java
  
  Index: StatUtilsTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/math/src/test/org/apache/commons/math/stat/StatUtilsTest.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- StatUtilsTest.java	27 Apr 2004 16:42:31 -0000	1.15
  +++ StatUtilsTest.java	23 May 2004 00:56:15 -0000	1.16
  @@ -20,7 +20,6 @@
   import junit.framework.TestSuite;
   
   import org.apache.commons.math.TestUtils;
  -import org.apache.commons.math.stat.univariate.DescriptiveStatistics;
   
   /**
    * Test cases for the {@link StatUtils} class.
  @@ -42,7 +41,6 @@
       private double max = 3;
       private double skewness = 0;
       private double kurtosis = 0.5;
  -    private int kClass = DescriptiveStatistics.LEPTOKURTIC;
       private double tolerance = 10E-15;
   
       public StatUtilsTest(String name) {
  
  
  

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


Re: [math] cvs commit: jakarta-commons/math/src/test/org/apache/commons/math/stat StatUtilsTest.java

Posted by "Mark R. Diggory" <md...@latte.harvard.edu>.
Sounds acceptable, I agree that the whole KurtosisClass thing can be 
left as an exercise for the user.

-Mark

tobrien@apache.org wrote:

> tobrien     2004/05/22 17:56:15
> 
>   Modified:    math/src/test/org/apache/commons/math/stat/univariate
>                         StoreUnivariateImplTest.java
>                         MixedListUnivariateImplTest.java
>                         ListUnivariateImplTest.java
>                         DescriptiveStatisticsTest.java
>                math/src/java/org/apache/commons/math/stat/univariate
>                         AbstractDescriptiveStatistics.java
>                         DescriptiveStatistics.java
>                math/src/test/org/apache/commons/math/stat
>                         StatUtilsTest.java
>   Log:
>   Pre Issue 29012, getKurtosisClass() did not have a tolerance; therefore,
>   any non-zero kurtosis was consistently mesokurtic.  Instead of getting 
>   into this level of detail, getKurtosisClass() has been removed, it is a
>   subjective measure not appropriate for DescStat.
>   
>   Revision  Changes    Path
>   1.2       +1 -2      jakarta-commons/math/src/test/org/apache/commons/math/stat/univariate/StoreUnivariateImplTest.java
>   
>   Index: StoreUnivariateImplTest.java
>   ===================================================================
>   RCS file: /home/cvs/jakarta-commons/math/src/test/org/apache/commons/math/stat/univariate/StoreUnivariateImplTest.java,v
>   retrieving revision 1.1
>   retrieving revision 1.2
>   diff -u -r1.1 -r1.2
>   --- StoreUnivariateImplTest.java	12 Apr 2004 02:27:50 -0000	1.1
>   +++ StoreUnivariateImplTest.java	23 May 2004 00:56:15 -0000	1.2
>   @@ -42,7 +42,6 @@
>        private double max = 3;
>        private double skewness = 0;
>        private double kurtosis = 0.5;
>   -    private int kClass = DescriptiveStatistics.LEPTOKURTIC;
>        private double tolerance = 10E-15;
>        
>        public StoreUnivariateImplTest(String name) {
>   
>   
>   
>   1.2       +1 -2      jakarta-commons/math/src/test/org/apache/commons/math/stat/univariate/MixedListUnivariateImplTest.java
>   
>   Index: MixedListUnivariateImplTest.java
>   ===================================================================
>   RCS file: /home/cvs/jakarta-commons/math/src/test/org/apache/commons/math/stat/univariate/MixedListUnivariateImplTest.java,v
>   retrieving revision 1.1
>   retrieving revision 1.2
>   diff -u -r1.1 -r1.2
>   --- MixedListUnivariateImplTest.java	12 Apr 2004 02:27:50 -0000	1.1
>   +++ MixedListUnivariateImplTest.java	23 May 2004 00:56:15 -0000	1.2
>   @@ -45,7 +45,6 @@
>        private double max = 3;
>        private double skewness = 0;
>        private double kurtosis = 0.5;
>   -    private int kClass = DescriptiveStatistics.LEPTOKURTIC;
>        private double tolerance = 10E-15;
>    
>        private TransformerMap transformers = new TransformerMap();
>   
>   
>   
>   1.2       +1 -2      jakarta-commons/math/src/test/org/apache/commons/math/stat/univariate/ListUnivariateImplTest.java
>   
>   Index: ListUnivariateImplTest.java
>   ===================================================================
>   RCS file: /home/cvs/jakarta-commons/math/src/test/org/apache/commons/math/stat/univariate/ListUnivariateImplTest.java,v
>   retrieving revision 1.1
>   retrieving revision 1.2
>   diff -u -r1.1 -r1.2
>   --- ListUnivariateImplTest.java	12 Apr 2004 02:27:50 -0000	1.1
>   +++ ListUnivariateImplTest.java	23 May 2004 00:56:15 -0000	1.2
>   @@ -43,7 +43,6 @@
>        private double max = 3;
>        private double skewness = 0;
>        private double kurtosis = 0.5;
>   -    private int kClass = DescriptiveStatistics.LEPTOKURTIC;
>        private double tolerance = 10E-15;
>        
>        public ListUnivariateImplTest(String name) {
>   
>   
>   
>   1.6       +1 -27     jakarta-commons/math/src/test/org/apache/commons/math/stat/univariate/DescriptiveStatisticsTest.java
>   
>   Index: DescriptiveStatisticsTest.java
>   ===================================================================
>   RCS file: /home/cvs/jakarta-commons/math/src/test/org/apache/commons/math/stat/univariate/DescriptiveStatisticsTest.java,v
>   retrieving revision 1.5
>   retrieving revision 1.6
>   diff -u -r1.5 -r1.6
>   --- DescriptiveStatisticsTest.java	23 May 2004 00:30:01 -0000	1.5
>   +++ DescriptiveStatisticsTest.java	23 May 2004 00:56:15 -0000	1.6
>   @@ -43,7 +43,6 @@
>        private double max = 3;
>        private double skewness = 0;
>        private double kurtosis = 0.5;
>   -    private int kClass = DescriptiveStatistics.LEPTOKURTIC;
>        private double tolerance = 10E-15;
>        
>        public DescriptiveStatisticsTest(String name) {
>   @@ -408,30 +407,5 @@
>            assertEquals(3.0, u.getMean(), tolerance);
>        }
>        
>   -    public void testKurtosisClass() {
>   -        DescriptiveStatistics u = DescriptiveStatistics.newInstance();
>   -        u.setWindowSize(5);
>   -        
>   -        u.addValue(1.0);
>   -        u.addValue(1.0);
>   -        u.addValue(2.0);
>   -        u.addValue(1.0);
>   -        u.addValue(1.0);
>   -        assertEquals(DescriptiveStatistics.LEPTOKURTIC, u.getKurtosisClass());
>   -        
>   -        u.addValue(1.0);
>   -        u.addValue(2.0);
>   -        u.addValue(2.0);
>   -        u.addValue(2.0);
>   -        u.addValue(1.0);
>   -        assertEquals(DescriptiveStatistics.PLATYKURTIC, u.getKurtosisClass());
>   -//        
>   -//        u.addValue(1.0);
>   -//        u.addValue(1.5);
>   -//        u.addValue(2.0912994180548905);
>   -//        u.addValue(1.5);
>   -//        u.addValue(1.0);
>   -//        assertEquals(DescriptiveStatistics.MESOKURTIC, u.getKurtosisClass());
>   -    }
>    }
>    
>   
>   
>   
>   1.3       +1 -16     jakarta-commons/math/src/java/org/apache/commons/math/stat/univariate/AbstractDescriptiveStatistics.java
>   
>   Index: AbstractDescriptiveStatistics.java
>   ===================================================================
>   RCS file: /home/cvs/jakarta-commons/math/src/java/org/apache/commons/math/stat/univariate/AbstractDescriptiveStatistics.java,v
>   retrieving revision 1.2
>   retrieving revision 1.3
>   diff -u -r1.2 -r1.3
>   --- AbstractDescriptiveStatistics.java	3 May 2004 14:32:25 -0000	1.2
>   +++ AbstractDescriptiveStatistics.java	23 May 2004 00:56:15 -0000	1.3
>   @@ -101,21 +101,6 @@
>        }
>    
>        /**
>   -     * @see org.apache.commons.math.stat.univariate.DescriptiveStatistics#getKurtosisClass()
>   -     */
>   -    public int getKurtosisClass() {
>   -    	int kClass = MESOKURTIC;
>   -
>   -    	double kurtosis = getKurtosis();
>   -    	if (kurtosis > 0) {
>   -    		kClass = LEPTOKURTIC;
>   -    	} else if (kurtosis < 0) {
>   -    		kClass = PLATYKURTIC;
>   -    	}
>   -    	return (kClass);
>   -    }
>   -
>   -    /**
>         * @see org.apache.commons.math.stat.univariate.DescriptiveStatistics#getMax()
>         */
>        public double getMax() {
>   
>   
>   
>   1.5       +1 -25     jakarta-commons/math/src/java/org/apache/commons/math/stat/univariate/DescriptiveStatistics.java
>   
>   Index: DescriptiveStatistics.java
>   ===================================================================
>   RCS file: /home/cvs/jakarta-commons/math/src/java/org/apache/commons/math/stat/univariate/DescriptiveStatistics.java,v
>   retrieving revision 1.4
>   retrieving revision 1.5
>   diff -u -r1.4 -r1.5
>   --- DescriptiveStatistics.java	19 May 2004 14:16:31 -0000	1.4
>   +++ DescriptiveStatistics.java	23 May 2004 00:56:15 -0000	1.5
>   @@ -84,19 +84,6 @@
>    	public static final int INFINITE_WINDOW = -1;
>    
>    	/**
>   -	 * A LEPTOKURTIC set has a positive kurtosis (a high peak) 
>   -	 */
>   -	public static int LEPTOKURTIC = 1;
>   -	/**
>   -	 * A MESOKURTIC set has a kurtosis of 0 - it is a normal distribution
>   -	 */
>   -	public static int MESOKURTIC = 0;
>   -	/**
>   -	 * A PLATYKURTIC set has a negative kurtosis (a flat "peak")
>   -	 */
>   -	public static int PLATYKURTIC = -1;
>   -
>   -	/**
>    	 * Adds the value to the set of numbers
>    	 * @param v the value to be added 
>    	 */
>   @@ -147,17 +134,6 @@
>    	 */
>    	public abstract double getKurtosis();
>    
>   -	/**
>   -	 * Returns the Kurtosis "classification" a distribution can be 
>   -	 * leptokurtic (high peak), platykurtic (flat peak), 
>   -	 * or mesokurtic (zero kurtosis).  
>   -	 * 
>   -	 * @return A static constant defined in this interface, 
>   -	 *         StoredDeviation.LEPTOKURITC, StoredDeviation.PLATYKURTIC, or 
>   -	 *         StoredDeviation.MESOKURTIC
>   -	 */
>   -	public abstract int getKurtosisClass();
>   -    
>    	/** 
>    	 * Returns the maximum of the available values
>    	 * @return The max or Double.NaN if no values have been added.
>   
>   
>   
>   1.16      +1 -3      jakarta-commons/math/src/test/org/apache/commons/math/stat/StatUtilsTest.java
>   
>   Index: StatUtilsTest.java
>   ===================================================================
>   RCS file: /home/cvs/jakarta-commons/math/src/test/org/apache/commons/math/stat/StatUtilsTest.java,v
>   retrieving revision 1.15
>   retrieving revision 1.16
>   diff -u -r1.15 -r1.16
>   --- StatUtilsTest.java	27 Apr 2004 16:42:31 -0000	1.15
>   +++ StatUtilsTest.java	23 May 2004 00:56:15 -0000	1.16
>   @@ -20,7 +20,6 @@
>    import junit.framework.TestSuite;
>    
>    import org.apache.commons.math.TestUtils;
>   -import org.apache.commons.math.stat.univariate.DescriptiveStatistics;
>    
>    /**
>     * Test cases for the {@link StatUtils} class.
>   @@ -42,7 +41,6 @@
>        private double max = 3;
>        private double skewness = 0;
>        private double kurtosis = 0.5;
>   -    private int kClass = DescriptiveStatistics.LEPTOKURTIC;
>        private double tolerance = 10E-15;
>    
>        public StatUtilsTest(String name) {
>   
>   
>   
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
> 

-- 
Mark Diggory
Software Developer
Harvard MIT Data Center
http://www.hmdc.harvard.edu

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