Computes Pearson's product-moment correlation coefficients for pairs of arrays or columns of a matrix.
The constructors that take RealMatrix or double[][] arguments 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 X, E(Y) is the mean of the Y values and s(X), s(Y) are standard deviations.
To compute the correlation coefficient for a single pair of arrays, use {@link #PearsonsCorrelation()}to construct an instance with no data and then {@link #correlation(double[],double[])}. Correlation matrices can also be computed directly from an instance with no data using {@link #computeCorrelationMatrix(double[][])}. In order to use {@link #getCorrelationMatrix()}, {@link #getCorrelationPValues()}, or {@link #getCorrelationStandardErrors()}; however, one of the constructors supplying data or a covariance matrix must be used to create the instance.
@since 2.0