Class CorrelationCalculator


  • public class CorrelationCalculator
    extends java.lang.Object
    • Field Detail

      • TYPE_LONG_NAME

        public static final java.lang.String[] TYPE_LONG_NAME
      • TYPE_NAME

        public static final java.lang.String[] TYPE_NAME
      • TYPE_CODE

        public static final java.lang.String[] TYPE_CODE
    • Constructor Detail

      • CorrelationCalculator

        public CorrelationCalculator()
    • Method Detail

      • calculateCorrelation

        public double calculateCorrelation​(INumericalDataColumn column1,
                                           INumericalDataColumn column2,
                                           int correlationType)
        Calculates the correlation coefficient between two columns of data. Use the TYPE_BRAVAIS_PEARSON for normal distributed data and the more robust TYPE_SPEARMAN if the data is not normal distributed. If type==TYPE_BRAVAIS_PEARSON and one of a row's values is Double.NaN, then the row is skipped. If less than two valid rows are found or if both columns have a different number of values, than Double.NaN is returned.
        Parameters:
        column1 -
        column2 -
        correlationType -
        Returns:
      • getValueCount

        public int getValueCount()
        Returns:
        number of non-null values used for calculation
      • getValueCountMatrix

        public int[][] getValueCountMatrix()
      • calculateMatrix

        public double[][] calculateMatrix​(INumericalDataColumn[] numericalColumn,
                                          int type)
        Calculates a half correlation matrix of all passed numerical columns
        Parameters:
        numericalColumn -
        type -
        Returns:
        half matrix with matrix.length=numericalColumn.length and matrix[i].length=i