Package edu.cmu.tetrad.search.test
Class ChiSquareTest
java.lang.Object
edu.cmu.tetrad.search.test.ChiSquareTest
Calculates marginal chi square test results for a discrete dataset.
- Author:
- frankwimberly, josephramsey
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Simple class to store the parameters of the result returned by the G Square test. -
Constructor Summary
ConstructorsConstructorDescriptionChiSquareTest
(DataSet dataSet, double alpha) Constructs a test using the given data set and significance level. -
Method Summary
Modifier and TypeMethodDescriptioncalcChiSquare
(int[] testIndices) Calculates chi square for a conditional cross-tabulation table for independence question 0 _||_ 1 | 2, 3, ...max by summing up chi 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 model significance level being used for tests.boolean
isDetermined
(int[] testIndices, double p) Returns a judgment of whether a set of parent variables determines a child variables.void
setAlpha
(double alpha) Sets the significance level to be used for tests.
-
Constructor Details
-
ChiSquareTest
Constructs a test using the given data set and significance level.- Parameters:
dataSet
- A data set consisting entirely of discrete variables.alpha
- The significance level, usually 0.05.
-
-
Method Details
-
calcChiSquare
Calculates chi square for a conditional cross-tabulation table for independence question 0 _||_ 1 | 2, 3, ...max by summing up chi 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
- These indices, in order.- Returns:
- a Chi square test result.
- See Also:
-
isDetermined
public boolean isDetermined(int[] testIndices, double p) Returns a judgment of whether a set of parent variables determines a child variables.- Parameters:
testIndices
- An array of indices for variables in the dataset supplied in the constructor.p
- The probability that some marginal for some table dominates. A good value is 0.99.- Returns:
- True if the variable at index 0 is determined by the variables at the other indices.
-
getAlpha
public double getAlpha()Returns the model significance level being used for tests.- Returns:
- this level.
-
setAlpha
public void setAlpha(double alpha) Sets the significance level to be used for tests.- Parameters:
alpha
- This significance level.
-