Package edu.cmu.tetrad.search.test
Class IndTestChiSquare
java.lang.Object
edu.cmu.tetrad.search.test.IndTestChiSquare
- All Implemented Interfaces:
IndependenceTest
Checks the conditional independence X _||_ Y | S, where S is a set of discrete variable, and X and Y are discrete
variable not in S, by applying a conditional Chi Square test. A description of such a test is given in Fienberg, "The
Analysis of Cross-Classified Categorical Data," 2nd edition.
The formulas for the degrees of freedom used in this test are equivalent to the formulation on page 142 of Fienberg.
- Author:
- josephramsey
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionIndTestChiSquare
(DataSet dataSet, double alpha) Constructs a new independence checker to check conditional independence facts for discrete data using a g square test. -
Method Summary
Modifier and TypeMethodDescriptioncheckIndependence
(Node x, Node y, Set<Node> _z) Determines whether variable x is independent of variable y given a list of conditioning varNames z.boolean
determines
(List<Node> z, Node x) Returns True if the variables z determining the variable z.double
getAlpha()
Returns the alpha significance level of the test.double
Returns the chi Square value.getData()
Returns the data being analyzed.int
getDf()
Returns the degrees of freedom associated with the most recent call of isIndependent.Returns the list of variables over which this independence checker is capable of determining independence relations-- that is, all the variables in the given graph or the given data set.indTestSubset
(List<Node> nodes) Creates a new IndTestChiSquare for a subset of the nodes.boolean
Returns true if verbose output should be printed.void
setAlpha
(double alpha) Sets the significance level at which independence judgments should be made.void
setVerbose
(boolean verbose) Sets whether verbose output should be printed.toString()
Returns a string representation of this test.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface edu.cmu.tetrad.search.IndependenceTest
checkIndependence, determines, getCov, getDataSets, getSampleSize, getVariable, getVariableNames
-
Constructor Details
-
IndTestChiSquare
Constructs a new independence checker to check conditional independence facts for discrete data using a g square test.- Parameters:
dataSet
- the discrete data set.alpha
- the significance level of the tests.
-
-
Method Details
-
indTestSubset
Creates a new IndTestChiSquare for a subset of the nodes.- Specified by:
indTestSubset
in interfaceIndependenceTest
- Parameters:
nodes
- This list of nodes.
-
getChiSquare
public double getChiSquare()Returns the chi Square value.- Returns:
- This value.
-
getDf
public int getDf()Returns the degrees of freedom associated with the most recent call of isIndependent.- Returns:
- These degrees.
-
checkIndependence
Determines whether variable x is independent of variable y given a list of conditioning varNames z.- Specified by:
checkIndependence
in interfaceIndependenceTest
- Returns:
- True iff x _||_ y | z.
- See Also:
-
determines
Returns True if the variables z determining the variable z.- Parameters:
z
- The list of variables z1,...,zn with respect to which we want to know whether z determines x oir z.x
- The one variable whose determination by z we want to know.- Returns:
- true if it is estimated that z determines x or z determines y.
-
getAlpha
public double getAlpha()Returns the alpha significance level of the test.- Specified by:
getAlpha
in interfaceIndependenceTest
- Returns:
- This level.
-
setAlpha
public void setAlpha(double alpha) Sets the significance level at which independence judgments should be made. Affects the cutoff for partial correlations to be considered statistically equal to zero.- Specified by:
setAlpha
in interfaceIndependenceTest
- Parameters:
alpha
- the new significance level.
-
getVariables
Returns the list of variables over which this independence checker is capable of determining independence relations-- that is, all the variables in the given graph or the given data set.- Specified by:
getVariables
in interfaceIndependenceTest
- Returns:
- This list.
-
toString
Returns a string representation of this test.- Specified by:
toString
in interfaceIndependenceTest
- Overrides:
toString
in classObject
- Returns:
- This string.
-
getData
Returns the data being analyzed.- Specified by:
getData
in interfaceIndependenceTest
- Returns:
- This data.
- See Also:
-
isVerbose
public boolean isVerbose()Returns true if verbose output should be printed.- Specified by:
isVerbose
in interfaceIndependenceTest
- Returns:
- This.
-
setVerbose
public void setVerbose(boolean verbose) Sets whether verbose output should be printed.- Specified by:
setVerbose
in interfaceIndependenceTest
- Parameters:
verbose
- True, if so.
-