public class CorTest
extends java.lang.Object
Three common types of correlation are Pearson, Spearman (for ranked data) and Kendall (for uneven or multiple rankings), and can be selected using the table below.
Parametric variables follow normal distribution and linear relationship between x and y) 

Y 
Pearson correlation 

N 

To deal with measures of association between nominal variables, we can use Chisquare test for independence. For any pair of nominal variables, the data can be displayed as a contingency table, whose rows are labels by the values of one nominal variable, whose columns are labels by the values of the other nominal variable, and whose entries are nonnegative integers giving the number of observed events for each combination of row and column.
Modifier and Type  Field and Description 

double 
cor
Correlation coefficient

double 
df
Degree of freedom

java.lang.String 
method
A character string indicating what type of test was performed.

double 
pvalue
(twosided) pvalue of test

double 
t
test statistic

Modifier and Type  Method and Description 

static CorTest 
kendall(double[] x,
double[] y)
Kendall rank correlation test.

static CorTest 
pearson(double[] x,
double[] y)
Pearson correlation coefficient test.

static CorTest 
spearman(double[] x,
double[] y)
Spearman rank correlation coefficient test.

java.lang.String 
toString() 
public final java.lang.String method
public final double cor
public final double df
public final double t
public final double pvalue
public java.lang.String toString()
toString
in class java.lang.Object
public static CorTest pearson(double[] x, double[] y)
public static CorTest spearman(double[] x, double[] y)
The raw scores are converted to ranks and the differences between the ranks of each observation on the two variables are calculated.
The pvalue is calculated by approximation, which is good for n > 10.
public static CorTest kendall(double[] x, double[] y)