baseCode.math
Class CorrelationStats

java.lang.Object
  extended bybaseCode.math.CorrelationStats

public class CorrelationStats
extends java.lang.Object

Statistical evaluation and transformation tools for correlations.

Copyright (c) 2004

Institution:: Columbia University

Version:
$Id: CorrelationStats.java,v 1.11 2005/01/05 17:59:19 pavlidis Exp $
Author:
Paul Pavlidis

Constructor Summary
CorrelationStats()
           
 
Method Summary
static double byteToCorrel(int correlByte)
           
static double byteToPvalue(int pvalByte)
           
static double compare(double correl1, int n1, double correl2, int n2)
          Statistical comparison of two correlations.
static int correlAsByte(double correl)
           
static double correlationForPvalue(double pval, int count)
          Find the approximate correlation required to meet a particular pvalue.
static double correlationTstat(double correl, int dof)
          Compute the t-statistic associated with a Pearson correlation.
static double fisherTransform(double r)
          Compute the Fisher z transform of the Pearson correlation.
static cern.colt.list.DoubleArrayList fisherTransform(cern.colt.list.DoubleArrayList e)
          Fisher-transform a list of correlations.
static boolean isValidPearsonCorrelation(double r)
          Test if a value is a reasonable Pearson correlation (in the range -1 to 1; values outside of this range are acceptable within a small roundoff.
static double pvalue(double correl, int count)
           
static int pvalueAsByte(double correl, int count)
          Conver a correlation p value into a value between 0 and 255 inclusive.
static double unFisherTransform(double r)
          Reverse the Fisher z-transform of correlations.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CorrelationStats

public CorrelationStats()
Method Detail

pvalue

public static double pvalue(double correl,
                            int count)
Parameters:
correl - Pearson correlation.
count - Number of items used to calculate the correlation. NOT the degrees of freedom.
Returns:
double

correlAsByte

public static int correlAsByte(double correl)
Parameters:
correl - double
Returns:
int

unFisherTransform

public static double unFisherTransform(double r)
Reverse the Fisher z-transform of correlations.

Parameters:
r -
Returns:

fisherTransform

public static double fisherTransform(double r)
Compute the Fisher z transform of the Pearson correlation.

Parameters:
r - Correlation coefficient.
Returns:
Fisher transform of the Correlation.

fisherTransform

public static cern.colt.list.DoubleArrayList fisherTransform(cern.colt.list.DoubleArrayList e)
Fisher-transform a list of correlations.

Parameters:
e -
Returns:

pvalueAsByte

public static int pvalueAsByte(double correl,
                               int count)
Conver a correlation p value into a value between 0 and 255 inclusive. This is done by taking the log, multiplying it by a fixed value (currently 8). This means that pvalues less than 10^-32 are rounded to 10^-32.

Parameters:
correl - double
count - int
Returns:
int

byteToPvalue

public static double byteToPvalue(int pvalByte)
Parameters:
pvalByte - int
Returns:
double

byteToCorrel

public static double byteToCorrel(int correlByte)
Parameters:
correlByte - int
Returns:
double

correlationTstat

public static double correlationTstat(double correl,
                                      int dof)
Compute the t-statistic associated with a Pearson correlation.

Parameters:
correl - Pearson correlation
dof - Degrees of freedom (n - 2)
Returns:
double

compare

public static double compare(double correl1,
                             int n1,
                             double correl2,
                             int n2)
Statistical comparison of two correlations. Assumes data are bivariate normal. Null hypothesis is that the two correlations are equal. See Zar (Biostatistics)

Parameters:
correl1 - First correlation
n1 - Number of values used to compute correl1
correl2 - Second correlation
n2 - Number of values used to compute correl2
Returns:
double p value.

correlationForPvalue

public static double correlationForPvalue(double pval,
                                          int count)
Find the approximate correlation required to meet a particular pvalue. This works by simple gradient descent.

Parameters:
pval - double
count - int
Returns:
double

isValidPearsonCorrelation

public static boolean isValidPearsonCorrelation(double r)
Test if a value is a reasonable Pearson correlation (in the range -1 to 1; values outside of this range are acceptable within a small roundoff.

Parameters:
r -
Returns:


Copyright © 2003-2005 Columbia University. All Rights Reserved.