edu.northwestern.at.utils.math.statistics
Class ContingencyTable

java.lang.Object
  extended by edu.northwestern.at.utils.math.statistics.ContingencyTable

public class ContingencyTable
extends java.lang.Object

Statistical analysis of a two-way contingency table.


Constructor Summary
protected ContingencyTable()
          Don't allow instantiation but do allow overrides.
 
Method Summary
static double chisquare(Matrix table)
          Compute chisquare for a table of frequencies.
static double[] fishersExactTest(Matrix table)
          Compute Fisher's exact test for a 2x2 table.
static double likelihoodRatio(Matrix table)
          Compute likelihood ratio for a table of frequencies.
protected static double logLikelihood(Matrix p, double total, Matrix k, int columns)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ContingencyTable

protected ContingencyTable()
Don't allow instantiation but do allow overrides.

Method Detail

chisquare

public static double chisquare(Matrix table)
Compute chisquare for a table of frequencies.

Parameters:
table - A matrix containing the table.
Returns:
Pearson's chisquare for the table.

logLikelihood

protected static double logLikelihood(Matrix p,
                                      double total,
                                      Matrix k,
                                      int columns)

likelihoodRatio

public static double likelihoodRatio(Matrix table)
Compute likelihood ratio for a table of frequencies.

Parameters:
table - A matrix containing the table.
Returns:
Likelihood ratio for the table.

fishersExactTest

public static double[] fishersExactTest(Matrix table)
Compute Fisher's exact test for a 2x2 table.

Parameters:
table - The table (must be 2x2).
Returns:
double array with three entries.
Throws:
java.lang.RuntimeException - If the