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 Summary
Nested ClassesModifier and TypeClassDescriptionstatic final class
Stores the parameters of the result returned by the G Square test and its p-value. -
Constructor Summary
Constructors -
Method Summary
Modifier 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.double
getAlpha()
Returns the cell table for this test.Returns the dataset used for this test.int[]
getDims()
Returns the dimensions of the variables, in order.boolean
isDetermined
(int[] testIndices, double p) Returns a judgement of whether the variables index by 'testIndices' determine the variable index by 'p'.void
setAlpha
(double alpha) Sets the significance level to be used for tests.
-
Constructor Details
-
GSquareTest
Constructor- Parameters:
dataSet
- The discrete dataset for which test results are requested.alpha
- The alpha sigificance level cutoff.
-
-
Method Details
-
calcGSquare
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.- 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:
-
getDims
public 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.
-
getCellTable
Returns the cell table for this test.- Returns:
- This table.
- See Also:
-
getAlpha
public double getAlpha()- Returns:
- the getModel significance level being used for tests.
-
setAlpha
public void setAlpha(double alpha) Sets the significance level to be used for tests.- Parameters:
alpha
- The alpha significance level of the test.
-
getDataSet
Returns the dataset used for this test.- Returns:
- This dataset.
-
isDetermined
public 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.
-