Package edu.cmu.tetrad.search.test
Class IndTestDSep
java.lang.Object
edu.cmu.tetrad.search.test.IndTestDSep
- All Implemented Interfaces:
IndependenceTest
Checks independence facts for variables associated with the nodes in a given graph by checking d-separation facts on the underlying nodes. We use the IndependenceTest interface here so that this d-separation test can be used in place of a statistical conditional independence test in algorithms to provide oracle information.
- Author:
- josephramsey
-
Constructor Summary
ConstructorsConstructorDescriptionIndTestDSep
(IndependenceFacts facts) Constructor.IndTestDSep
(IndependenceFacts facts, boolean keepLatents) Constructor.IndTestDSep
(IndependenceFacts facts, List<Node> variables) Constructor.IndTestDSep
(Graph graph) Constructor.IndTestDSep
(Graph graph, boolean keepLatents) Constructor. -
Method Summary
Modifier and TypeMethodDescriptioncheckIndependence
(Node x, Node y, List<Node> z) Checks the indicated d-separation fact, dsep(x , y | z).boolean
determines
(List<Node> z, Node x1) Returns true if y is determined the variable in z.double
getAlpha()
Returns an alpha level, 0.5.getData()
getGraph()
Returns the underlying graph that is being used to calculate d-separation relationships.double
This obviousy does not return an actual p-value, though it does return a number that is positive for depdendence and negative for independence, satisfying the contract.double
getScore()
Returns 1 for d-connections, -1 for d-separationsgetVariable
(String name) Returns the variable with the given name.Return the list of TetradNodes 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.indTestSubset
(List<Node> vars) Returns a test over a subset of the variables.boolean
isDSeparated
(Node x, Node y, List<Node> z) Auxiliary method to calculate dsep(x, y | z) directly from nodes instead of from variables.boolean
Returns True just in case verbose output should be printed.void
setAlpha
(double alpha) Sets the significance level.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.test.IndependenceTest
checkIndependence, getCov, getDataSets, getSampleSize, getVariableNames
-
Constructor Details
-
IndTestDSep
Constructor.- Parameters:
graph
- The graph for which d-separation facts should be checked. This may be a DAG, CPDAG, or PAG. In the latter case, m-separation results will be returned (same algorithm).
-
IndTestDSep
Constructor.- Parameters:
facts
- Independence facts to be used for direct calculations of d-separation.variables
- The variables for the facts, if different from those that independenceFacts would return.- See Also:
-
IndTestDSep
Constructor.- Parameters:
facts
- Independence facts to be used for direct calculations of d-separation.- See Also:
-
IndTestDSep
Constructor.- Parameters:
graph
- The graph for which d-separation facts should be checked. This may be a DAG, CPDAG, or PAG. In the latter case, m-separation results will be returned (same algorithm).keepLatents
- Whether latent in the graph should be used in conditional independence facts. If the graph is being marginalized, this should be false.
-
IndTestDSep
Constructor.- Parameters:
facts
- Independence facts to be used for direct calculations of d-separation.keepLatents
- Whether latent in the graph should be used in conditional independence facts. If the graph is being marginalized, this should be false.- See Also:
-
-
Method Details
-
indTestSubset
Returns a test over a subset of the variables.- Specified by:
indTestSubset
in interfaceIndependenceTest
- Parameters:
vars
- The sublist of variables.- Returns:
- This test.
-
checkIndependence
Checks the indicated d-separation fact, dsep(x , y | z).- Specified by:
checkIndependence
in interfaceIndependenceTest
- Returns:
- An independence result for dsep(x, y | z).
- See Also:
-
isDSeparated
Auxiliary method to calculate dsep(x, y | z) directly from nodes instead of from variables.- Returns:
- True if so.
-
getPValue
public double getPValue()This obviousy does not return an actual p-value, though it does return a number that is positive for depdendence and negative for independence, satisfying the contract.- Returns:
- This value.
-
getVariables
Return the list of TetradNodes 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.- Specified by:
getVariables
in interfaceIndependenceTest
- Returns:
- This list.
-
determines
Description copied from interface:IndependenceTest
Returns true if y is determined the variable in z.- Specified by:
determines
in interfaceIndependenceTest
- Returns:
- True if so.
- Throws:
UnsupportedOperationException
- Since this method is not feasible.
-
getAlpha
public double getAlpha()Returns an alpha level, 0.5. This is an arbitrary nubmer that will help decide whether a pseudo p-value returned by the test represents a dependence or an independence.- Specified by:
getAlpha
in interfaceIndependenceTest
- Returns:
- 0.5.
- See Also:
-
setAlpha
public void setAlpha(double alpha) Description copied from interface:IndependenceTest
Sets the significance level.- Specified by:
setAlpha
in interfaceIndependenceTest
- Parameters:
alpha
- This level.- Throws:
UnsupportedOperationException
- it makes no sense to set an alpha level for a d-separation test away from the default.- See Also:
-
getVariable
Returns the variable with the given name.- Specified by:
getVariable
in interfaceIndependenceTest
- Parameters:
name
- The name.- Returns:
- The variable.
-
getGraph
Returns the underlying graph that is being used to calculate d-separation relationships.- Returns:
- This graph.
-
toString
Returns a string representation of this test.- Specified by:
toString
in interfaceIndependenceTest
- Overrides:
toString
in classObject
- Returns:
- "D-separation".
-
getData
- Specified by:
getData
in interfaceIndependenceTest
- Returns:
- The data model for the independence test, either a DataSet or a CovarianceMatrix.
- Throws:
UnsupportedOperationException
- Method doesn't make sense here.- See Also:
-
getScore
public double getScore()Returns 1 for d-connections, -1 for d-separations- Specified by:
getScore
in interfaceIndependenceTest
- Returns:
- This number.
-
isVerbose
public boolean isVerbose()Returns True just in case verbose output should be printed.- Specified by:
isVerbose
in interfaceIndependenceTest
- Returns:
- True if so.
-
setVerbose
public void setVerbose(boolean verbose) Sets whether verbose output should be printed.- Specified by:
setVerbose
in interfaceIndependenceTest
- Parameters:
verbose
- True if so.
-