public class PearsonsCorrelationextends ObjectComputes Pearson's product-moment correlation coefficients for pairs of arrays or columns of a matrix.
The constructors that take
doublearguments generate correlation matrices. The columns of the input matrices are assumed to represent variable values. Correlations are given by the formula
cor(X, Y) = Σ[(xi - E(X))(yi - E(Y))] / [(n - 1)s(X)s(Y)]where
E(X)is the mean of
E(Y)is the mean of the
Yvalues and s(X), s(Y) are standard deviations.
To compute the correlation coefficient for a single pair of arrays, use
PearsonsCorrelation()to construct an instance with no data and then
correlation(double, double). Correlation matrices can also be computed directly from an instance with no data using
computeCorrelationMatrix(double). In order to use
getCorrelationStandardErrors(); however, one of the constructors supplying data or a covariance matrix must be used to create the instance.