edu.msu.cme.rdp.classifier.comparison
Class SigCalculator

java.lang.Object
  extended by edu.msu.cme.rdp.classifier.comparison.SigCalculator

public class SigCalculator
extends java.lang.Object


Field Summary
private  int combinedTotal
           
private  float confidence
           
private  double faction
           
private static int FREQ_LIMIT
           
private  double ratio_1
           
private  double ratio_2
           
private  int s1Total
           
private  int s2Total
           
private  Ztable ztable
           
 
Constructor Summary
SigCalculator(int total1, int total2, float conf)
          Creates a new instance of SigCalculater
 
Method Summary
 double calculateSig(int s1, int s2)
           
(package private)  double calFactorial(int x, int y)
           
 float getConfidence()
           
 int getS1Total()
           
 int getS2Total()
           
(package private)  double largeProportionTest(int s1, int s2)
           
(package private)  double smallProportionTest(int s1, int s2)
          This test works good for small propotion <5% Calculates the probability for y occurrences in sample2 when x occurrences is observed in sample1.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FREQ_LIMIT

private static final int FREQ_LIMIT
See Also:
Constant Field Values

s1Total

private int s1Total

s2Total

private int s2Total

combinedTotal

private int combinedTotal

faction

private double faction

ratio_1

private double ratio_1

ratio_2

private double ratio_2

confidence

private float confidence

ztable

private Ztable ztable
Constructor Detail

SigCalculator

public SigCalculator(int total1,
                     int total2,
                     float conf)
Creates a new instance of SigCalculater

Method Detail

getS1Total

public int getS1Total()

getS2Total

public int getS2Total()

getConfidence

public float getConfidence()

calculateSig

public double calculateSig(int s1,
                           int s2)

smallProportionTest

double smallProportionTest(int s1,
                           int s2)
This test works good for small propotion <5% Calculates the probability for y occurrences in sample2 when x occurrences is observed in sample1. Given sample1 size N1 and sample2 size N2, the probability equation is: p(y|x) = (N2/N1)^y * (x+y)! /x! /y! /(1+N2/N1)^(x+y+1) to avoid data overflow, we modify the equation: p(y|x) = exp( log(p(y|x) ) log(p(y|x) = y*log(N2/N1) - (x+y+1)*log(1+N2/N1) + log( (x+y)!) - log(x!) -log(y!) Because we assume the sample distribution follows the Poisson distribution To calculate the cumulative distribution: we sum p(y|x) for y in [0, y_min] if y/N2 <= x/N1 or p(x|y) for x in [0, x_min] if x/N1 <= y/N2 we need to multiply the p by 2 to give the probability on both end.


calFactorial

double calFactorial(int x,
                    int y)

largeProportionTest

double largeProportionTest(int s1,
                           int s2)