commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pste...@apache.org
Subject cvs commit: jakarta-commons/math/src/test/org/apache/commons/math/stat/univariate/rank PercentileTest.java
Date Sat, 13 Mar 2004 20:03:16 GMT
psteitz     2004/03/13 12:03:16

  Modified:    math/src/test/org/apache/commons/math/stat/univariate/rank
                        PercentileTest.java
  Log:
  Added tests based on NIST definition.
  
  Revision  Changes    Path
  1.11      +21 -1     jakarta-commons/math/src/test/org/apache/commons/math/stat/univariate/rank/PercentileTest.java
  
  Index: PercentileTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/math/src/test/org/apache/commons/math/stat/univariate/rank/PercentileTest.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- PercentileTest.java	21 Feb 2004 21:35:18 -0000	1.10
  +++ PercentileTest.java	13 Mar 2004 20:03:16 -0000	1.11
  @@ -66,4 +66,24 @@
           Percentile p = new Percentile(75);
           assertEquals(3.0, p.evaluate(d), 1.0e-5);
       }
  +    
  +    public void testPercentile() {
  +        double[] d = new double[] {1, 3, 2, 4};
  +        Percentile p = new Percentile(30);
  +        assertEquals(1.5, p.evaluate(d), 1.0e-5);
  +        p.setQuantile(25);
  +        assertEquals(1.25, p.evaluate(d), 1.0e-5);
  +        p.setQuantile(75);
  +        assertEquals(3.75, p.evaluate(d), 1.0e-5);
  +        p.setQuantile(50);
  +        assertEquals(2.5, p.evaluate(d), 1.0e-5);
  +    }
  +    
  +    public void testNISTExample() {
  +        double[] d = new double[] {95.1772, 95.1567, 95.1937, 95.1959, 
  +                95.1442, 95.0610,  95.1591, 95.1195, 95.1772, 95.0925, 95.1990, 95.1682
  +        };
  +        Percentile p = new Percentile(90); 
  +        assertEquals(95.1981, p.evaluate(d), 1.0e-4);
  +    }
   }
  
  
  

---------------------------------------------------------------------
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