Class IndTestTrekSep

java.lang.Object
edu.cmu.tetrad.search.test.IndTestTrekSep
All Implemented Interfaces:
IndependenceTest

public final class IndTestTrekSep extends Object implements IndependenceTest
Checks d-separations in a structural model using t-separations over indicators.
Version:
$Id: $Id
Author:
Adam Brodie
  • 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

      public IndependenceTest indTestSubset(List<Node> vars)
      Determines independence between variables in a given subset.
      Specified by:
      indTestSubset in interface IndependenceTest
      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

      public IndependenceResult checkIndependence(Node x, Node y, Set<Node> z)
      Determines independence between variables x and y, given the set of variables z.
      Specified by:
      checkIndependence in interface IndependenceTest
      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 interface IndependenceTest
      Returns:
      This alpha.
    • setAlpha

      public void setAlpha(double alpha)
      Sets the significance level for the independence test.
      Specified by:
      setAlpha in interface IndependenceTest
      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

      public List<Node> 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 interface IndependenceTest
      Returns:
      This list.
    • setVariables

      public void setVariables(List<Node> variables)
      Sets the varialbe to this list (of the same length). Useful is multiple test are used that need the same object-identical lists of variables.
      Parameters:
      variables - This list.
    • getVariable

      public Node getVariable(String name)
      Gets the variable with the given name.
      Specified by:
      getVariable in interface IndependenceTest
      Parameters:
      name - The name of the variable to get.
      Returns:
      The Node object representing the variable.
    • determines

      public boolean determines(List<Node> z, Node x) throws UnsupportedOperationException
      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

      public DataSet getData()
      Gets the data set used for the independence test.
      Specified by:
      getData in interface IndependenceTest
      Returns:
      The data set used for the independence test.
      See Also:
    • toString

      public String toString()
      Returns a string representation of this test.
      Specified by:
      toString in interface IndependenceTest
      Overrides:
      toString in class Object
      Returns:
      This string.
    • getCov

      public ICovarianceMatrix getCov()
      Returns the covariance matrix.
      Specified by:
      getCov in interface IndependenceTest
      Returns:
      This matrix.
    • getDataSets

      public List<DataSet> getDataSets()
      Returns the data sets used for the independence test.
      Specified by:
      getDataSets in interface IndependenceTest
      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 interface IndependenceTest
      Returns:
      The sample size.
    • isVerbose

      public boolean isVerbose()
      Checks whether verbose output is enabled.
      Specified by:
      isVerbose in interface IndependenceTest
      Returns:
      true if verbose output is enabled, false otherwise.
    • setVerbose

      public void setVerbose(boolean verbose)
      Sets the verbose output flag.
      Specified by:
      setVerbose in interface IndependenceTest
      Parameters:
      verbose - True, if verbose output is enabled. False otherwise.