Class Kci

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

public class Kci extends Object implements IndependenceTest
Kernal Independence Test (KCI). Zhang, K., Peters, J., Janzing, D., and Schölkopf, B. (2012). Kernel-based conditional independence test and application in causal discovery. arXiv preprint arXiv:1202.3775. Please see that paper, especially Theorem 4 and Proposition 5. Using optimal kernel bandwidths suggested by Bowman and Azzalini (1997): Bowman, A. W., and Azzalini, A. (1997). Applied smoothing techniques for data analysis: the kernel approach with S-Plus illustrations (Vol. 18). OUP Oxford.
Author:
Vineet Raghu on 7/3/2016, jdramsey refactoring 7/4/2018
  • Constructor Details

    • Kci

      public Kci(DataSet data, double alpha)
      Constructor.
      Parameters:
      data - The dataset to analyse. Must be continuous.
      alpha - The alpha value of the test.
  • Method Details

    • indTestSubset

      public IndependenceTest indTestSubset(List<Node> vars)
      Returns an Independence test for a subset of the variables.
      Specified by:
      indTestSubset in interface IndependenceTest
      Returns:
      an Independence test for a subset of the variables.
    • checkIndependence

      public IndependenceResult checkIndependence(Node x, Node y, List<Node> z)
      Returns true if the given independence question is judged true, false if not. The independence question is of the form x _||_ y | z, z = [z1,...,zn], where x, y, z1,...,zn are variables in the list returned by getVariableNames().
      Specified by:
      checkIndependence in interface IndependenceTest
      Returns:
      true if the given independence question is judged true, false if not. The independence question is of the form x _||_ y | z, z = <z1,...,zn>, where x, y, z1,...,zn are variables in the list returned by getVariableNames().
    • getVariables

      public List<Node> getVariables()
      Returns the list of variables over which this independence checker is capable of determinining independence relations.
      Specified by:
      getVariables in interface IndependenceTest
      Returns:
      the list of variables over which this independence checker is capable of determinining independence relations.
    • getVariable

      public Node getVariable(String name)
      Returns the variable by the given name.
      Specified by:
      getVariable in interface IndependenceTest
      Returns:
      the variable by the given name.
    • getVariableNames

      public List<String> getVariableNames()
      Returns the list of names for the variables in getNodesInEvidence.
      Specified by:
      getVariableNames in interface IndependenceTest
      Returns:
      the list of names for the variables in getNodesInEvidence.
    • determines

      public boolean determines(List<Node> z, Node y)
      Returns true if y is determined the variable in z.
      Specified by:
      determines in interface IndependenceTest
      Returns:
      true if y is determined the variable in z.
    • getAlpha

      public double getAlpha()
      Returns the significance level of the independence test.
      Specified by:
      getAlpha in interface IndependenceTest
      Returns:
      the significance level of the independence test.
      Throws:
      UnsupportedOperationException - if there is no significance level.
    • setAlpha

      public void setAlpha(double alpha)
      Sets the significance level.
      Specified by:
      setAlpha in interface IndependenceTest
    • toString

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

      public DataModel getData()
      Specified by:
      getData in interface IndependenceTest
      Returns:
      The data model for the independence test.
    • getCov

      public ICovarianceMatrix getCov()
      Specified by:
      getCov in interface IndependenceTest
    • getDataSets

      public List<DataSet> getDataSets()
      Specified by:
      getDataSets in interface IndependenceTest
    • getSampleSize

      public int getSampleSize()
      Specified by:
      getSampleSize in interface IndependenceTest
    • getCovMatrices

      public List<Matrix> getCovMatrices()
      Specified by:
      getCovMatrices in interface IndependenceTest
    • getScore

      public double getScore()
      Description copied from interface: IndependenceTest
      A score that is higher with more likely models.
      Specified by:
      getScore in interface IndependenceTest
    • isApproximate

      public boolean isApproximate()
    • setApproximate

      public void setApproximate(boolean approximate)
    • setWidthMultiplier

      public void setWidthMultiplier(double widthMultiplier)
    • setNumBootstraps

      public void setNumBootstraps(int numBootstraps)
    • getThreshold

      public double getThreshold()
    • setThreshold

      public void setThreshold(double threshold)
    • setEpsilon

      public void setEpsilon(double epsilon)
    • isVerbose

      public boolean isVerbose()
      Specified by:
      isVerbose in interface IndependenceTest
    • setVerbose

      public void setVerbose(boolean verbose)
      Specified by:
      setVerbose in interface IndependenceTest