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/15 01:26:54 UTC
cvs commit: jakarta-commons/math/src/java/org/apache/commons/math/stat/univariate/summary package.html
psteitz 2004/06/14 16:26:54
Modified: math/src/java/org/apache/commons/math/stat StatUtils.java
package.html
math/src/java/org/apache/commons/math/stat/inference
ChiSquareTestImpl.java TTestImpl.java package.html
math/src/java/org/apache/commons/math/stat/multivariate
package.html
math/src/java/org/apache/commons/math/stat/univariate
DescriptiveStatistics.java
DescriptiveStatisticsImpl.java
StatisticalSummary.java SummaryStatistics.java
SummaryStatisticsImpl.java package.html
math/src/java/org/apache/commons/math/stat/univariate/moment
package.html
math/src/java/org/apache/commons/math/stat/univariate/rank
package.html
math/src/java/org/apache/commons/math/stat/univariate/summary
package.html
Log:
Formatting only. Removed tabs.
Revision Changes Path
1.28 +3 -3 jakarta-commons/math/src/java/org/apache/commons/math/stat/StatUtils.java
Index: StatUtils.java
===================================================================
RCS file: /home/cvs/jakarta-commons/math/src/java/org/apache/commons/math/stat/StatUtils.java,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- StatUtils.java 24 May 2004 05:30:33 -0000 1.27
+++ StatUtils.java 14 Jun 2004 23:26:53 -0000 1.28
@@ -326,11 +326,11 @@
* (positive) length
*/
public static double sumDifference(final double[] sample1, final double[] sample2)
- throws IllegalArgumentException {
+ throws IllegalArgumentException {
int n = sample1.length;
if (n != sample2.length || n < 1) {
throw new IllegalArgumentException
- ("Input arrays must have the same (positive) length.");
+ ("Input arrays must have the same (positive) length.");
}
double result = 0;
for (int i = 0; i < n; i++) {
1.6 +2 -2 jakarta-commons/math/src/java/org/apache/commons/math/stat/package.html
Index: package.html
===================================================================
RCS file: /home/cvs/jakarta-commons/math/src/java/org/apache/commons/math/stat/package.html,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- package.html 26 Apr 2004 18:28:17 -0000 1.5
+++ package.html 14 Jun 2004 23:26:53 -0000 1.6
@@ -14,6 +14,6 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
- <!-- $Revision$ $Date$ -->
- <body>Data storage, manipulation and summary routines.</body>
+ <!-- $Revision$ $Date$ -->
+ <body>Data storage, manipulation and summary routines.</body>
</html>
1.6 +2 -2 jakarta-commons/math/src/java/org/apache/commons/math/stat/inference/ChiSquareTestImpl.java
Index: ChiSquareTestImpl.java
===================================================================
RCS file: /home/cvs/jakarta-commons/math/src/java/org/apache/commons/math/stat/inference/ChiSquareTestImpl.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- ChiSquareTestImpl.java 6 Jun 2004 23:14:09 -0000 1.5
+++ ChiSquareTestImpl.java 14 Jun 2004 23:26:53 -0000 1.6
@@ -119,7 +119,7 @@
for (int col = 0; col < nCols; col++) {
expected = (rowSum[row] * colSum[col]) / total;
sumSq += (((double) counts[row][col] - expected) * ((double) counts[row][col] - expected))
- / expected;
+ / expected;
}
}
return sumSq;
1.7 +3 -3 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.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- TTestImpl.java 6 Jun 2004 22:28:25 -0000 1.6
+++ TTestImpl.java 14 Jun 2004 23:26:53 -0000 1.7
@@ -753,7 +753,7 @@
double pooledVariance = ((n1 - 1) * v1 + (n2 -1) * v2 ) / (n1 + n2 - 2);
return (m1 - m2) / Math.sqrt(pooledVariance * (1d / n1 + 1d / n2));
} else {
- return (m1 - m2) / Math.sqrt((v1 / n1) + (v2 / n2));
+ return (m1 - m2) / Math.sqrt((v1 / n1) + (v2 / n2));
}
}
@@ -798,7 +798,7 @@
if (equalVariances) {
degreesOfFreedom = (double) (n1 + n2 - 2);
} else {
- degreesOfFreedom= df(v1, v2, n1, n2);
+ degreesOfFreedom= df(v1, v2, n1, n2);
}
TDistribution tDistribution =
getDistributionFactory().createTDistribution(degreesOfFreedom);
1.2 +5 -5 jakarta-commons/math/src/java/org/apache/commons/math/stat/inference/package.html
Index: package.html
===================================================================
RCS file: /home/cvs/jakarta-commons/math/src/java/org/apache/commons/math/stat/inference/package.html,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- package.html 26 Apr 2004 18:28:17 -0000 1.1
+++ package.html 14 Jun 2004 23:26:53 -0000 1.2
@@ -14,9 +14,9 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
- <!-- $Revision$ $Date$ -->
- <body>
- Classes providing hypothesis testing and confidence interval
- construction.
- </body>
+ <!-- $Revision$ $Date$ -->
+ <body>
+ Classes providing hypothesis testing and confidence interval
+ construction.
+ </body>
</html>
1.2 +4 -4 jakarta-commons/math/src/java/org/apache/commons/math/stat/multivariate/package.html
Index: package.html
===================================================================
RCS file: /home/cvs/jakarta-commons/math/src/java/org/apache/commons/math/stat/multivariate/package.html,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- package.html 26 Apr 2004 18:28:16 -0000 1.1
+++ package.html 14 Jun 2004 23:26:53 -0000 1.2
@@ -14,8 +14,8 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
- <!-- $Revision$ $Date$ -->
- <body>
- Statistical routines involving multivariate data.
- </body>
+ <!-- $Revision$ $Date$ -->
+ <body>
+ Statistical routines involving multivariate data.
+ </body>
</html>
1.7 +167 -167 jakarta-commons/math/src/java/org/apache/commons/math/stat/univariate/DescriptiveStatistics.java
Index: DescriptiveStatistics.java
===================================================================
RCS file: /home/cvs/jakarta-commons/math/src/java/org/apache/commons/math/stat/univariate/DescriptiveStatistics.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- DescriptiveStatistics.java 1 Jun 2004 21:34:35 -0000 1.6
+++ DescriptiveStatistics.java 14 Jun 2004 23:26:53 -0000 1.7
@@ -41,196 +41,196 @@
/** Serialization UID */
static final long serialVersionUID = 5188298269533339922L;
- /**
- * Create an instance of a <code>DescriptiveStatistics</code>
+ /**
+ * Create an instance of a <code>DescriptiveStatistics</code>
* @param cls the type of <code>DescriptiveStatistics</code> object to
* create.
- * @return a new factory.
+ * @return a new factory.
* @throws InstantiationException is thrown if the object can not be
* created.
* @throws IllegalAccessException is thrown if the type's default
* constructor is not accessible.
* @throws ClassNotFoundException if the named
* <code>DescriptiveStatistics</code> type can not be found.
- */
- public static DescriptiveStatistics newInstance(String cls) throws InstantiationException, IllegalAccessException, ClassNotFoundException {
- return newInstance(Class.forName(cls));
- }
+ */
+ public static DescriptiveStatistics newInstance(String cls) throws InstantiationException, IllegalAccessException, ClassNotFoundException {
+ return newInstance(Class.forName(cls));
+ }
- /**
- * Create an instance of a <code>DescriptiveStatistics</code>
+ /**
+ * Create an instance of a <code>DescriptiveStatistics</code>
* @param cls the type of <code>DescriptiveStatistics</code> object to
* create.
- * @return a new factory.
+ * @return a new factory.
* @throws InstantiationException is thrown if the object can not be
* created.
* @throws IllegalAccessException is thrown if the type's default
* constructor is not accessible.
- */
- public static DescriptiveStatistics newInstance(Class cls) throws InstantiationException, IllegalAccessException {
- return (DescriptiveStatistics)cls.newInstance();
- }
-
- /**
- * Create an instance of a <code>DescriptiveStatistics</code>
- * @return a new factory.
- */
- public static DescriptiveStatistics newInstance() {
- DescriptiveStatistics factory = null;
- try {
- DiscoverClass dc = new DiscoverClass();
- factory = (DescriptiveStatistics) dc.newInstance(
- DescriptiveStatistics.class,
- "org.apache.commons.math.stat.univariate.DescriptiveStatisticsImpl");
- } catch(Exception ex) {
+ */
+ public static DescriptiveStatistics newInstance(Class cls) throws InstantiationException, IllegalAccessException {
+ return (DescriptiveStatistics)cls.newInstance();
+ }
+
+ /**
+ * Create an instance of a <code>DescriptiveStatistics</code>
+ * @return a new factory.
+ */
+ public static DescriptiveStatistics newInstance() {
+ DescriptiveStatistics factory = null;
+ try {
+ DiscoverClass dc = new DiscoverClass();
+ factory = (DescriptiveStatistics) dc.newInstance(
+ DescriptiveStatistics.class,
+ "org.apache.commons.math.stat.univariate.DescriptiveStatisticsImpl");
+ } catch(Exception ex) {
ex.printStackTrace();
- // ignore as default implementation will be used.
- }
- return factory;
- }
-
- /**
- * This constant signals that a Univariate implementation
- * takes into account the contributions of an infinite number of
- * elements. In other words, if getWindow returns this
- * constant, there is, in effect, no "window".
- */
- public static final int INFINITE_WINDOW = -1;
-
- /**
- * Adds the value to the set of numbers
- * @param v the value to be added
- */
- public abstract void addValue(double v);
-
- /**
- * Returns the <a href="http://www.xycoon.com/arithmetic_mean.htm">
- * arithmetic mean </a> of the available values
- * @return The mean or Double.NaN if no values have been added.
- */
+ // ignore as default implementation will be used.
+ }
+ return factory;
+ }
+
+ /**
+ * This constant signals that a Univariate implementation
+ * takes into account the contributions of an infinite number of
+ * elements. In other words, if getWindow returns this
+ * constant, there is, in effect, no "window".
+ */
+ public static final int INFINITE_WINDOW = -1;
+
+ /**
+ * Adds the value to the set of numbers
+ * @param v the value to be added
+ */
+ public abstract void addValue(double v);
+
+ /**
+ * Returns the <a href="http://www.xycoon.com/arithmetic_mean.htm">
+ * arithmetic mean </a> of the available values
+ * @return The mean or Double.NaN if no values have been added.
+ */
public double getMean() {
- return apply(new Mean());
+ return apply(new Mean());
}
- /**
- * Returns the <a href="http://www.xycoon.com/geometric_mean.htm">
- * geometric mean </a> of the available values
- * @return The geometricMean, Double.NaN if no values have been added,
- * or if the productof the available values is less than or equal to 0.
- */
+ /**
+ * Returns the <a href="http://www.xycoon.com/geometric_mean.htm">
+ * geometric mean </a> of the available values
+ * @return The geometricMean, Double.NaN if no values have been added,
+ * or if the productof the available values is less than or equal to 0.
+ */
public double getGeometricMean() {
- return apply(new GeometricMean());
+ return apply(new GeometricMean());
}
- /**
- * Returns the variance of the available values.
- * @return The variance, Double.NaN if no values have been added
- * or 0.0 for a single value set.
- */
+ /**
+ * Returns the variance of the available values.
+ * @return The variance, Double.NaN if no values have been added
+ * or 0.0 for a single value set.
+ */
public double getVariance() {
- return apply(new Variance());
+ return apply(new Variance());
}
- /**
- * Returns the standard deviation of the available values.
- * @return The standard deviation, Double.NaN if no values have been added
- * or 0.0 for a single value set.
- */
+ /**
+ * Returns the standard deviation of the available values.
+ * @return The standard deviation, Double.NaN if no values have been added
+ * or 0.0 for a single value set.
+ */
public double getStandardDeviation() {
- double stdDev = Double.NaN;
- if (getN() > 0) {
- if (getN() > 1) {
- stdDev = Math.sqrt(getVariance());
- } else {
- stdDev = 0.0;
- }
- }
- return (stdDev);
- }
-
- /**
- * Returns the skewness of the available values. Skewness is a
- * measure of the assymetry of a given distribution.
- * @return The skewness, Double.NaN if no values have been added
- * or 0.0 for a value set <=2.
- */
+ double stdDev = Double.NaN;
+ if (getN() > 0) {
+ if (getN() > 1) {
+ stdDev = Math.sqrt(getVariance());
+ } else {
+ stdDev = 0.0;
+ }
+ }
+ return (stdDev);
+ }
+
+ /**
+ * Returns the skewness of the available values. Skewness is a
+ * measure of the assymetry of a given distribution.
+ * @return The skewness, Double.NaN if no values have been added
+ * or 0.0 for a value set <=2.
+ */
public double getSkewness() {
- return apply(new Skewness());
+ return apply(new Skewness());
}
- /**
- * Returns the Kurtosis of the available values. Kurtosis is a
- * measure of the "peakedness" of a distribution
- * @return The kurtosis, Double.NaN if no values have been added, or 0.0
- * for a value set <=3.
- */
+ /**
+ * Returns the Kurtosis of the available values. Kurtosis is a
+ * measure of the "peakedness" of a distribution
+ * @return The kurtosis, Double.NaN if no values have been added, or 0.0
+ * for a value set <=3.
+ */
public double getKurtosis() {
- return apply(new Kurtosis());
+ return apply(new Kurtosis());
}
- /**
- * Returns the maximum of the available values
- * @return The max or Double.NaN if no values have been added.
- */
+ /**
+ * Returns the maximum of the available values
+ * @return The max or Double.NaN if no values have been added.
+ */
public double getMax() {
- return apply(new Max());
+ return apply(new Max());
}
- /**
- * Returns the minimum of the available values
- * @return The min or Double.NaN if no values have been added.
- */
+ /**
+ * Returns the minimum of the available values
+ * @return The min or Double.NaN if no values have been added.
+ */
public double getMin() {
- return apply(new Min());
+ return apply(new Min());
}
- /**
- * Returns the number of available values
- * @return The number of available values
- */
- public abstract long getN();
-
- /**
- * Returns the sum of the values that have been added to Univariate.
- * @return The sum or Double.NaN if no values have been added
- */
+ /**
+ * Returns the number of available values
+ * @return The number of available values
+ */
+ public abstract long getN();
+
+ /**
+ * Returns the sum of the values that have been added to Univariate.
+ * @return The sum or Double.NaN if no values have been added
+ */
public double getSum() {
- return apply(new Sum());
+ return apply(new Sum());
}
- /**
- * Returns the sum of the squares of the available values.
- * @return The sum of the squares or Double.NaN if no
- * values have been added.
- */
+ /**
+ * Returns the sum of the squares of the available values.
+ * @return The sum of the squares or Double.NaN if no
+ * values have been added.
+ */
public double getSumsq() {
- return apply(new SumOfSquares());
+ return apply(new SumOfSquares());
}
- /**
- * Resets all statistics and storage
- */
- public abstract void clear();
-
- /**
- * Univariate has the ability to return only measures for the
- * last N elements added to the set of values.
- * @return The current window size or -1 if its Infinite.
- */
-
- public abstract int getWindowSize();
-
- /**
- * WindowSize controls the number of values which contribute
- * to the values returned by Univariate. For example, if
- * windowSize is set to 3 and the values {1,2,3,4,5}
- * have been added <strong> in that order</strong>
- * then the <i>available values</i> are {3,4,5} and all
- * reported statistics will be based on these values
- * @param windowSize sets the size of the window.
- */
- public abstract void setWindowSize(int windowSize);
-
+ /**
+ * Resets all statistics and storage
+ */
+ public abstract void clear();
+
+ /**
+ * Univariate has the ability to return only measures for the
+ * last N elements added to the set of values.
+ * @return The current window size or -1 if its Infinite.
+ */
+
+ public abstract int getWindowSize();
+
+ /**
+ * WindowSize controls the number of values which contribute
+ * to the values returned by Univariate. For example, if
+ * windowSize is set to 3 and the values {1,2,3,4,5}
+ * have been added <strong> in that order</strong>
+ * then the <i>available values</i> are {3,4,5} and all
+ * reported statistics will be based on these values
+ * @param windowSize sets the size of the window.
+ */
+ public abstract void setWindowSize(int windowSize);
+
/**
* Returns the current set of values in an array of double primitives.
* The order of addition is preserved. The returned array is a fresh
@@ -240,7 +240,7 @@
* @return returns the current set of numbers in the order in which they
* were added to this set
*/
- public abstract double[] getValues();
+ public abstract double[] getValues();
/**
* Returns the current set of values in an array of double primitives,
@@ -261,7 +261,7 @@
* @param index The Index of the element
* @return return the element at the specified index
*/
- public abstract double getElement(int index);
+ public abstract double getElement(int index);
/**
* Returns an estimate for the pth percentile of the stored values.
@@ -281,9 +281,9 @@
* values
*/
public double getPercentile(double p) {
- return apply(new Percentile(p));
+ return apply(new Percentile(p));
}
-
+
/**
* Generates a text report displaying
* univariate statistics from values that
@@ -291,23 +291,23 @@
* @return String with line feeds displaying statistics
*/
public String toString() {
- StringBuffer outBuffer = new StringBuffer();
- outBuffer.append("UnivariateImpl:\n");
- outBuffer.append("n: " + getN() + "\n");
- outBuffer.append("min: " + getMin() + "\n");
- outBuffer.append("max: " + getMax() + "\n");
- outBuffer.append("mean: " + getMean() + "\n");
- outBuffer.append("std dev: " + getStandardDeviation() + "\n");
- outBuffer.append("skewness: " + getSkewness() + "\n");
- outBuffer.append("kurtosis: " + getKurtosis() + "\n");
- return outBuffer.toString();
+ StringBuffer outBuffer = new StringBuffer();
+ outBuffer.append("UnivariateImpl:\n");
+ outBuffer.append("n: " + getN() + "\n");
+ outBuffer.append("min: " + getMin() + "\n");
+ outBuffer.append("max: " + getMax() + "\n");
+ outBuffer.append("mean: " + getMean() + "\n");
+ outBuffer.append("std dev: " + getStandardDeviation() + "\n");
+ outBuffer.append("skewness: " + getSkewness() + "\n");
+ outBuffer.append("kurtosis: " + getKurtosis() + "\n");
+ return outBuffer.toString();
}
- /**
- * Apply the given statistic to the data associated with this set of statistics.
- * @param stat the statistic to apply
- * @return the computed value of the statistic.
- */
- public abstract double apply(UnivariateStatistic stat);
+ /**
+ * Apply the given statistic to the data associated with this set of statistics.
+ * @param stat the statistic to apply
+ * @return the computed value of the statistic.
+ */
+ public abstract double apply(UnivariateStatistic stat);
}
1.8 +7 -7 jakarta-commons/math/src/java/org/apache/commons/math/stat/univariate/DescriptiveStatisticsImpl.java
Index: DescriptiveStatisticsImpl.java
===================================================================
RCS file: /home/cvs/jakarta-commons/math/src/java/org/apache/commons/math/stat/univariate/DescriptiveStatisticsImpl.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- DescriptiveStatisticsImpl.java 14 Jun 2004 21:41:33 -0000 1.7
+++ DescriptiveStatisticsImpl.java 14 Jun 2004 23:26:53 -0000 1.8
@@ -30,8 +30,8 @@
/** Serializable version identifier */
static final long serialVersionUID = -1868088725461221010L;
- /** hold the window size **/
- protected int windowSize;
+ /** hold the window size **/
+ protected int windowSize;
/**
* Stored data values
@@ -42,7 +42,7 @@
* Construct a DescriptiveStatisticsImpl with infinite window
*/
public DescriptiveStatisticsImpl() {
- this(INFINITE_WINDOW);
+ this(INFINITE_WINDOW);
}
/**
@@ -50,8 +50,8 @@
* @param window the finite window size.
*/
public DescriptiveStatisticsImpl(int window) {
- super();
- eDA = new ResizableDoubleArray();
+ super();
+ eDA = new ResizableDoubleArray();
setWindowSize(window);
}
@@ -60,7 +60,7 @@
* @return the current window size.
*/
public int getWindowSize() {
- return windowSize;
+ return windowSize;
}
/**
1.3 +39 -39 jakarta-commons/math/src/java/org/apache/commons/math/stat/univariate/StatisticalSummary.java
Index: StatisticalSummary.java
===================================================================
RCS file: /home/cvs/jakarta-commons/math/src/java/org/apache/commons/math/stat/univariate/StatisticalSummary.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- StatisticalSummary.java 27 Apr 2004 04:37:59 -0000 1.2
+++ StatisticalSummary.java 14 Jun 2004 23:26:53 -0000 1.3
@@ -21,42 +21,42 @@
* @version $Revision$ $Date$
*/
public interface StatisticalSummary {
- /**
- * Returns the <a href="http://www.xycoon.com/arithmetic_mean.htm">
- * arithmetic mean </a> of the available values
- * @return The mean or Double.NaN if no values have been added.
- */
- public abstract double getMean();
- /**
- * Returns the variance of the available values.
- * @return The variance, Double.NaN if no values have been added
- * or 0.0 for a single value set.
- */
- public abstract double getVariance();
- /**
- * Returns the standard deviation of the available values.
- * @return The standard deviation, Double.NaN if no values have been added
- * or 0.0 for a single value set.
- */
- public abstract double getStandardDeviation();
- /**
- * Returns the maximum of the available values
- * @return The max or Double.NaN if no values have been added.
- */
- public abstract double getMax();
- /**
- * Returns the minimum of the available values
- * @return The min or Double.NaN if no values have been added.
- */
- public abstract double getMin();
- /**
- * Returns the number of available values
- * @return The number of available values
- */
- public abstract long getN();
- /**
- * Returns the sum of the values that have been added to Univariate.
- * @return The sum or Double.NaN if no values have been added
- */
- public abstract double getSum();
+ /**
+ * Returns the <a href="http://www.xycoon.com/arithmetic_mean.htm">
+ * arithmetic mean </a> of the available values
+ * @return The mean or Double.NaN if no values have been added.
+ */
+ public abstract double getMean();
+ /**
+ * Returns the variance of the available values.
+ * @return The variance, Double.NaN if no values have been added
+ * or 0.0 for a single value set.
+ */
+ public abstract double getVariance();
+ /**
+ * Returns the standard deviation of the available values.
+ * @return The standard deviation, Double.NaN if no values have been added
+ * or 0.0 for a single value set.
+ */
+ public abstract double getStandardDeviation();
+ /**
+ * Returns the maximum of the available values
+ * @return The max or Double.NaN if no values have been added.
+ */
+ public abstract double getMax();
+ /**
+ * Returns the minimum of the available values
+ * @return The min or Double.NaN if no values have been added.
+ */
+ public abstract double getMin();
+ /**
+ * Returns the number of available values
+ * @return The number of available values
+ */
+ public abstract long getN();
+ /**
+ * Returns the sum of the values that have been added to Univariate.
+ * @return The sum or Double.NaN if no values have been added
+ */
+ public abstract double getSum();
}
1.7 +111 -111 jakarta-commons/math/src/java/org/apache/commons/math/stat/univariate/SummaryStatistics.java
Index: SummaryStatistics.java
===================================================================
RCS file: /home/cvs/jakarta-commons/math/src/java/org/apache/commons/math/stat/univariate/SummaryStatistics.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- SummaryStatistics.java 1 Jun 2004 21:34:35 -0000 1.6
+++ SummaryStatistics.java 14 Jun 2004 23:26:53 -0000 1.7
@@ -29,8 +29,8 @@
/** Serialization UID */
static final long serialVersionUID = -6400596334135654825L;
- /**
- * Create an instance of a <code>SummaryStatistics</code>
+ /**
+ * Create an instance of a <code>SummaryStatistics</code>
* @param cls the type of <code>SummaryStatistics</code> object to
* create.
* @return a new factory.
@@ -40,13 +40,13 @@
* constructor is not accessible.
* @throws ClassNotFoundException if the named
* <code>SummaryStatistics</code> type can not be found.
- */
- public static SummaryStatistics newInstance(String cls) throws InstantiationException, IllegalAccessException, ClassNotFoundException {
- return newInstance(Class.forName(cls));
- }
+ */
+ public static SummaryStatistics newInstance(String cls) throws InstantiationException, IllegalAccessException, ClassNotFoundException {
+ return newInstance(Class.forName(cls));
+ }
- /**
- * Create an instance of a <code>DescriptiveStatistics</code>
+ /**
+ * Create an instance of a <code>DescriptiveStatistics</code>
* @param cls the type of <code>SummaryStatistics</code> object to
* create.
* @return a new factory.
@@ -54,108 +54,108 @@
* created.
* @throws IllegalAccessException is thrown if the type's default
* constructor is not accessible.
- */
- public static SummaryStatistics newInstance(Class cls) throws InstantiationException, IllegalAccessException {
- return (SummaryStatistics)cls.newInstance();
- }
-
- /**
- * Create an instance of a <code>DescriptiveStatistics</code>
- * @return a new factory.
- */
- public static SummaryStatistics newInstance() {
- SummaryStatistics factory = null;
- try {
- DiscoverClass dc = new DiscoverClass();
- factory = (SummaryStatistics) dc.newInstance(
- SummaryStatistics.class,
- "org.apache.commons.math.stat.univariate.SummaryStatisticsImpl");
- } catch(Exception ex) {
- // ignore as default implementation will be used.
- }
- return factory;
- }
-
-
- /**
- * Return a StatisticalSummaryValues instance reporting current statistics.
- *
- * @return Current values of statistics
- */
- public StatisticalSummary getSummary() {
- return new StatisticalSummaryValues(getMean(), getVariance(), getN(),
- getMax(), getMin(), getSum());
- }
-
- /**
- * Adds the value to the data to be summarized
- * @param v the value to be added
- */
- public abstract void addValue(double v);
-
- /**
- * Returns the <a href="http://www.xycoon.com/arithmetic_mean.htm">
- * arithmetic mean </a> of the available values
- * @return The mean or Double.NaN if no values have been added.
- */
- public abstract double getMean();
-
- /**
- * Returns the <a href="http://www.xycoon.com/geometric_mean.htm">
- * geometric mean </a> of the available values
- * @return The geometricMean, Double.NaN if no values have been added,
- * or if the productof the available values is less than or equal to 0.
- */
- public abstract double getGeometricMean();
-
- /**
- * Returns the variance of the available values.
- * @return The variance, Double.NaN if no values have been added
- * or 0.0 for a single value set.
- */
- public abstract double getVariance();
-
- /**
- * Returns the standard deviation of the available values.
- * @return The standard deviation, Double.NaN if no values have been added
- * or 0.0 for a single value set.
- */
- public abstract double getStandardDeviation();
+ */
+ public static SummaryStatistics newInstance(Class cls) throws InstantiationException, IllegalAccessException {
+ return (SummaryStatistics)cls.newInstance();
+ }
- /**
- * Returns the maximum of the available values
- * @return The max or Double.NaN if no values have been added.
- */
- public abstract double getMax();
-
- /**
- * Returns the minimum of the available values
- * @return The min or Double.NaN if no values have been added.
- */
- public abstract double getMin();
-
- /**
- * Returns the number of available values
- * @return The number of available values
- */
- public abstract long getN();
-
- /**
- * Returns the sum of the values that have been added to Univariate.
- * @return The sum or Double.NaN if no values have been added
- */
- public abstract double getSum();
-
- /**
- * Returns the sum of the squares of the available values.
- * @return The sum of the squares or Double.NaN if no
- * values have been added.
- */
- public abstract double getSumsq();
-
- /**
- * Resets all statistics
- */
- public abstract void clear();
+ /**
+ * Create an instance of a <code>DescriptiveStatistics</code>
+ * @return a new factory.
+ */
+ public static SummaryStatistics newInstance() {
+ SummaryStatistics factory = null;
+ try {
+ DiscoverClass dc = new DiscoverClass();
+ factory = (SummaryStatistics) dc.newInstance(
+ SummaryStatistics.class,
+ "org.apache.commons.math.stat.univariate.SummaryStatisticsImpl");
+ } catch(Exception ex) {
+ // ignore as default implementation will be used.
+ }
+ return factory;
+ }
+
+
+ /**
+ * Return a StatisticalSummaryValues instance reporting current statistics.
+ *
+ * @return Current values of statistics
+ */
+ public StatisticalSummary getSummary() {
+ return new StatisticalSummaryValues(getMean(), getVariance(), getN(),
+ getMax(), getMin(), getSum());
+ }
+
+ /**
+ * Adds the value to the data to be summarized
+ * @param v the value to be added
+ */
+ public abstract void addValue(double v);
+
+ /**
+ * Returns the <a href="http://www.xycoon.com/arithmetic_mean.htm">
+ * arithmetic mean </a> of the available values
+ * @return The mean or Double.NaN if no values have been added.
+ */
+ public abstract double getMean();
+
+ /**
+ * Returns the <a href="http://www.xycoon.com/geometric_mean.htm">
+ * geometric mean </a> of the available values
+ * @return The geometricMean, Double.NaN if no values have been added,
+ * or if the productof the available values is less than or equal to 0.
+ */
+ public abstract double getGeometricMean();
+
+ /**
+ * Returns the variance of the available values.
+ * @return The variance, Double.NaN if no values have been added
+ * or 0.0 for a single value set.
+ */
+ public abstract double getVariance();
+
+ /**
+ * Returns the standard deviation of the available values.
+ * @return The standard deviation, Double.NaN if no values have been added
+ * or 0.0 for a single value set.
+ */
+ public abstract double getStandardDeviation();
+
+ /**
+ * Returns the maximum of the available values
+ * @return The max or Double.NaN if no values have been added.
+ */
+ public abstract double getMax();
+
+ /**
+ * Returns the minimum of the available values
+ * @return The min or Double.NaN if no values have been added.
+ */
+ public abstract double getMin();
+
+ /**
+ * Returns the number of available values
+ * @return The number of available values
+ */
+ public abstract long getN();
+
+ /**
+ * Returns the sum of the values that have been added to Univariate.
+ * @return The sum or Double.NaN if no values have been added
+ */
+ public abstract double getSum();
+
+ /**
+ * Returns the sum of the squares of the available values.
+ * @return The sum of the squares or Double.NaN if no
+ * values have been added.
+ */
+ public abstract double getSumsq();
+
+ /**
+ * Resets all statistics
+ */
+ public abstract void clear();
}
1.4 +11 -11 jakarta-commons/math/src/java/org/apache/commons/math/stat/univariate/SummaryStatisticsImpl.java
Index: SummaryStatisticsImpl.java
===================================================================
RCS file: /home/cvs/jakarta-commons/math/src/java/org/apache/commons/math/stat/univariate/SummaryStatisticsImpl.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- SummaryStatisticsImpl.java 1 Jun 2004 21:34:35 -0000 1.3
+++ SummaryStatisticsImpl.java 14 Jun 2004 23:26:53 -0000 1.4
@@ -85,14 +85,14 @@
* @param value the value to add
*/
public void addValue(double value) {
- sum.increment(value);
- sumsq.increment(value);
- min.increment(value);
- max.increment(value);
- sumLog.increment(value);
- geoMean.increment(value);
- secondMoment.increment(value);
- n++;
+ sum.increment(value);
+ sumsq.increment(value);
+ min.increment(value);
+ max.increment(value);
+ sumLog.increment(value);
+ geoMean.increment(value);
+ secondMoment.increment(value);
+ n++;
}
/**
@@ -214,8 +214,8 @@
}
/**
- * Resets all statistics and storage
- */
+ * Resets all statistics and storage
+ */
public void clear() {
this.n = 0;
min.clear();
1.6 +23 -23 jakarta-commons/math/src/java/org/apache/commons/math/stat/univariate/package.html
Index: package.html
===================================================================
RCS file: /home/cvs/jakarta-commons/math/src/java/org/apache/commons/math/stat/univariate/package.html,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- package.html 26 Apr 2004 18:28:18 -0000 1.5
+++ package.html 14 Jun 2004 23:26:53 -0000 1.6
@@ -14,27 +14,27 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
- <!-- $Revision$ $Date$ -->
- <body>
- Generic univariate summary statistic objects.
-
- <h3>UnivariateStatistic API Usage Examples:</h3>
- <h4>UnivariateStatistic:</h4>
- <code>/* evaluation approach */<br/> double[] values = new double[] { 1, 2,
- 3, 4, 5 };<br/> <span style="font-weight: bold;">UnivariateStatistic stat
- = new Mean();</span><br/> System.out.println("mean = " + <span
- style="font-weight: bold;">stat.evaluate(values)</span>);<br/> </code>
- <h4>StorelessUnivariateStatistic:</h4>
- <code>/* incremental approach */<br/> double[] values = new double[] { 1, 2,
- 3, 4, 5 };<br/> <span style="font-weight: bold;">
- StorelessUnivariateStatistic stat = new Mean();</span><br/>
- System.out.println("mean before adding a value is NaN = " + <span
- style="font-weight: bold;">stat.getResult()</span>);<br/> for (int i = 0;
- i < values.length; i++) {<br/> <span
- style="font-weight: bold;">stat.increment(values[i]);</span><br/>
- System.out.println("current mean = " + <span style="font-weight: bold;">
- stat2.getResult()</span>);<br/> }<br/> <span style="font-weight: bold;">
- stat.clear();</span><br/> System.out.println("mean after clear is NaN = "
- + <span style="font-weight: bold;">stat.getResult()</span>);</code>
- </body>
+ <!-- $Revision$ $Date$ -->
+ <body>
+ Generic univariate summary statistic objects.
+
+ <h3>UnivariateStatistic API Usage Examples:</h3>
+ <h4>UnivariateStatistic:</h4>
+ <code>/* evaluation approach */<br/> double[] values = new double[] { 1, 2,
+ 3, 4, 5 };<br/> <span style="font-weight: bold;">UnivariateStatistic stat
+ = new Mean();</span><br/> System.out.println("mean = " + <span
+ style="font-weight: bold;">stat.evaluate(values)</span>);<br/> </code>
+ <h4>StorelessUnivariateStatistic:</h4>
+ <code>/* incremental approach */<br/> double[] values = new double[] { 1, 2,
+ 3, 4, 5 };<br/> <span style="font-weight: bold;">
+ StorelessUnivariateStatistic stat = new Mean();</span><br/>
+ System.out.println("mean before adding a value is NaN = " + <span
+ style="font-weight: bold;">stat.getResult()</span>);<br/> for (int i = 0;
+ i < values.length; i++) {<br/> <span
+ style="font-weight: bold;">stat.increment(values[i]);</span><br/>
+ System.out.println("current mean = " + <span style="font-weight: bold;">
+ stat2.getResult()</span>);<br/> }<br/> <span style="font-weight: bold;">
+ stat.clear();</span><br/> System.out.println("mean after clear is NaN = "
+ + <span style="font-weight: bold;">stat.getResult()</span>);</code>
+ </body>
</html>
1.5 +2 -2 jakarta-commons/math/src/java/org/apache/commons/math/stat/univariate/moment/package.html
Index: package.html
===================================================================
RCS file: /home/cvs/jakarta-commons/math/src/java/org/apache/commons/math/stat/univariate/moment/package.html,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- package.html 26 Apr 2004 18:28:17 -0000 1.4
+++ package.html 14 Jun 2004 23:26:53 -0000 1.5
@@ -14,6 +14,6 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
- <!-- $Revision$ $Date$ -->
- <body>Summary statistics based on moments.</body>
+ <!-- $Revision$ $Date$ -->
+ <body>Summary statistics based on moments.</body>
</html>
1.5 +2 -2 jakarta-commons/math/src/java/org/apache/commons/math/stat/univariate/rank/package.html
Index: package.html
===================================================================
RCS file: /home/cvs/jakarta-commons/math/src/java/org/apache/commons/math/stat/univariate/rank/package.html,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- package.html 26 Apr 2004 18:28:17 -0000 1.4
+++ package.html 14 Jun 2004 23:26:54 -0000 1.5
@@ -14,6 +14,6 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
- <!-- $Revision$ $Date$ -->
- <body>Summary statistics based on ranks.</body>
+ <!-- $Revision$ $Date$ -->
+ <body>Summary statistics based on ranks.</body>
</html>
1.5 +2 -2 jakarta-commons/math/src/java/org/apache/commons/math/stat/univariate/summary/package.html
Index: package.html
===================================================================
RCS file: /home/cvs/jakarta-commons/math/src/java/org/apache/commons/math/stat/univariate/summary/package.html,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- package.html 26 Apr 2004 18:28:16 -0000 1.4
+++ package.html 14 Jun 2004 23:26:54 -0000 1.5
@@ -14,6 +14,6 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
- <!-- $Revision$ $Date$ -->
- <body>Other summary statistics.</body>
+ <!-- $Revision$ $Date$ -->
+ <body>Other summary statistics.</body>
</html>
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org