JavaGrinders
Class ContingencyTable

java.lang.Object
  extended by JavaGrinders.ContingencyTable
Direct Known Subclasses:
DataTable, DominanceTable, InteractionTable

public class ContingencyTable
extends java.lang.Object

contains a crosstabulation frequency table and performs a variety of statistics on it, including G-test, Chi-square, mantel, Kendall's Tau, etc.


Field Summary
 boolean diagonal
           
 int iterated
           
 double itsTotalSum
           
 int MatrixCols
           
 int MatrixRows
           
static int NUM_MAXITERATOR
           
 int PRECISIONMULT
           
 
Constructor Summary
ContingencyTable(double[][] theArray)
          standard constructor for the ContingencyTable class
ContingencyTable(double[][] theArray, boolean diagonal)
          standard constructor for the ContingencyTable class
ContingencyTable(int MatrixCols, int MatrixRows, boolean diagonal)
          standard constructor for the ContingencyTable class
ContingencyTable(int MatrixCols, int MatrixRows, boolean diagonal, java.lang.String theName)
          standard constructor for the ContingencyTable class
ContingencyTable(int MatrixCols, int MatrixRows, java.lang.String theName)
          standard constructor for the ContingencyTable class
ContingencyTable(Matrix aMatrix, boolean diagonal)
          constructor for the ContingencyTable class with a JAMA Matrix provided
 
Method Summary
 double[][] as2DdoubleArray()
          returns the private array of data values for the ContingencyTable
 java.lang.String[][] as2DStringArray()
          returns the private array of data values for the ContingencyTable
 Matrix asJAMAMatrix()
          returns the private array of data values for the ContingencyTable
 ContTableResults calcContingencyResults(ContingencyTable expectMatrix)
          calculates the test of independence and returns ChiSquare and GValue
 GoodnessOfFitResults calcGoodnessOfFitResults()
          calculates the test of independence and returns ChiSquare and GValue
 boolean checkForColumnPs()
          checks whether column probabiities have been set
 boolean checkMatchingMatrixDimensions(ContingencyTable BTable)
          examine whether this matrix has the same dimensions as the one provided?
 boolean checkMatchingRows(Variable aVar)
          examine whether this matrix has the same number of rows as the provided variable
 void checkMatrix()
          examines the matrix for invalid entries
 boolean checkSquare()
          is matrix square?
 void clearColumnPs()
          clears the external probabilities
 void clearPs()
          clears the external probabilities
 void clearSums()
          zero the sums for rows, columns, and total of the ContingencyTable
 void clearTable()
          zero the sums for all individual cells of the ContingencyTable
 void clearTablePs()
          clears the external probabilities
 java.lang.Object clone()
          clone the object
 java.lang.String colToString(int col)
          returns the formatted object as a string
 double DoWilliamsCorr()
          calculates the William's correction
 int fillPerms()
          fills the array with all possible (or desired) permutations
 void fillSums()
          calculate sums for rows, columns and total of the ContingencyTable
 DataTable fold(double[] cells, int rows, int cols, boolean diag)
          folds an array of doubles into a DataTable and returns the object
 double getCellValue(int xLoc, int yLoc)
          returns the double from one element of this matrix
 java.lang.String getColLabel(int column)
          returns a particular column label for the ContingencyTable
 java.lang.String[] getColLabels()
          returns column labels for the ContingencyTable
 double getColSum(int col)
          returns the sum for a particular row of the table
 double[] getColSums()
          returns the row sums of the table
 double[] getColumnPs()
          returns the dimensions of the Table
 ContTableResults getContingencyTableResults()
          returns the results for a test of independence with expected frequencies calculated from observed
 ContTableResults getContingencyTableResults(ContingencyTable expectMatrix)
          returns the results for a test of independence with the provided expected values
 int getdf()
          returns the degrees of freedom for the ContingencyTable
 ContingencyTable getDifferenceTable(ContingencyTable bTable)
          returns a matrix of dominance relationships between actor and receiver
 double[][] getDominanceMatrix()
          returns a matrix of dominance relationships between actor and receiver
 ContingencyTable getExpectedMatrix()
          returns a matrix of expected values for a test of independence
 ContingencyTable getExpectedMatrix(boolean aDiagonal)
          returns a matrix of expected values for a test of independence
 DataTable getExpMatrixDia()
          returns a matrix of expected values for a test of independence
 DataTable getExpMatrixFromProbabilities()
          returns a matrix of expected values for a test of independence
 ContingencyTable getExpMatrixNoDia()
          returns a matrix of expected values for a test of independence if the diagonal is structurally zero
 DataTable getFTukeyDeviates()
          returns Freeman-Tukey deviates for a cell wise examination of the table
 GoodnessOfFitResults getGoodnessOfFitResults()
          coordinates a replicated goodness of fit test
 double getMantelP(ContingencyTable BTable, double actualMantelNumber)
          performs Mantel's test with number of permutations limited by MaxPermutations
 double getMantelZ(ContingencyTable BTable)
          calculate Mantel's Z statistic for a matrix and a second matrix passed in
 int getMatrixSize()
          returns the dimensions of the Table
 java.lang.String getName()
          returns the dimensions of the Table
 int getNCells()
          returns the total number of cells for the ContingencyTable
 int getNCols()
          returns the number of columns of the Table
 double[][] getNoZeroCellMatrix()
          returns the values from the matrix with a constant of 0.25 added to each cell
 int getNRows()
          returns the number of rows of the Table
 ContingencyTable getPermutedTable(int[] permOrder)
          gets a variant of the interactionTable with rows and columns switched with a given permutation
 ContingencyTable getpropMatrixDia()
          returns a matrix of expected values for proportional fitting with diagonal present
 ContingencyTable getpropMatrixNoDia()
          returns a matrix of expected values for proportional fitting with diagonal absent (see Bishop et al., 1975; following Freeman, 1992)
 java.lang.String getRowLabel(int row)
          returns a particular row label for the ContingencyTable
 java.lang.String[] getRowLabels()
          returns row labels for the ContingencyTable
 double getRowSum(int row)
          returns the sum for a particular row of the table
 double[] getRowSums()
          returns the row sums of the table
 double[][] getTablePs()
          returns the dimensions of the Table
 ContingencyTable getTableSubSet(NumberVariable theXVariable)
          returns a subset of row data values for the ContingencyTable as a ContingencyTable.
 double getTauKr()
          organize a TauKr test for a correlation between actor and receiver matrix
 double getTauKrP(double actualKrNumber)
          performs the Kr test with number of permutations limited by MaxPermutations
 double[][] getTotalsMatrix()
          returns a matrix in which cells from actor and receiver section of the ContingencyTable have been summed into a total cell value
 double getTotalSum()
          returns the sum for a particular row of the table
 int getZeroCells()
          returns the number of empty cells for the ContingencyTable
 int howManyPossiblePermutations()
          calculates the number of possible permutations
 void incrementCellValue(int xLoc, int yLoc)
          increments a single cell for this matrix by one
 ContingencyTable invertTable()
          inverts the table with rows to colums and colums to rows
 boolean isMatchingMatrix(ContingencyTable BTable)
          is this matrix the same as the one provided?
 boolean isSquare()
          is matrix square?
 void listContingencyResults()
          does the test and returns its results
 void listExpectedTable()
          lists a matrix of expected values
 void listFTukeyDeviates()
          lists Freeman-Tukey deviates for a cell wise examination of the table
 void listGoodnessOfFitResults()
          reports the results for a replicated goodness of fit test with external hypothesis probabilities
 void listMantelZResults(ContingencyTable BTable)
          lists Mantel's Z for the table
 void listTable()
          lists the table
 void listTable(boolean doSums)
          lists the table
 void listTauKrResults()
          lists the Tau Kr for the table
 java.lang.String noSumsToString()
          returns the formatted table without sums as a string
 java.lang.String rowToString(int row)
          returns the formated object as a string
 void set2DArray(double[][] inMatrix)
          sets a 2D array of doubles for the ContingencyTable
 void setCellValue(int xLoc, int yLoc, double inValue)
          sets a single element for this matrix with a double
 void setColLabel(int column, java.lang.String aString)
          returns a particular column label for the ContingencyTable
 void setColLabels(java.lang.String[] Labels)
          sets new row and column labels for the ContingencyTable
 void setColLabels(java.util.TreeMap Labels)
          sets new row and column labels for the ContingencyTable
 void setColumnPs(double[] thePs)
          sets the expected probabilities for different columns
 void setDefaultRowColLabels()
          sets default labels for row and column labels for the ContingencyTable
 void setDiagonal(boolean diagonal)
          sets the diagonal of the ContingencyTable
 void setMatrixDimensions(int MatrixCols, int MatrixRows, boolean diagonal)
          sets new matrix dimensions for the ContingencyTable
 void setMatrixSize(int MatrixSize)
          sets the dimensions of the DominanceTable
 void setName(java.lang.String theName)
          sets the name for the ContingencyTable
 void setRowColLabels(java.lang.String[] Labels)
          sets new row and column labels for the ContingencyTable
 void setRowColLabels(java.util.TreeMap Labels)
          sets new row and column labels for the ContingencyTable
 void setRowLabel(int row, java.lang.String aString)
          returns a particular column label for the ContingencyTable
 void setRowLabels(java.lang.String[] Labels)
          sets new row and column labels for the ContingencyTable
 void setRowLabels(java.util.TreeMap Labels)
          sets new row and column labels for the ContingencyTable
 void setTablePs(double[][] theTPs)
          sets the expected probabilities for different columns
 double TauKr(ContingencyTable BTable)
          calculate Kendal's tau statistic for a matrix and a second matrix passed in
 void toFile(java.io.BufferedWriter bw)
          writes a ContingencyTable into the writer for a file
 java.lang.String toString(boolean doSums)
          returns the formatted object as a string
 ContingencyTable transpose()
          transposes the table between X and Y dimensions
 double[] unfold()
          unfold the table into an array of doubles
 double[] unfoldUpperTriangle()
          unfold the upper triangle of the table into an array of doubles
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NUM_MAXITERATOR

public static final int NUM_MAXITERATOR
See Also:
Constant Field Values

PRECISIONMULT

public int PRECISIONMULT

MatrixRows

public int MatrixRows

MatrixCols

public int MatrixCols

itsTotalSum

public double itsTotalSum

diagonal

public boolean diagonal

iterated

public int iterated
Constructor Detail

ContingencyTable

public ContingencyTable(int MatrixCols,
                        int MatrixRows,
                        boolean diagonal,
                        java.lang.String theName)
standard constructor for the ContingencyTable class

Parameters:
MatrixCols - number of columns in the table
MatrixRows - number of rows in the table
diagonal - does the table have a diagonal?
theName - the name of the table

ContingencyTable

public ContingencyTable(int MatrixCols,
                        int MatrixRows,
                        boolean diagonal)
standard constructor for the ContingencyTable class

Parameters:
MatrixCols - number of columns in the table
MatrixRows - number of rows in the table
diagonal - does the table have a diagonal?

ContingencyTable

public ContingencyTable(int MatrixCols,
                        int MatrixRows,
                        java.lang.String theName)
standard constructor for the ContingencyTable class

Parameters:
MatrixCols - number of columns in the table
MatrixRows - number of rows in the table

ContingencyTable

public ContingencyTable(double[][] theArray)
standard constructor for the ContingencyTable class

Parameters:
theArray - the 2D array to install into the Table

ContingencyTable

public ContingencyTable(double[][] theArray,
                        boolean diagonal)
standard constructor for the ContingencyTable class

Parameters:
theArray - the array to install into the Table
diagonal - does the table have a diagonal?

ContingencyTable

public ContingencyTable(Matrix aMatrix,
                        boolean diagonal)
constructor for the ContingencyTable class with a JAMA Matrix provided

Parameters:
aMatrix - a JAMA matrix
diagonal - does the table have a diagonal?
Method Detail

getName

public java.lang.String getName()
returns the dimensions of the Table


setName

public void setName(java.lang.String theName)
sets the name for the ContingencyTable

Parameters:
theName - the name of the table

checkForColumnPs

public boolean checkForColumnPs()
                         throws java.lang.Exception
checks whether column probabiities have been set

Throws:
java.lang.Exception

getColumnPs

public double[] getColumnPs()
returns the dimensions of the Table


getTablePs

public double[][] getTablePs()
returns the dimensions of the Table


setTablePs

public void setTablePs(double[][] theTPs)
                throws java.lang.Exception
sets the expected probabilities for different columns

Parameters:
theTPs - the array of probabilities
Throws:
java.lang.Exception

setColumnPs

public void setColumnPs(double[] thePs)
                 throws java.lang.Exception
sets the expected probabilities for different columns

Parameters:
thePs - the array of probabilities
Throws:
java.lang.Exception

clearColumnPs

public void clearColumnPs()
clears the external probabilities


clearTablePs

public void clearTablePs()
clears the external probabilities


clearPs

public void clearPs()
clears the external probabilities


setMatrixDimensions

public void setMatrixDimensions(int MatrixCols,
                                int MatrixRows,
                                boolean diagonal)
                         throws java.lang.Exception
sets new matrix dimensions for the ContingencyTable

Parameters:
MatrixCols - number of columns in the table
MatrixRows - number of rows in the table
diagonal - does the table have a diagonal?
Throws:
java.lang.Exception

getMatrixSize

public int getMatrixSize()
returns the dimensions of the Table


setMatrixSize

public void setMatrixSize(int MatrixSize)
sets the dimensions of the DominanceTable

Parameters:
MatrixSize - number of rows and columns in the table

getNRows

public int getNRows()
returns the number of rows of the Table


getNCols

public int getNCols()
returns the number of columns of the Table


setDiagonal

public void setDiagonal(boolean diagonal)
sets the diagonal of the ContingencyTable

Parameters:
diagonal - does the table contain a diagonal?

setDefaultRowColLabels

public void setDefaultRowColLabels()
sets default labels for row and column labels for the ContingencyTable


setRowColLabels

public void setRowColLabels(java.util.TreeMap Labels)
sets new row and column labels for the ContingencyTable

Parameters:
Labels - the distinct IDs for columns and rows

setRowColLabels

public void setRowColLabels(java.lang.String[] Labels)
sets new row and column labels for the ContingencyTable

Parameters:
Labels - the distinct IDs for columns and rows

setRowLabels

public void setRowLabels(java.util.TreeMap Labels)
sets new row and column labels for the ContingencyTable

Parameters:
Labels - the distinct IDs for rows

setRowLabels

public void setRowLabels(java.lang.String[] Labels)
sets new row and column labels for the ContingencyTable

Parameters:
Labels - the distinct IDs for rows

setColLabels

public void setColLabels(java.util.TreeMap Labels)
sets new row and column labels for the ContingencyTable

Parameters:
Labels - the distinct IDs for columns

setColLabels

public void setColLabels(java.lang.String[] Labels)
sets new row and column labels for the ContingencyTable

Parameters:
Labels - the distinct IDs for rows

getRowLabels

public java.lang.String[] getRowLabels()
returns row labels for the ContingencyTable


getColLabels

public java.lang.String[] getColLabels()
returns column labels for the ContingencyTable


setColLabel

public void setColLabel(int column,
                        java.lang.String aString)
returns a particular column label for the ContingencyTable

Parameters:
column - the column of the table
aString - the string to set

getColLabel

public java.lang.String getColLabel(int column)
returns a particular column label for the ContingencyTable

Parameters:
column - the column of the table

setRowLabel

public void setRowLabel(int row,
                        java.lang.String aString)
returns a particular column label for the ContingencyTable

Parameters:
row - the row of the table
aString - the string to set

getRowLabel

public java.lang.String getRowLabel(int row)
returns a particular row label for the ContingencyTable

Parameters:
row - the row of the table

checkMatrix

public void checkMatrix()
                 throws java.lang.Exception
examines the matrix for invalid entries

Throws:
java.lang.Exception

isSquare

public boolean isSquare()
                 throws java.lang.Exception
is matrix square?

Throws:
java.lang.Exception

checkSquare

public boolean checkSquare()
                    throws java.lang.Exception
is matrix square?

Throws:
java.lang.Exception

checkMatchingMatrixDimensions

public boolean checkMatchingMatrixDimensions(ContingencyTable BTable)
                                      throws java.lang.Exception
examine whether this matrix has the same dimensions as the one provided?

Parameters:
BTable - a ContingencyTable to compare with
Throws:
java.lang.Exception

checkMatchingRows

public boolean checkMatchingRows(Variable aVar)
                          throws java.lang.Exception
examine whether this matrix has the same number of rows as the provided variable

Parameters:
aVar - the variable to compare with
Throws:
java.lang.Exception

isMatchingMatrix

public boolean isMatchingMatrix(ContingencyTable BTable)
is this matrix the same as the one provided?

Parameters:
BTable - a ContingencyTable to compare with

set2DArray

public void set2DArray(double[][] inMatrix)
                throws java.lang.Exception
sets a 2D array of doubles for the ContingencyTable

Parameters:
inMatrix - 2D array of doubles to fill the table
Throws:
java.lang.Exception

getTableSubSet

public ContingencyTable getTableSubSet(NumberVariable theXVariable)
                                throws java.lang.Exception
returns a subset of row data values for the ContingencyTable as a ContingencyTable. The subset is determined by the selected rows in the provided NumberVariable

Parameters:
theXVariable - the independent NumberVariable
Throws:
java.lang.Exception

as2DdoubleArray

public double[][] as2DdoubleArray()
returns the private array of data values for the ContingencyTable


as2DStringArray

public java.lang.String[][] as2DStringArray()
returns the private array of data values for the ContingencyTable


asJAMAMatrix

public Matrix asJAMAMatrix()
returns the private array of data values for the ContingencyTable


setCellValue

public void setCellValue(int xLoc,
                         int yLoc,
                         double inValue)
sets a single element for this matrix with a double

Parameters:
xLoc - x Capture in grid
yLoc - y Capture in grid
inValue - double value to set

incrementCellValue

public void incrementCellValue(int xLoc,
                               int yLoc)
increments a single cell for this matrix by one

Parameters:
xLoc - x Capture in grid
yLoc - y Capture in grid

getCellValue

public double getCellValue(int xLoc,
                           int yLoc)
returns the double from one element of this matrix

Parameters:
xLoc - x Capture in grid
yLoc - y Capture in grid

clearSums

public void clearSums()
zero the sums for rows, columns, and total of the ContingencyTable


clearTable

public void clearTable()
zero the sums for all individual cells of the ContingencyTable


fillSums

public void fillSums()
calculate sums for rows, columns and total of the ContingencyTable


getRowSums

public double[] getRowSums()
returns the row sums of the table


getRowSum

public double getRowSum(int row)
                 throws java.lang.Exception
returns the sum for a particular row of the table

Throws:
java.lang.Exception

getColSums

public double[] getColSums()
returns the row sums of the table


getColSum

public double getColSum(int col)
                 throws java.lang.Exception
returns the sum for a particular row of the table

Throws:
java.lang.Exception

getTotalSum

public double getTotalSum()
                   throws java.lang.Exception
returns the sum for a particular row of the table

Throws:
java.lang.Exception

transpose

public ContingencyTable transpose()
                           throws java.lang.Exception
transposes the table between X and Y dimensions

Throws:
java.lang.Exception

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
clone the object

Overrides:
clone in class java.lang.Object
Throws:
java.lang.CloneNotSupportedException

getTotalsMatrix

public double[][] getTotalsMatrix()
returns a matrix in which cells from actor and receiver section of the ContingencyTable have been summed into a total cell value


getNoZeroCellMatrix

public double[][] getNoZeroCellMatrix()
returns the values from the matrix with a constant of 0.25 added to each cell


getDifferenceTable

public ContingencyTable getDifferenceTable(ContingencyTable bTable)
returns a matrix of dominance relationships between actor and receiver


getDominanceMatrix

public double[][] getDominanceMatrix()
returns a matrix of dominance relationships between actor and receiver


getExpMatrixDia

public DataTable getExpMatrixDia()
                          throws java.lang.Exception
returns a matrix of expected values for a test of independence

Throws:
java.lang.Exception

getExpMatrixFromProbabilities

public DataTable getExpMatrixFromProbabilities()
                                        throws java.lang.Exception
returns a matrix of expected values for a test of independence

Throws:
java.lang.Exception

listExpectedTable

public void listExpectedTable()
lists a matrix of expected values


getExpectedMatrix

public ContingencyTable getExpectedMatrix()
returns a matrix of expected values for a test of independence


getExpectedMatrix

public ContingencyTable getExpectedMatrix(boolean aDiagonal)
returns a matrix of expected values for a test of independence


getExpMatrixNoDia

public ContingencyTable getExpMatrixNoDia()
                                   throws java.lang.Exception
returns a matrix of expected values for a test of independence if the diagonal is structurally zero

Throws:
java.lang.Exception

getpropMatrixDia

public ContingencyTable getpropMatrixDia()
                                  throws java.lang.Exception
returns a matrix of expected values for proportional fitting with diagonal present

Throws:
java.lang.Exception

getpropMatrixNoDia

public ContingencyTable getpropMatrixNoDia()
                                    throws java.lang.Exception
returns a matrix of expected values for proportional fitting with diagonal absent (see Bishop et al., 1975; following Freeman, 1992)

Throws:
java.lang.Exception

listFTukeyDeviates

public void listFTukeyDeviates()
lists Freeman-Tukey deviates for a cell wise examination of the table


getFTukeyDeviates

public DataTable getFTukeyDeviates()
                            throws java.lang.Exception
returns Freeman-Tukey deviates for a cell wise examination of the table

Throws:
java.lang.Exception

getdf

public int getdf()
returns the degrees of freedom for the ContingencyTable


getZeroCells

public int getZeroCells()
returns the number of empty cells for the ContingencyTable


getNCells

public int getNCells()
returns the total number of cells for the ContingencyTable


DoWilliamsCorr

public double DoWilliamsCorr()
calculates the William's correction


calcContingencyResults

public ContTableResults calcContingencyResults(ContingencyTable expectMatrix)
                                        throws java.lang.Exception
calculates the test of independence and returns ChiSquare and GValue

Parameters:
expectMatrix - a ContingencyTable with the matrix of expected values
Throws:
java.lang.Exception

getContingencyTableResults

public ContTableResults getContingencyTableResults()
                                            throws java.lang.Exception
returns the results for a test of independence with expected frequencies calculated from observed

Throws:
java.lang.Exception

getContingencyTableResults

public ContTableResults getContingencyTableResults(ContingencyTable expectMatrix)
                                            throws java.lang.Exception
returns the results for a test of independence with the provided expected values

Parameters:
expectMatrix - a ContingencyTable with the matrix of exp0ected values
Throws:
java.lang.Exception

listContingencyResults

public void listContingencyResults()
does the test and returns its results


calcGoodnessOfFitResults

public GoodnessOfFitResults calcGoodnessOfFitResults()
                                              throws java.lang.Exception
calculates the test of independence and returns ChiSquare and GValue

Throws:
java.lang.Exception

getGoodnessOfFitResults

public GoodnessOfFitResults getGoodnessOfFitResults()
                                             throws java.lang.Exception
coordinates a replicated goodness of fit test

Throws:
java.lang.Exception

listGoodnessOfFitResults

public void listGoodnessOfFitResults()
reports the results for a replicated goodness of fit test with external hypothesis probabilities


invertTable

public ContingencyTable invertTable()
inverts the table with rows to colums and colums to rows


getTauKr

public double getTauKr()
organize a TauKr test for a correlation between actor and receiver matrix


TauKr

public double TauKr(ContingencyTable BTable)
calculate Kendal's tau statistic for a matrix and a second matrix passed in

Parameters:
BTable - second ContingencyTable for the TauKr value

getMantelZ

public double getMantelZ(ContingencyTable BTable)
                  throws java.lang.Exception
calculate Mantel's Z statistic for a matrix and a second matrix passed in

Parameters:
BTable - second ContingencyTable for the correlation
Throws:
java.lang.Exception

unfold

public double[] unfold()
                throws java.lang.Exception
unfold the table into an array of doubles

Throws:
java.lang.Exception

unfoldUpperTriangle

public double[] unfoldUpperTriangle()
                             throws java.lang.Exception
unfold the upper triangle of the table into an array of doubles

Throws:
java.lang.Exception

fold

public DataTable fold(double[] cells,
                      int rows,
                      int cols,
                      boolean diag)
               throws java.lang.Exception
folds an array of doubles into a DataTable and returns the object

Parameters:
cells - the numbers to fill into the cells of the table
rows - the number of rows for the table
cols - the number of columns for the table
diag - does the table have a diagonal?
Throws:
java.lang.Exception

howManyPossiblePermutations

public int howManyPossiblePermutations()
                                throws java.lang.Exception
calculates the number of possible permutations

Throws:
java.lang.Exception

getPermutedTable

public ContingencyTable getPermutedTable(int[] permOrder)
                                  throws java.lang.Exception
gets a variant of the interactionTable with rows and columns switched with a given permutation

Parameters:
permOrder - indicates a particular permutation
Throws:
java.lang.Exception

fillPerms

public int fillPerms()
              throws java.lang.Exception
fills the array with all possible (or desired) permutations

Throws:
java.lang.Exception

getTauKrP

public double getTauKrP(double actualKrNumber)
performs the Kr test with number of permutations limited by MaxPermutations

Parameters:
actualKrNumber - empirically derived TauKr

getMantelP

public double getMantelP(ContingencyTable BTable,
                         double actualMantelNumber)
performs Mantel's test with number of permutations limited by MaxPermutations

Parameters:
BTable - second ContingencyTable for the TauKr value
actualMantelNumber - empirically derived Mantels' z

listTauKrResults

public void listTauKrResults()
lists the Tau Kr for the table


listMantelZResults

public void listMantelZResults(ContingencyTable BTable)
lists Mantel's Z for the table

Parameters:
BTable - second ContingencyTable for the TauKr value

rowToString

public java.lang.String rowToString(int row)
returns the formated object as a string

Parameters:
row - the row

colToString

public java.lang.String colToString(int col)
returns the formatted object as a string

Parameters:
col - the colum

toString

public java.lang.String toString(boolean doSums)
returns the formatted object as a string


noSumsToString

public java.lang.String noSumsToString()
returns the formatted table without sums as a string


listTable

public void listTable()
lists the table


listTable

public void listTable(boolean doSums)
lists the table

Parameters:
doSums - specifies whether to include sums

toFile

public void toFile(java.io.BufferedWriter bw)
            throws java.lang.Exception
writes a ContingencyTable into the writer for a file

Parameters:
bw - the BufferedWriter to write into
Throws:
java.lang.Exception