Clover coverage report - baseCode - 0.2.5
Coverage timestamp: Tue Apr 12 2005 11:31:58 EDT
file stats: LOC: 60   Methods: 2
NCLOC: 23   Classes: 1
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover
 
 Source file Conditionals Statements Methods TOTAL
MultipleTestCorrection.java 0% 0% 0% 0%
coverage
 1   
 package baseCode.math;
 2   
 
 3   
 import cern.colt.list.DoubleArrayList;
 4   
 
 5   
 /**
 6   
  * Methods for p-value correction of sets of hypothesis tests.
 7   
  * <p>
 8   
  * Copyright (c) 2004
 9   
  * </p>
 10   
  * <p>
 11   
  * Institution:: Columbia University
 12   
  * </p>
 13   
  * 
 14   
  * @author Paul Pavlidis
 15   
  * @version $Id: MultipleTestCorrection.java,v 1.6 2004/07/27 03:18:57 pavlidis Exp $
 16   
  */
 17   
 public class MultipleTestCorrection {
 18   
 
 19   
    /**
 20   
     * Determine the Bonferroni pvalue threshold to maintain the family wise error rate (assuming pvalues are
 21   
     * independent).
 22   
     * 
 23   
     * @param pvalues The pvalues
 24   
     * @param fwe The family wise error rate
 25   
     * @return The minimum pvalue that maintains the FWE
 26   
     */
 27  0
    public static double BonferroniCut( DoubleArrayList pvalues, double fwe ) {
 28  0
       int numpvals = pvalues.size();
 29  0
       return fwe / numpvals;
 30   
    }
 31   
 
 32   
    /**
 33   
     * Benjamini-Hochberg method. Determines the maximum p value to maintain the false discovery rate. (Assuming pvalues
 34   
     * are independent);
 35   
     * 
 36   
     * @param pvalues list of pvalues. Need not be sorted.
 37   
     * @param fdr false discovery rate
 38   
     * @return The maximum pvalue that maintains the false discovery rate
 39   
     */
 40  0
    public static double BenjaminiHochbergCut( DoubleArrayList pvalues,
 41   
          double fdr ) {
 42  0
       int numpvals = pvalues.size();
 43  0
       DoubleArrayList pvalcop = pvalues.copy();
 44  0
       pvalcop.sort();
 45  0
       pvalcop.reverse();
 46   
 
 47  0
       int n = pvalcop.size();
 48  0
       double thresh = fdr * n / numpvals;
 49   
 
 50  0
       for ( int i = 0; i < n; i++ ) {
 51  0
          double p = pvalcop.get( i );
 52   
 
 53  0
          if ( p < thresh ) {
 54  0
             return p;
 55   
          }
 56   
       }
 57  0
       return 0.0;
 58   
    }
 59   
 
 60   
 }