Package edu.cmu.tetrad.search.test
Class IndTestTrekSep
java.lang.Object
edu.cmu.tetrad.search.test.IndTestTrekSep
- All Implemented Interfaces:
IndependenceTest
Checks d-separations in a structural model using t-separations over indicators.
- Version:
- $Id: $Id
- Author:
- Adam Brodie
-
Constructor Summary
ConstructorsConstructorDescriptionIndTestTrekSep
(ICovarianceMatrix covMatrix, double alpha, List<List<Node>> clustering, List<Node> latents) Constructs a new independence test that will determine conditional independence facts using the given correlation matrix and the given significance level. -
Method Summary
Modifier and TypeMethodDescriptioncheckIndependence
(Node x, Node y, Set<Node> z) Determines independence between variables x and y, given the set of variables z.boolean
determines
(List<Node> z, Node x) Determines the independence between a set of variables z and a variable x.double
getAlpha()
Gets the model significance level.getCov()
Returns the covariance matrix.getData()
Gets the data set used for the independence test.Returns the data sets used for the independence test.int
Returns the sample size used in the covariance matrix.getVariable
(String name) Gets the variable with the given name.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.indTestSubset
(List<Node> vars) Determines independence between variables in a given subset.boolean
Checks whether verbose output is enabled.void
setAlpha
(double alpha) Sets the significance level for the independence test.void
setVariables
(List<Node> variables) Sets the varialbe to this list (of the same length).void
setVerbose
(boolean verbose) Sets the verbose output flag.toString()
Returns a string representation of this test.Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface edu.cmu.tetrad.search.IndependenceTest
checkIndependence, determines, getVariableNames
-
Constructor Details
-
IndTestTrekSep
public IndTestTrekSep(ICovarianceMatrix covMatrix, double alpha, List<List<Node>> clustering, List<Node> latents) Constructs a new independence test that will determine conditional independence facts using the given correlation matrix and the given significance level.- Parameters:
covMatrix
- The covariance over the measures.alpha
- The significance level.clustering
- The clustering of the measured variables. In each cluster, all measured variable in the cluster are explained by a single latent.latents
- The list of latent variables for the clusters, in order.
-
-
Method Details
-
indTestSubset
Determines independence between variables in a given subset.- Specified by:
indTestSubset
in interfaceIndependenceTest
- Parameters:
vars
- The sublist of variables to test for independence.- Returns:
- An IndependenceTest object representing the result of the independence test.
- Throws:
IllegalArgumentException
- If the subset of variables is empty or contains variables that are not part of the original variables.
-
checkIndependence
Determines independence between variables x and y, given the set of variables z.- Specified by:
checkIndependence
in interfaceIndependenceTest
- Parameters:
x
- The first variable.y
- The second variable.z
- The set of variables.- Returns:
- An IndependenceResult object representing the result of the independence test.
- See Also:
-
getAlpha
public double getAlpha()Gets the model significance level.- Specified by:
getAlpha
in interfaceIndependenceTest
- Returns:
- This alpha.
-
setAlpha
public void setAlpha(double alpha) Sets the significance level for the independence test.- Specified by:
setAlpha
in interfaceIndependenceTest
- Parameters:
alpha
- The significance level. Must be between 0.0 and 1.0 (inclusive).- Throws:
IllegalArgumentException
- If the significance level is out of range.
-
getVariables
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.- Specified by:
getVariables
in interfaceIndependenceTest
- Returns:
- This list.
-
setVariables
-
getVariable
Gets the variable with the given name.- Specified by:
getVariable
in interfaceIndependenceTest
- Parameters:
name
- The name of the variable to get.- Returns:
- The Node object representing the variable.
-
determines
Determines the independence between a set of variables z and a variable x.- Parameters:
z
- The set of variables to determine independence with x.x
- The variable to determine independence with z.- Returns:
- true if the variable x is conditionally independent from the set of variables z, false otherwise.
- Throws:
UnsupportedOperationException
- if the covariance matrix is singular or not invertible.
-
getData
Gets the data set used for the independence test.- Specified by:
getData
in interfaceIndependenceTest
- Returns:
- The data set used for the independence test.
- See Also:
-
toString
Returns a string representation of this test.- Specified by:
toString
in interfaceIndependenceTest
- Overrides:
toString
in classObject
- Returns:
- This string.
-
getCov
Returns the covariance matrix.- Specified by:
getCov
in interfaceIndependenceTest
- Returns:
- This matrix.
-
getDataSets
Returns the data sets used for the independence test.- Specified by:
getDataSets
in interfaceIndependenceTest
- Returns:
- The list of data sets used for the independence test.
-
getSampleSize
public int getSampleSize()Returns the sample size used in the covariance matrix.- Specified by:
getSampleSize
in interfaceIndependenceTest
- Returns:
- The sample size.
-
isVerbose
public boolean isVerbose()Checks whether verbose output is enabled.- Specified by:
isVerbose
in interfaceIndependenceTest
- Returns:
- true if verbose output is enabled, false otherwise.
-
setVerbose
public void setVerbose(boolean verbose) Sets the verbose output flag.- Specified by:
setVerbose
in interfaceIndependenceTest
- Parameters:
verbose
- True, if verbose output is enabled. False otherwise.
-