procope.tools.math
Class PearsonCoefficient

java.lang.Object
  extended by procope.tools.math.PearsonCoefficient
All Implemented Interfaces:
CorrelationCoefficient

public class PearsonCoefficient
extends Object
implements CorrelationCoefficient

Implements the Pearson product-moment correlation coefficient which calculates the correlation between two given lists of data points.

See also: Wikipedia

Author:
Jan Krumsiek

Constructor Summary
PearsonCoefficient()
           
 
Method Summary
 void feedData(Collection<Point> data)
          Feeds a list of data points into the dataset.
 void feedData(float x, float y)
          Feeds one data point into the dataset
 void feedData(Point p)
          Feeds one data point into the dataset
 float getCorrelationCoefficient()
          Calculates the Pearson correlation coefficient for the current dataset.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PearsonCoefficient

public PearsonCoefficient()
Method Detail

feedData

public void feedData(Collection<Point> data)
Description copied from interface: CorrelationCoefficient
Feeds a list of data points into the dataset.

Specified by:
feedData in interface CorrelationCoefficient
Parameters:
data - list of points.

feedData

public void feedData(Point p)
Description copied from interface: CorrelationCoefficient
Feeds one data point into the dataset

Specified by:
feedData in interface CorrelationCoefficient
Parameters:
p - data point to be added

feedData

public void feedData(float x,
                     float y)
Description copied from interface: CorrelationCoefficient
Feeds one data point into the dataset

Specified by:
feedData in interface CorrelationCoefficient
Parameters:
x - data point's x
y - data point's y

getCorrelationCoefficient

public float getCorrelationCoefficient()
Calculates the Pearson correlation coefficient for the current dataset.

Specified by:
getCorrelationCoefficient in interface CorrelationCoefficient
Returns:
correlation coefficient of current list of data points