net.sf.jagg
Class CovarianceAggregator

java.lang.Object
  extended by net.sf.jagg.Aggregator
      extended by net.sf.jagg.TwoPropAggregator
          extended by net.sf.jagg.AbstractCovarianceAggregator
              extended by net.sf.jagg.CovarianceAggregator

public class CovarianceAggregator
extends AbstractCovarianceAggregator

This class represents the "sample covariance" aggregator over two sets of numeric values.

Since:
0.1.0
Author:
Randy Gettman

Field Summary
 
Fields inherited from class net.sf.jagg.AbstractCovarianceAggregator
myCount, mySum1, mySum2, myVarNumerator
 
Fields inherited from class net.sf.jagg.Aggregator
PROP_SELF
 
Constructor Summary
CovarianceAggregator(java.lang.String properties)
          Constructs a CovarianceAggregator on the specified properties, in the format: property, property2.
CovarianceAggregator(java.lang.String property, java.lang.String property2)
          Constructs a CovarianceAggregator that operates on the specified properties.
 
Method Summary
 CovarianceAggregator replicate()
          Returns an uninitialized copy of this Aggregator object, with the same property(ies) to analyze.
 java.lang.Double terminate()
          Return the sample covariance by dividing the variance numerator by (n - 1), where n is the number of non-null pairs of numbers present in the aggregation.
 DoubleDouble terminateDoubleDouble()
          Return the result as a DoubleDouble.
 
Methods inherited from class net.sf.jagg.AbstractCovarianceAggregator
init, iterate, merge
 
Methods inherited from class net.sf.jagg.TwoPropAggregator
getProperty2, setProperty, toString
 
Methods inherited from class net.sf.jagg.Aggregator
equals, getAggregator, getAggregator, getProperty, getValueFromProperty, hashCode, isInUse, setInUse
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CovarianceAggregator

public CovarianceAggregator(java.lang.String properties)
Constructs a CovarianceAggregator on the specified properties, in the format: property, property2.

Parameters:
properties - A specification string in the format: property, property2.

CovarianceAggregator

public CovarianceAggregator(java.lang.String property,
                            java.lang.String property2)
Constructs a CovarianceAggregator that operates on the specified properties.

Parameters:
property - Determine the covariance of this property with the other.
property2 - Determine the covariance of this property with the other.
Method Detail

replicate

public CovarianceAggregator replicate()
Returns an uninitialized copy of this Aggregator object, with the same property(ies) to analyze.

Specified by:
replicate in class Aggregator
Returns:
An uninitialized copy of this Aggregator object.

terminate

public java.lang.Double terminate()
Return the sample covariance by dividing the variance numerator by (n - 1), where n is the number of non-null pairs of numbers present in the aggregation.

Specified by:
terminate in class Aggregator
Returns:
The sample covariance as a Double, NaN if no values have been accumulated, or 0 if exactly one value has been accumulated.

terminateDoubleDouble

public DoubleDouble terminateDoubleDouble()
Return the result as a DoubleDouble. This is used mainly when other Aggregators that use this result must maintain a high precision.

Overrides:
terminateDoubleDouble in class Aggregator
Returns:
The sample covariance as a DoubleDouble, NaN if no values have been accumulated, or 0 if exactly one value has been accumulated.
Since:
0.4.0
See Also:
DoubleDouble


Copyright © 2010-2013 jAgg Team. All Rights Reserved.