Package edu.cmu.tetrad.search
Class IndTestGSquare
java.lang.Object
edu.cmu.tetrad.search.IndTestGSquare
- 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 G Square test. A description of such a test is given in Fienberg, "The
Analysis of Cross-Classified Categorical Data," 2nd edition. The formula for degrees of freedom used in this test are
equivalent to the formulation on page 142 of Fienberg.
- Author:
- Joseph Ramsey
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionIndTestGSquare
(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, List<Node> z) Determines whether variable x is independent of variable y given a list of conditioning varNames z.boolean
determines
(List<Node> z, Node x1) double
getAlpha()
Gets the getModel significance level.getCov()
getData()
double
double
int
double
getScore()
A score that is higher with more likely models.getVariable
(String name) indTestSubset
(List<Node> vars) Creates a new IndTestGSquare for a subset of the variables.boolean
void
setAlpha
(double alpha) Sets the significance level at which independence judgments should be made.void
setDeterminationP
(double determinationP) void
setVerbose
(boolean verbose) toString()
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
-
Constructor Details
-
IndTestGSquare
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 IndTestGSquare for a subset of the variables.- Specified by:
indTestSubset
in interfaceIndependenceTest
- Returns:
- an Independence test for a subset of the variables.
-
getPValue
public double getPValue()- Returns:
- the p value associated with the most recent call of isIndependent.
-
checkIndependence
Determines whether variable x is independent of variable y given a list of conditioning varNames z.- Specified by:
checkIndependence
in interfaceIndependenceTest
- Parameters:
x
- the one variable being compared.y
- the second variable being compared.z
- the list of conditioning varNames.- Returns:
- true iff x _||_ y | z.
-
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.
-
getAlpha
public double getAlpha()Gets the getModel significance level.- Specified by:
getAlpha
in interfaceIndependenceTest
- Returns:
- this number.
-
getVariables
- Specified by:
getVariables
in interfaceIndependenceTest
- Returns:
- the list of variables over which this independence checker is capable of determinine independence relations-- that is, all the variables in the given graph or the given data set.
-
getVariableNames
- Specified by:
getVariableNames
in interfaceIndependenceTest
- Returns:
- the list of variable varNames.
-
getVariable
- Specified by:
getVariable
in interfaceIndependenceTest
- Returns:
- the variable by the given name.
-
toString
- Specified by:
toString
in interfaceIndependenceTest
- Overrides:
toString
in classObject
-
determines
- Specified by:
determines
in interfaceIndependenceTest
- Parameters:
z
- The list of variables z1,...,zn with respect to which we want to know whether z determines x oir z.x1
- 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.
-
getDeterminationP
public double getDeterminationP() -
setDeterminationP
public void setDeterminationP(double determinationP) -
getData
- Specified by:
getData
in interfaceIndependenceTest
- Returns:
- The data model for the independence test.
-
getCov
- Specified by:
getCov
in interfaceIndependenceTest
-
getDataSets
- Specified by:
getDataSets
in interfaceIndependenceTest
-
getSampleSize
public int getSampleSize()- Specified by:
getSampleSize
in interfaceIndependenceTest
-
getCovMatrices
- Specified by:
getCovMatrices
in interfaceIndependenceTest
-
getScore
public double getScore()Description copied from interface:IndependenceTest
A score that is higher with more likely models.- Specified by:
getScore
in interfaceIndependenceTest
-
isVerbose
public boolean isVerbose()- Specified by:
isVerbose
in interfaceIndependenceTest
-
setVerbose
public void setVerbose(boolean verbose) - Specified by:
setVerbose
in interfaceIndependenceTest
-