Documentation of 'smile.stat.hypothesis.CorTest' Java class
CorTest
smile.stat.hypothesis

Class CorTest



  • public class CorTest
    extends java.lang.Object
    Correlation test. Correlation of two variables is a measure of the degree to which they vary together. More accurately, correlation is the covariation of standardized variables. In positive correlation, as one variable increases, so also does the other. In negative correlation, as one variable increases, the other variable decreases. Perfect positive correlation usually is calculated as a value of 1 (or 100%). Perfect negative correlation usually is calculated as a value of -1. A values of zero shows no correlation at all.

    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

    Equidistant positions on variables measured?

    Y

    Spearman correlation

    N

    Kendall correlation

    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 nonnegative integers giving the number of observed events for each combination of row and column.

    • Field Summary

      Fields 
      Modifier and Type Field and Description
      double cor
      Correlation coefficient
      double df
      Degree of freedom
      double pvalue
      (two-sided) p-value of test
      double t
      test statistic
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method and Description
      static CorTest chisq(int[][] table)
      Given a two-dimensional contingency table in the form of an array of integers, returns Chi-square test for independence.
      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.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • cor

        public double cor
        Correlation coefficient
      • df

        public double df
        Degree of freedom
      • t

        public double t
        test statistic
      • pvalue

        public double pvalue
        (two-sided) p-value of test
    • Method Detail

      • pearson

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

        public static CorTest spearman(double[] x,
                                       double[] y)
        Spearman rank correlation coefficient test. The Spearman Rank Correlation Coefficient is a form of the Pearson coefficient with the data converted to rankings (ie. 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.

      • kendall

        public static CorTest kendall(double[] x,
                                      double[] y)
        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 for n > 10.
      • chisq

        public static CorTest chisq(int[][] table)
        Given a two-dimensional contingency table in the form of an array of integers, returns Chi-square test for independence. The rows of contingency table are labels by the values of one nominal variable, the 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. Continuity correction will be applied when computing the test statistic for 2x2 tables: one half is subtracted from all |O-E| differences. The correlation coefficient is calculated as Cramer's V.

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.