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 TestStatisticTest.java
Date Sun, 07 Mar 2004 21:55:18 GMT
psteitz     2004/03/07 13:55:18

  Modified:    math/src/test/org/apache/commons/math/stat
                        TestStatisticTest.java
  Log:
  Replaced low-accuracy textbook comparison values with values from R.
  
  Revision  Changes    Path
  1.13      +8 -9      jakarta-commons/math/src/test/org/apache/commons/math/stat/TestStatisticTest.java
  
  Index: TestStatisticTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/math/src/test/org/apache/commons/math/stat/TestStatisticTest.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- TestStatisticTest.java	7 Mar 2004 20:47:06 -0000	1.12
  +++ TestStatisticTest.java	7 Mar 2004 21:55:18 -0000	1.13
  @@ -212,14 +212,13 @@
           for (int i = 0; i < sample2.length; i++) {
               sampleStats2.addValue(sample2[i]);
           }
  -        //FIXME: textbook example reported t stat uses pooled variance
  -        // should replace the following two tests  with R-verified example
  -        assertEquals("two sample t stat", 1.634, testStatistic.t(sample1, sample2), 0.1);
  -        assertEquals("two sample t stat", 1.634, testStatistic.t(sampleStats1, sampleStats2),
0.1);
  -        
  -        // These tests are OK, since book reports non-pooled exact p-value
  -        assertEquals("two sample p value", 0.059, testStatistic.tTest(sample1, sample2)
/ 2d, 10E-3);
  -        assertEquals("two sample p value", 0.059, testStatistic.tTest(sampleStats1, sampleStats2)
/ 2d, 10E-3);
  +         
  +        // Target comparison values computed using R version 1.8.1 (Linux version)
  +        assertEquals("two sample t stat", 1.6037, testStatistic.t(sample1, sample2), 10E-4);
  +        assertEquals("two sample t stat", 1.6037, testStatistic.t(sampleStats1, sampleStats2),
10E-4);
  +        assertEquals("two sample p value", 0.0644, testStatistic.tTest(sample1, sample2)
/ 2d, 10E-4);
  +        assertEquals("two sample p value", 0.0644, testStatistic.tTest(sampleStats1, sampleStats2)
/ 2d, 10E-4);
  +        
           assertTrue("two sample t-test reject", testStatistic.tTest(sample1, sample2, 0.2));
           assertTrue("two sample t-test reject", testStatistic.tTest(sampleStats1, sampleStats2,
0.2));
           assertTrue("two sample t-test accept", !testStatistic.tTest(sample1, sample2, 0.1));
  @@ -278,7 +277,7 @@
               testStatistic.t(sampleStats1, tooShortStats);
               fail("insufficient data, IllegalArgumentException expected");
           } catch (IllegalArgumentException ex) {
  -           // exptected
  +           // expected
           }
       }
   }
  
  
  

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