You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by ps...@apache.org on 2004/06/27 21:33:38 UTC

cvs commit: jakarta-commons/math/src/test/org/apache/commons/math/stat/univariate/moment FourthMomentTest.java SecondMomentTest.java ThirdMomentTest.java FirstMomentTest.java

psteitz     2004/06/27 12:33:38

  Modified:    math/src/test/org/apache/commons/math/stat/univariate
                        UnivariateStatisticAbstractTest.java
               math/src/test/org/apache/commons/math/stat/univariate/moment
                        FirstMomentTest.java
  Added:       math/src/test/org/apache/commons/math/stat/univariate/moment
                        FourthMomentTest.java SecondMomentTest.java
                        ThirdMomentTest.java
  Log:
  Added tests for second, third, fourth moments.
  
  Revision  Changes    Path
  1.12      +7 -24     jakarta-commons/math/src/test/org/apache/commons/math/stat/univariate/UnivariateStatisticAbstractTest.java
  
  Index: UnivariateStatisticAbstractTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/math/src/test/org/apache/commons/math/stat/univariate/UnivariateStatisticAbstractTest.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- UnivariateStatisticAbstractTest.java	21 Mar 2004 04:24:17 -0000	1.11
  +++ UnivariateStatisticAbstractTest.java	27 Jun 2004 19:33:38 -0000	1.12
  @@ -41,33 +41,16 @@
       protected double sumLog = 54.7969806116451507d;
       protected double sumSq = 3595.250d;
       protected double sum = 272.90d;
  +    protected double secondMoment = 210.04954545454547d;
  +    protected double thirdMoment = 868.0906859504136;
  +    protected double fourthMoment = 9244.080993773481;
   
       protected double tolerance = 10E-12;
   
       protected double[] testArray =
  -        {
  -            12.5,
  -            12,
  -            11.8,
  -            14.2,
  -            14.9,
  -            14.5,
  -            21,
  -            8.2,
  -            10.3,
  -            11.3,
  -            14.1,
  -            9.9,
  -            12.2,
  -            12,
  -            12.1,
  -            11,
  -            19.8,
  -            11,
  -            10,
  -            8.8,
  -            9,
  -            12.3 };
  +        {12.5, 12, 11.8, 14.2, 14.9, 14.5, 21, 8.2, 10.3, 11.3,
  +          14.1, 9.9, 12.2, 12, 12.1, 11, 19.8, 11, 10,  8.8,
  +           9, 12.3 };
   
       public UnivariateStatisticAbstractTest(String name) {
           super(name);
  
  
  
  1.3       +2 -2      jakarta-commons/math/src/test/org/apache/commons/math/stat/univariate/moment/FirstMomentTest.java
  
  Index: FirstMomentTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/math/src/test/org/apache/commons/math/stat/univariate/moment/FirstMomentTest.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- FirstMomentTest.java	17 Jun 2004 21:37:05 -0000	1.2
  +++ FirstMomentTest.java	27 Jun 2004 19:33:38 -0000	1.3
  @@ -19,7 +19,7 @@
   import org.apache.commons.math.stat.univariate.UnivariateStatistic;
   
   /**
  - * Test cases for the {@link UnivariateStatistic} class.
  + * Test cases for the {@link FirstMoment} class.
    * @version $Revision$ $Date$
    */
   public class FirstMomentTest extends StorelessUnivariateStatisticAbstractTest{
  
  
  
  1.1                  jakarta-commons/math/src/test/org/apache/commons/math/stat/univariate/moment/FourthMomentTest.java
  
  Index: FourthMomentTest.java
  ===================================================================
  /*
   * Copyright 2003-2004 The Apache Software Foundation.
   * 
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   * 
   *      http://www.apache.org/licenses/LICENSE-2.0
   * 
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  package org.apache.commons.math.stat.univariate.moment;
  
  import org.apache.commons.math.stat.univariate.StorelessUnivariateStatisticAbstractTest;
  import org.apache.commons.math.stat.univariate.UnivariateStatistic;
  
  /**
   * Test cases for the {@link FourthMoment} class.
   * @version $Revision: 1.1 $ $Date: 2004/06/27 19:33:38 $
   */
  public class FourthMomentTest extends StorelessUnivariateStatisticAbstractTest{
  
      /** descriptive statistic. */
      protected FourthMoment stat;
      
      /**
       * @param name
       */
      public FourthMomentTest(String name) {
          super(name);
      }
      
      /**
       * @see org.apache.commons.math.stat.univariate.UnivariateStatisticAbstractTest#getUnivariateStatistic()
       */
      public UnivariateStatistic getUnivariateStatistic() {
          return new FourthMoment();
      }
  
      /**
       * @see org.apache.commons.math.stat.univariate.UnivariateStatisticAbstractTest#expectedValue()
       */
      public double expectedValue() {
         return this.fourthMoment;
      }
  
  }
  
  
  
  1.1                  jakarta-commons/math/src/test/org/apache/commons/math/stat/univariate/moment/SecondMomentTest.java
  
  Index: SecondMomentTest.java
  ===================================================================
  /*
   * Copyright 2003-2004 The Apache Software Foundation.
   * 
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   * 
   *      http://www.apache.org/licenses/LICENSE-2.0
   * 
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  package org.apache.commons.math.stat.univariate.moment;
  
  import org.apache.commons.math.stat.univariate.StorelessUnivariateStatisticAbstractTest;
  import org.apache.commons.math.stat.univariate.UnivariateStatistic;
  
  /**
   * Test cases for the {@link SecondMoment} class.
   * @version $Revision: 1.1 $ $Date: 2004/06/27 19:33:38 $
   */
  public class SecondMomentTest extends StorelessUnivariateStatisticAbstractTest {
  
      /** descriptive statistic. */
      protected SecondMoment stat;
      
      /**
       * @param name
       */
      public SecondMomentTest(String name) {
          super(name);
      }
      
      /**
       * @see org.apache.commons.math.stat.univariate.UnivariateStatisticAbstractTest#getUnivariateStatistic()
       */
      public UnivariateStatistic getUnivariateStatistic() {
          return new SecondMoment();
      }
  
      /**
       * @see org.apache.commons.math.stat.univariate.UnivariateStatisticAbstractTest#expectedValue()
       */
      public double expectedValue() {
          return this.secondMoment;
      }
  
  }
  
  
  
  1.1                  jakarta-commons/math/src/test/org/apache/commons/math/stat/univariate/moment/ThirdMomentTest.java
  
  Index: ThirdMomentTest.java
  ===================================================================
  /*
   * Copyright 2003-2004 The Apache Software Foundation.
   * 
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   * 
   *      http://www.apache.org/licenses/LICENSE-2.0
   * 
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  package org.apache.commons.math.stat.univariate.moment;
  
  import org.apache.commons.math.stat.univariate.StorelessUnivariateStatisticAbstractTest;
  import org.apache.commons.math.stat.univariate.UnivariateStatistic;
  
  /**
   * Test cases for the {@link ThirdMoment} class.
   * @version $Revision: 1.1 $ $Date: 2004/06/27 19:33:38 $
   */
  public class ThirdMomentTest extends StorelessUnivariateStatisticAbstractTest{
  
      /** descriptive statistic. */
      protected ThirdMoment stat;
      
      /**
       * @param name
       */
      public ThirdMomentTest(String name) {
          super(name);
      }
      
      /**
       * @see org.apache.commons.math.stat.univariate.UnivariateStatisticAbstractTest#getUnivariateStatistic()
       */
      public UnivariateStatistic getUnivariateStatistic() {
          return new ThirdMoment();
      }
  
      /**
       * @see org.apache.commons.math.stat.univariate.UnivariateStatisticAbstractTest#expectedValue()
       */
      public double expectedValue() {
        return this.thirdMoment;
      }
  
  }
  
  
  

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