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/java/org/apache/commons/math/stat/inference TTest.java TTestImpl.java
Date Sun, 23 May 2004 05:04:48 GMT
psteitz     2004/05/22 22:04:48

  Modified:    math/src/java/org/apache/commons/math/stat/inference
                        TTest.java TTestImpl.java
  Log:
  Modified t-test procedures to allow samples as small
  as 2 observations.
  PR # 29050
  Reported by: Joel Freyss
  
  Revision  Changes    Path
  1.2       +4 -4      jakarta-commons/math/src/java/org/apache/commons/math/stat/inference/TTest.java
  
  Index: TTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/math/src/java/org/apache/commons/math/stat/inference/TTest.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TTest.java	3 May 2004 03:03:21 -0000	1.1
  +++ TTest.java	23 May 2004 05:04:48 -0000	1.2
  @@ -320,7 +320,7 @@
        * <p>
        * <strong>Preconditions</strong>: <ul>
        * <li>The datasets described by the two Univariates must each contain
  -     * at least 5 observations.
  +     * at least 2 observations.
        * </li>
        * <li> <code> 0 < alpha < 0.5 </code>
        * </li></ul>
  @@ -362,7 +362,7 @@
        * <a href="http://www.basic.nwu.edu/statguidefiles/sg_glos.html#one-sample">here</a>
        * <p>
        * <strong>Preconditions</strong>: <ul>
  -     * <li>The sample must include at least 5 observations.
  +     * <li>The sample must include at least 2 observations.
        * </li></ul>
        *
        * @param mu constant value to compare sample mean against
  @@ -394,7 +394,7 @@
        * <a href="http://www.basic.nwu.edu/statguidefiles/ttest_unpaired_ass_viol.html">here</a>
        * <p>
        * <strong>Preconditions</strong>: <ul>
  -     * <li>The sample must contain at least 5 observations.
  +     * <li>The sample must contain at least 2 observations.
        * </li></ul>
        *
        * @param mu constant value to compare sample mean against
  
  
  
  1.2       +10 -10    jakarta-commons/math/src/java/org/apache/commons/math/stat/inference/TTestImpl.java
  
  Index: TTestImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/math/src/java/org/apache/commons/math/stat/inference/TTestImpl.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TTestImpl.java	3 May 2004 03:03:21 -0000	1.1
  +++ TTestImpl.java	23 May 2004 05:04:48 -0000	1.2
  @@ -41,11 +41,11 @@
        * @param mu comparison constant
        * @param observed array of values
        * @return t statistic
  -     * @throws IllegalArgumentException if input array length is less than 5
  +     * @throws IllegalArgumentException if input array length is less than 2
        */
       public double t(double mu, double[] observed)
       throws IllegalArgumentException {
  -        if ((observed == null) || (observed.length < 5)) {
  +        if ((observed == null) || (observed.length < 2)) {
               throw new IllegalArgumentException("insufficient data for t statistic");
           }
           return t(StatUtils.mean(observed), mu, StatUtils.variance(observed), observed.length);
  @@ -76,7 +76,7 @@
       public double t(double[] sample1, double[] sample2)
       throws IllegalArgumentException {
           if ((sample1 == null) || (sample2 == null ||
  -                Math.min(sample1.length, sample2.length) < 5)) {
  +                Math.min(sample1.length, sample2.length) < 2)) {
               throw new IllegalArgumentException("insufficient data for t statistic");
           }
           return t(StatUtils.mean(sample1), StatUtils.mean(sample2), StatUtils.variance(sample1),
  @@ -94,7 +94,7 @@
       public double tTest(double[] sample1, double[] sample2)
       throws IllegalArgumentException, MathException {
           if ((sample1 == null) || (sample2 == null ||
  -                Math.min(sample1.length, sample2.length) < 5)) {
  +                Math.min(sample1.length, sample2.length) < 2)) {
               throw new IllegalArgumentException("insufficient data");
           }
           return tTest(StatUtils.mean(sample1), StatUtils.mean(sample2), StatUtils.variance(sample1),
  @@ -127,7 +127,7 @@
        */
       public double tTest(double mu, double[] sample)
       throws IllegalArgumentException, MathException {
  -        if ((sample == null) || (sample.length < 5)) {
  +        if ((sample == null) || (sample.length < 2)) {
               throw new IllegalArgumentException("insufficient data for t statistic");
           }
           return tTest( StatUtils.mean(sample), mu, StatUtils.variance(sample), sample.length);
  @@ -141,7 +141,7 @@
        */
       public double t(double mu, StatisticalSummary sampleStats)
       throws IllegalArgumentException {
  -        if ((sampleStats == null) || (sampleStats.getN() < 5)) {
  +        if ((sampleStats == null) || (sampleStats.getN() < 2)) {
               throw new IllegalArgumentException("insufficient data for t statistic");
           }
           return t(sampleStats.getMean(), mu, sampleStats.getVariance(), sampleStats.getN());
  @@ -157,7 +157,7 @@
       throws IllegalArgumentException {
           if ((sampleStats1 == null) ||
                   (sampleStats2 == null ||
  -                        Math.min(sampleStats1.getN(), sampleStats2.getN()) < 5)) {
  +                        Math.min(sampleStats1.getN(), sampleStats2.getN()) < 2)) {
               throw new IllegalArgumentException("insufficient data for t statistic");
           }
           return t(sampleStats1.getMean(), sampleStats2.getMean(), sampleStats1.getVariance(),
  @@ -174,7 +174,7 @@
       public double tTest(StatisticalSummary sampleStats1, StatisticalSummary sampleStats2)
       throws IllegalArgumentException, MathException {
           if ((sampleStats1 == null) || (sampleStats2 == null ||
  -                Math.min(sampleStats1.getN(), sampleStats2.getN()) < 5)) {
  +                Math.min(sampleStats1.getN(), sampleStats2.getN()) < 2)) {
               throw new IllegalArgumentException("insufficient data for t statistic");
           }
           return tTest(sampleStats1.getMean(), sampleStats2.getMean(), sampleStats1.getVariance(),
  @@ -224,7 +224,7 @@
        */
       public double tTest(double mu, StatisticalSummary sampleStats)
       throws IllegalArgumentException, MathException {
  -        if ((sampleStats == null) || (sampleStats.getN() < 5)) {
  +        if ((sampleStats == null) || (sampleStats.getN() < 2)) {
               throw new IllegalArgumentException("insufficient data for t statistic");
           }
           return tTest(sampleStats.getMean(), mu, sampleStats.getVariance(), sampleStats.getN());
  
  
  

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