commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pste...@apache.org
Subject svn commit: r1206471 - /commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/moment/Variance.java
Date Sat, 26 Nov 2011 16:11:01 GMT
Author: psteitz
Date: Sat Nov 26 16:11:00 2011
New Revision: 1206471

URL: http://svn.apache.org/viewvc?rev=1206471&view=rev
Log:
Javadoc only. Clarified how increment works with an external second moment.

Modified:
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/moment/Variance.java

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/moment/Variance.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/moment/Variance.java?rev=1206471&r1=1206470&r2=1206471&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/moment/Variance.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/moment/Variance.java
Sat Nov 26 16:11:00 2011
@@ -75,15 +75,17 @@ public class Variance extends AbstractSt
     protected SecondMoment moment = null;
 
     /**
-     * Boolean test to determine if this Variance should also increment
-     * the second moment, this evaluates to false when this Variance is
-     * constructed with an external SecondMoment as a parameter.
+     * Whether or not {@link #increment(double)} should increment
+     * the internal second moment. When a Variance is constructed with an
+     * external SecondMoment as a constructor parameter, this property is
+     * set to false and increments must be applied to the second moment
+     * directly.
      */
     protected boolean incMoment = true;
 
     /**
-     * Determines whether or not bias correction is applied when computing the
-     * value of the statisic.  True means that bias is corrected.  See
+     * Whether or not bias correction is applied when computing the
+     * value of the statistic. True means that bias is corrected.  See
      * {@link Variance} for details on the formula.
      */
     private boolean isBiasCorrected = true;
@@ -98,6 +100,10 @@ public class Variance extends AbstractSt
 
     /**
      * Constructs a Variance based on an external second moment.
+     * When this constructor is used, the statistic may only be
+     * incremented via the moment, i.e., {@link #increment(double)}
+     * does nothing; whereas {@code m2.increment(value)} increments
+     * both {@code m2} and the Variance instance constructed from it.
      *
      * @param m2 the SecondMoment (Third or Fourth moments work
      * here as well.)
@@ -153,6 +159,10 @@ public class Variance extends AbstractSt
      * <code>evaluate</code> leverages the fact that is has the full
      * list of values together to execute a two-pass algorithm.
      * See {@link Variance}.</p>
+     * 
+     * <p>Note also that when {@link #Variance(SecondMoment)} is used to
+     * create a Variance, this method does nothing. In that case, the
+     * SecondMoment should be incremented directly.</p>
      */
     @Override
     public void increment(final double d) {



Mime
View raw message