JavaGrinders
Class ContingencyAnalyzer

java.lang.Object
  extended by JavaGrinders.Analyzer
      extended by JavaGrinders.ContingencyAnalyzer
Direct Known Subclasses:
HierarchyAnalyzer, ReplicatedGAnalyzer

public class ContingencyAnalyzer
extends Analyzer

coordinates the analysis of contingency tables in an application. It owns a row by column table


Field Summary
 boolean diagonal
           
 double[] itsHypothesisPs
           
 ContingencyTable itsTable
           
 
Fields inherited from class JavaGrinders.Analyzer
df
 
Constructor Summary
ContingencyAnalyzer(ContingencyTable aTable)
          Standard constructor, providing it with a contingency table directly
ContingencyAnalyzer(VariableOrganizer anOrganizer)
          Standard constructor using a VariableOrganizer, assuming that the diagonal is present
ContingencyAnalyzer(VariableOrganizer anOrganizer, boolean withDiagonal)
          Standard constructor using a VariableOrganizer
 
Method Summary
 void analyze_nY()
          performs an analysis of multiple dependent variables
 void assertTable()
          checks for a crosstabulation (i.e., frequency) ContingencyTable.
 void createContingencyTable()
          checks for a crosstabulation (i.e., frequency) ContingencyTable.
 void createCrossTabulationtionTable()
          checks for a crosstabulation (i.e., frequency) ContingencyTable.
 void createTable()
          checks for a crosstabulation (i.e., frequency) ContingencyTable.
 void createTransitionTable()
          checks for a crosstabulation (i.e., frequency) ContingencyTable.
 void doAnalyze_1Y(Variable theYVariable)
          lists the results from a transition analysis of the variables.
 void doAnalyze_1Y1X2Groups(Variable theXVariable, Variable theYVariable)
          performs a Contingency analysis (Y variable with 2 groups)
 void doAnalyze_1Y1XnGroups(Variable theXVariable, Variable theYVariable)
          performs a Contingency analysis (Y variable with n groups)
 void doAnalyze_nY(VariableOrganizer YOrganizer)
          controls an analysis of multiple dependent variables
 ContingencyTable getTable()
          returns the crosstabulation (i.e., frequency) table
 void listContingencyResults()
          performs a Test of Independence on the ContingencyTable/ and reports the results as statistics for X2 and loglikelihood ratio.
 void listExpectedTable()
          reports the expected values for the ContingencyTable
 void listFTukeyDeviates()
          reports the Freeman-Tukey deviates for the ContingencyTable
 void listTable()
          reports the ContingencyTable
 void setHypothesisPs(double[] thePs)
          sets the expected probabilities for different columns
 void setTable(ContingencyTable aTable)
          Installs a crosstabulation (i.e., frequency) table.
 
Methods inherited from class JavaGrinders.Analyzer
analyzeMultXY, analyzeMultY, analyzeXY, analyzeY, analyzeY, clearAllDesignRoles, controlAnalyze_1Y1X, controlAnalyze_1YnX, controlAnalyze_nY, controlAnalyze_nY1X, controlAnalyze_nYnX, doAnalyze_1Y, doAnalyze_1Y1Xcontinuous, doAnalyze_1YnXcontinuous, doAnalyze_1YnXnGroups, doAnalyze_nY1Xcontinuous, doAnalyze_nY1XnGroups, doAnalyze_nYnX, getNXVariables, getNYVariables, getOrganizer, getXVariable, getYVariable, getYVariableNames, listGroupDescriptives, setOrganizer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

itsTable

public ContingencyTable itsTable

diagonal

public boolean diagonal

itsHypothesisPs

public double[] itsHypothesisPs
Constructor Detail

ContingencyAnalyzer

public ContingencyAnalyzer(VariableOrganizer anOrganizer,
                           boolean withDiagonal)
Standard constructor using a VariableOrganizer

Parameters:
anOrganizer - an instance of VariableOrganizer class coordinates a set of variables with respect to the number of data points available and the rows that are currently selected * @param withDiagonal should the Analyzer consider the diagonal?

ContingencyAnalyzer

public ContingencyAnalyzer(VariableOrganizer anOrganizer)
Standard constructor using a VariableOrganizer, assuming that the diagonal is present

Parameters:
anOrganizer - an instance of VariableOrganizer class coordinates a set of variables with respect to the number of data points available and the rows that are currently selected

ContingencyAnalyzer

public ContingencyAnalyzer(ContingencyTable aTable)
Standard constructor, providing it with a contingency table directly

Parameters:
aTable - this instance of ContingencyTable class contains a crosstabulation table of frequencies
Method Detail

setTable

public void setTable(ContingencyTable aTable)
Installs a crosstabulation (i.e., frequency) table. All analyses listed below * are performed on this table

Parameters:
aTable - this instance of ContingencyTable class contains a crosstabulation table of frequencies

getTable

public ContingencyTable getTable()
                          throws java.lang.Exception
returns the crosstabulation (i.e., frequency) table

Throws:
java.lang.Exception

assertTable

public void assertTable()
                 throws java.lang.Exception
checks for a crosstabulation (i.e., frequency) ContingencyTable. If none is available it attempts to create one from the VariableOrganizer

Throws:
java.lang.Exception

createTransitionTable

public void createTransitionTable()
                           throws java.lang.Exception
checks for a crosstabulation (i.e., frequency) ContingencyTable. If none is available it attempts to create one from the VariableOrganizer. If one dependent variable is selected a transition matrix of its elements

Throws:
java.lang.Exception

createCrossTabulationtionTable

public void createCrossTabulationtionTable()
                                    throws java.lang.Exception
checks for a crosstabulation (i.e., frequency) ContingencyTable. If none is available it attempts to create one from the VariableOrganizer. If one dependent variable is selected a transition matrix of its elements

Throws:
java.lang.Exception

createContingencyTable

public void createContingencyTable()
                            throws java.lang.Exception
checks for a crosstabulation (i.e., frequency) ContingencyTable. If none is available it attempts to create one from the VariableOrganizer. If one dependent variable is selected a transition matrix of its elements

Throws:
java.lang.Exception

createTable

public void createTable()
                 throws java.lang.Exception
checks for a crosstabulation (i.e., frequency) ContingencyTable. If none is available it attempts to create one from the VariableOrganizer. - a transition matrix is obtained if 1 categorical X and no Y variable are selected - a cross tabulation matrix is obtained if 1 categorical X and 1 categorical Y variable are selected - a contingency table is obtained if multiple numerica Y variables are selected

Throws:
java.lang.Exception

listContingencyResults

public void listContingencyResults()
performs a Test of Independence on the ContingencyTable/ and reports the results as statistics for X2 and loglikelihood ratio. Moreover, William's Correction is applied to both results


listFTukeyDeviates

public void listFTukeyDeviates()
reports the Freeman-Tukey deviates for the ContingencyTable


setHypothesisPs

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

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

listExpectedTable

public void listExpectedTable()
reports the expected values for the ContingencyTable


listTable

public void listTable()
reports the ContingencyTable


doAnalyze_1Y

public void doAnalyze_1Y(Variable theYVariable)
                  throws java.lang.Exception
lists the results from a transition analysis of the variables.

Overrides:
doAnalyze_1Y in class Analyzer
Parameters:
theYVariable - the dependent Variable
Throws:
java.lang.Exception

doAnalyze_nY

public void doAnalyze_nY(VariableOrganizer YOrganizer)
                  throws java.lang.Exception
controls an analysis of multiple dependent variables

Overrides:
doAnalyze_nY in class Analyzer
Parameters:
YOrganizer - an instance of VariableOrganizer class that is used as a dependent variable
Throws:
java.lang.Exception

analyze_nY

public void analyze_nY()
                throws java.lang.Exception
performs an analysis of multiple dependent variables

Throws:
java.lang.Exception

doAnalyze_1Y1X2Groups

public void doAnalyze_1Y1X2Groups(Variable theXVariable,
                                  Variable theYVariable)
                           throws java.lang.Exception
performs a Contingency analysis (Y variable with 2 groups)

Overrides:
doAnalyze_1Y1X2Groups in class Analyzer
Parameters:
theXVariable - the independent Variable * @param theYVariable the dependent Variable
Throws:
java.lang.Exception

doAnalyze_1Y1XnGroups

public void doAnalyze_1Y1XnGroups(Variable theXVariable,
                                  Variable theYVariable)
                           throws java.lang.Exception
performs a Contingency analysis (Y variable with n groups)

Overrides:
doAnalyze_1Y1XnGroups in class Analyzer
Parameters:
theXVariable - the independent Variable * @param theYVariable the dependent Variable
Throws:
java.lang.Exception