Package com.actelion.research.calc
Class CorrelationCalculator
- java.lang.Object
-
- com.actelion.research.calc.CorrelationCalculator
-
public class CorrelationCalculator extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description static int
TYPE_BRAVAIS_PEARSON
static java.lang.String[]
TYPE_CODE
static java.lang.String[]
TYPE_LONG_NAME
static java.lang.String[]
TYPE_NAME
static int
TYPE_NONE
static int
TYPE_SPEARMAN
-
Constructor Summary
Constructors Constructor Description CorrelationCalculator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double
calculateCorrelation(INumericalDataColumn column1, INumericalDataColumn column2, int correlationType)
Calculates the correlation coefficient between two columns of data.double[][]
calculateMatrix(INumericalDataColumn[] numericalColumn, int type)
Calculates a half correlation matrix of all passed numerical columnsint
getValueCount()
int[][]
getValueCountMatrix()
-
-
-
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
-
TYPE_NONE
public static final int TYPE_NONE
- See Also:
- Constant Field Values
-
TYPE_BRAVAIS_PEARSON
public static final int TYPE_BRAVAIS_PEARSON
- See Also:
- Constant Field Values
-
TYPE_SPEARMAN
public static final int TYPE_SPEARMAN
- See Also:
- Constant Field Values
-
-
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
-
-