Record Class CorTest
- Record Components:
method- the type of correlation.cor- the correlation coefficient.t- the t-statistic.df- the degree of freedom. It is set to 0 in case of Kendall test as the test is non-parametric.pvalue- the two-sided p-value.
Three common types of correlation are Pearson, Spearman (for ranked data) and Kendall (for uneven or multiple rankings).
To deal with measures of association between nominal variables, we can use Chi-square 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 non-negative integers giving the number of observed events for each combination of row and column.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondoublecor()Returns the value of thecorrecord component.doubledf()Returns the value of thedfrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.static CorTestkendall(double[] x, double[] y) Kendall rank correlation test.method()Returns the value of themethodrecord component.static CorTestpearson(double[] x, double[] y) Pearson correlation coefficient test.doublepvalue()Returns the value of thepvaluerecord component.static CorTestspearman(double[] x, double[] y) Spearman rank correlation coefficient test.doublet()Returns the value of thetrecord component.toString()Returns a string representation of this record class.
-
Constructor Details
-
Method Details
-
toString
-
pearson
Pearson correlation coefficient test.- Parameters:
x- the sample values.y- the sample values.- Returns:
- the test results.
-
spearman
Spearman rank correlation coefficient test. The Spearman Rank Correlation Coefficient is a form of the Pearson coefficient with the data converted to rankings (i.e. when variables are ordinal). It can be used when there is non-parametric data and hence Pearson cannot be used.The raw scores are converted to ranks and the differences between the ranks of each observation on the two variables are calculated.
The p-value is calculated by approximation, which is good for
n > 10.- Parameters:
x- the sample values.y- the sample values.- Returns:
- the test results.
-
kendall
Kendall rank correlation test. The Kendall Tau Rank Correlation Coefficient is used to measure the degree of correspondence between sets of rankings where the measures are not equidistant. It is used with non-parametric data. The p-value is calculated by approximation, which is good forn > 10.- Parameters:
x- the sample values.y- the sample values.- Returns:
- the test results.
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
method
-
cor
-
t
-
df
-
pvalue
-