Class IndTestPositiveCorr

java.lang.Object
edu.cmu.tetrad.search.work_in_progress.IndTestPositiveCorr
All Implemented Interfaces:
IndependenceTest

public final class IndTestPositiveCorr extends Object implements IndependenceTest
Checks conditional independence of variable in a continuous data set using Fisher's Z test. See Spirtes, Glymour, and Scheines, "Causation, Prediction and Search," 2nd edition, page 94.
Version:
$Id: $Id
Author:
josephramsey, Frank Wimberly adapted IndTestCramerT for Fisher's Z
  • Constructor Details

    • IndTestPositiveCorr

      public IndTestPositiveCorr(DataSet dataSet, double alpha)
      Constructs a new Independence test which checks independence facts based on the correlation matrix implied by the given data set (must be continuous). The given significance level is used.
      Parameters:
      dataSet - A data set containing only continuous columns.
      alpha - The alpha level of the test.
  • Method Details

    • indTestSubset

      public IndependenceTest indTestSubset(List<Node> vars)
      Performs an independence test on a subset of variables.
      Specified by:
      indTestSubset in interface IndependenceTest
      Parameters:
      vars - The sublist of variables.
      Returns:
      An IndependenceTest object representing the result of the test.
      Throws:
      UnsupportedOperationException - This method is not implemented and will always throw an UnsupportedOperationException.
    • checkIndependence

      public IndependenceResult checkIndependence(Node x0, Node y0, Set<Node> _z0)
      Checks the independence between two nodes, given a set of conditioning nodes.
      Specified by:
      checkIndependence in interface IndependenceTest
      Parameters:
      x0 - First node to check independence for.
      y0 - Second node to check independence for.
      _z0 - Set of conditioning nodes.
      Returns:
      An IndependenceResult object representing the result of the independence test.
      See Also:
    • getPValue

      public double getPValue()
      Calculates the p-value for the independence test.
      Returns:
      The p-value of the independence test.
    • getAlpha

      public double getAlpha()
      Retrieves the alpha level of the Independence Test.
      Specified by:
      getAlpha in interface IndependenceTest
      Returns:
      The alpha level.
    • setAlpha

      public void setAlpha(double alpha)
      Set the alpha level for the significance of the test.
      Specified by:
      setAlpha in interface IndependenceTest
      Parameters:
      alpha - The alpha level for the significance of the test. Must be a value between 0.0 and 1.0, inclusive.
      Throws:
      IllegalArgumentException - if the alpha value is out of range.
    • getVariables

      public List<Node> getVariables()
      Retrieves the list of variables used in the independence test.
      Specified by:
      getVariables in interface IndependenceTest
      Returns:
      The list of variables used in the independence test.
    • setVariables

      public void setVariables(List<Node> variables)
      Sets the variables used in the independence test.
      Parameters:
      variables - A list of Nodes representing the variables to be used in the test.
      Throws:
      IllegalArgumentException - if the number of variables is different from the current number of variables in the test.
    • getVariable

      public Node getVariable(String name)
      Retrieves the node associated with the given variable name.
      Specified by:
      getVariable in interface IndependenceTest
      Parameters:
      name - a String object representing the variable name.
      Returns:
      the node associated with the variable name.
    • determines

      public boolean determines(List<Node> z, Node x) throws UnsupportedOperationException
      Determines if there exists a causal relationship between the nodes in z and node x.
      Parameters:
      z - The list of nodes representing the potential causes.
      x - The node representing the potential effect.
      Returns:
      true if there exists a causal relationship between the nodes in z and node x, false otherwise.
      Throws:
      UnsupportedOperationException - if the method is not implemented.
    • getData

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

      public String toString()
      Returns a string representation of the Fisher Z object.
      Specified by:
      toString in interface IndependenceTest
      Overrides:
      toString in class Object
      Returns:
      A string representation of the Fisher Z object.
    • getCov

      public ICovarianceMatrix getCov()

      getCov.

      Specified by:
      getCov in interface IndependenceTest
      Returns:
      a ICovarianceMatrix object
    • getDataSets

      public List<DataSet> getDataSets()
      Retrieves the data sets used in the independence test.
      Specified by:
      getDataSets in interface IndependenceTest
      Returns:
      A list of data sets.
    • getSampleSize

      public int getSampleSize()
      Retrieves the sample size of the covariance matrix.
      Specified by:
      getSampleSize in interface IndependenceTest
      Returns:
      The sample size.
    • isVerbose

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

      public void setVerbose(boolean verbose)
      Sets the verbose mode to either enabled or disabled.
      Specified by:
      setVerbose in interface IndependenceTest
      Parameters:
      verbose - True if verbose mode is enabled, false otherwise.