de.jstacs.classifiers.utils
Class PValueComputation

java.lang.Object
  extended by de.jstacs.classifiers.utils.PValueComputation

public class PValueComputation
extends Object

This class can be used to compute any p-value from a given statistic. Therefore the array of scores has to be sorted.

Author:
Jens Keilwagen
See Also:
Arrays.sort(double[])

Constructor Summary
PValueComputation()
           
 
Method Summary
static int getBorder(double[] sortedScores, double pValue)
          This method finds the first index that has a significant score.
static int getIndex(double[] sortedScores, double myScore)
          This method searches in sortedScores for the index i so that sortedScores[i-1] < myScore <= sortedScores[i].
static int getIndex(double[] sortedScores, double myScore, int start)
          This method searches in sortedScores beginning at start for the index i so that sortedScores[i-1] < myScore <= sortedScores[i].
static double getPValue(double[] sortedScores, double myScore)
          This method searches for the insertion point of the score in a given sorted array of scores and returns the p-value for this score.
static double getPValue(double[] sortedScores, double myScore, int start)
          This method searches for the insertion point of the score in a given sorted array of scores from index start and returns the p-value for this score.
static double getThreshold(double[] sortedScores, int signIndex)
          This method returns the threshold that determines if an observed score is significant.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PValueComputation

public PValueComputation()
Method Detail

getPValue

public static final double getPValue(double[] sortedScores,
                                     double myScore)
This method searches for the insertion point of the score in a given sorted array of scores and returns the p-value for this score.

Parameters:
sortedScores - the array of sorted scores
myScore - the score that is searched in the array and that corresponds to the p-value
Returns:
the p-value for the score
See Also:
Arrays.sort(double[]), getIndex(double[], double)

getPValue

public static final double getPValue(double[] sortedScores,
                                     double myScore,
                                     int start)
This method searches for the insertion point of the score in a given sorted array of scores from index start and returns the p-value for this score.

Parameters:
sortedScores - the array of sorted scores
myScore - the score that is searched in the array and that corresponds to the p-value
start - the start position in the array where to start the search (accelerates the search)
Returns:
the p-value for the score
See Also:
Arrays.sort(double[]), getIndex(double[], double, int)

getIndex

public static final int getIndex(double[] sortedScores,
                                 double myScore)
This method searches in sortedScores for the index i so that sortedScores[i-1] < myScore <= sortedScores[i]. This index could be seen as insertion point for myScore.

Parameters:
sortedScores - the array of sorted scores
myScore - the current score
Returns:
the index where myScore should be inserted
See Also:
Arrays.sort(double[]), getIndex(double[], double, int)

getIndex

public static final int getIndex(double[] sortedScores,
                                 double myScore,
                                 int start)
This method searches in sortedScores beginning at start for the index i so that sortedScores[i-1] < myScore <= sortedScores[i]. This index could be seen as insertion point for myScore.

Parameters:
sortedScores - the array of sorted scores
myScore - the current score
start - the start index (inclusive)
Returns:
the index where myScore should be inserted
See Also:
Arrays.sort(double[])

getBorder

public static final int getBorder(double[] sortedScores,
                                  double pValue)
This method finds the first index that has a significant score.

Parameters:
sortedScores - the array of sorted scores
pValue - the p-value that is used to determine what is significant and what not (the smaller, the more significant)
Returns:
the index of the first significant score
See Also:
Arrays.sort(double[])

getThreshold

public static final double getThreshold(double[] sortedScores,
                                        int signIndex)
This method returns the threshold that determines if an observed score is significant. The observed score is significant if it is bigger than the threshold.

Parameters:
sortedScores - the array of sorted scores
signIndex - the index of the first significant score
Returns:
the threshold