Package edu.cmu.tetrad.search.test
Class GSquareTest
java.lang.Object
edu.cmu.tetrad.search.test.GSquareTest
Performs conditional independence tests of discrete data using the G Square method. Degrees of freedom are calculated as in Fienberg (2007), this reference:
Fienberg, S. E. (2007). The analysis of cross-classified categorical data. Springer Science & Business Media.
- Author:
- Frank Wimberly original version, josephramsey revision 10/01
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic final classStores the parameters of the result returned by the G Square test and its p-value.
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptioncalcGSquare(int[] testIndices) Calculates g square for a conditional crosstabulation table for independence question 0 _||_ 1 | 2, 3, ...max by summing up g square and degrees of freedom for each conditional table in turn, where rows or columns that consist entirely of zeros have been removed.doublegetAlpha()Returns the cell table for this test.Returns the dataset used for this test.int[]getDims()Returns the dimensions of the variables, in order.booleanisDetermined(int[] testIndices, double p) Returns a judgement of whether the variables index by 'testIndices' determine the variable index by 'p'.voidsetAlpha(double alpha) Sets the significance level to be used for tests.
- 
Constructor Details- 
GSquareTestConstructor- Parameters:
- dataSet- The discrete dataset for which test results are requested.
- alpha- The alpha sigificance level cutoff.
 
 
- 
- 
Method Details- 
calcGSquareCalculates g square for a conditional crosstabulation table for independence question 0 _||_ 1 | 2, 3, ...max by summing up g square and degrees of freedom for each conditional table in turn, where rows or columns that consist entirely of zeros have been removed.- Parameters:
- testIndices- The indices of the test result needed, in order. So for the above, [0 1 2 3...max].
- Returns:
- the test result.
- See Also:
 
- 
getDimspublic int[] getDims()Returns the dimensions of the variables, in order.- Returns:
- These dimensions, as an int[] array. For instance, if the array is [2 3], then the first variable has 2 categories and second variable has 3 categories.
 
- 
getCellTableReturns the cell table for this test.- Returns:
- This table.
- See Also:
 
- 
getAlphapublic double getAlpha()- Returns:
- the getModel significance level being used for tests.
 
- 
setAlphapublic void setAlpha(double alpha) Sets the significance level to be used for tests.- Parameters:
- alpha- The alpha significance level of the test.
 
- 
getDataSetReturns the dataset used for this test.- Returns:
- This dataset.
 
- 
isDeterminedpublic boolean isDetermined(int[] testIndices, double p) Returns a judgement of whether the variables index by 'testIndices' determine the variable index by 'p'.- Parameters:
- testIndices- The indices of the conditioning variables.
- p- The index of the child variable.
- Returns:
- True if the conditioning variables determine the child variable.
 
 
-