Package edu.cmu.tetrad.search
Class Kci
java.lang.Object
edu.cmu.tetrad.search.Kci
- All Implemented Interfaces:
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncheckIndependence(Node x, Node y, List<Node> z) Returns true if the given independence question is judged true, false if not.booleandetermines(List<Node> z, Node y) Returns true if y is determined the variable in z.doublegetAlpha()Returns the significance level of the independence test.getCov()getData()intdoublegetScore()A score that is higher with more likely models.doublegetVariable(String name) Returns the variable by the given name.Returns the list of variables over which this independence checker is capable of determinining independence relations.indTestSubset(List<Node> vars) Returns an Independence test for a subset of the variables.booleanbooleanvoidsetAlpha(double alpha) Sets the significance level.voidsetApproximate(boolean approximate) voidsetEpsilon(double epsilon) voidsetNumBootstraps(int numBootstraps) voidsetThreshold(double threshold) voidsetVerbose(boolean verbose) voidsetWidthMultiplier(double widthMultiplier) toString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface edu.cmu.tetrad.search.IndependenceTest
checkIndependence, getVariableNames
-
Constructor Details
-
Kci
Constructor.- Parameters:
data- The dataset to analyse. Must be continuous.alpha- The alpha value of the test.
-
-
Method Details
-
indTestSubset
Returns an Independence test for a subset of the variables.- Specified by:
indTestSubsetin interfaceIndependenceTest- Returns:
- an Independence test for a subset of the variables.
-
checkIndependence
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:
checkIndependencein interfaceIndependenceTest- Returns:
- an IndependenceResult (see).
- See Also:
-
getVariables
Returns the list of variables over which this independence checker is capable of determinining independence relations.- Specified by:
getVariablesin interfaceIndependenceTest- Returns:
- the list of variables over which this independence checker is capable of determinining independence relations.
-
getVariable
Returns the variable by the given name.- Specified by:
getVariablein interfaceIndependenceTest- Returns:
- the variable by the given name.
-
determines
Returns true if y is determined the variable in z.- Specified by:
determinesin interfaceIndependenceTest- Returns:
- true if y is determined the variable in z.
-
getAlpha
public double getAlpha()Returns the significance level of the independence test.- Specified by:
getAlphain interfaceIndependenceTest- 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:
setAlphain interfaceIndependenceTest
-
toString
- Specified by:
toStringin interfaceIndependenceTest- Overrides:
toStringin classObject- Returns:
- a string representation of this test.
-
getData
- Specified by:
getDatain interfaceIndependenceTest- Returns:
- The data model for the independence test.
-
getCov
- Specified by:
getCovin interfaceIndependenceTest
-
getDataSets
- Specified by:
getDataSetsin interfaceIndependenceTest
-
getSampleSize
public int getSampleSize()- Specified by:
getSampleSizein interfaceIndependenceTest
-
getCovMatrices
-
getScore
public double getScore()Description copied from interface:IndependenceTestA score that is higher with more likely models.- Specified by:
getScorein interfaceIndependenceTest
-
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:
isVerbosein interfaceIndependenceTest
-
setVerbose
public void setVerbose(boolean verbose) - Specified by:
setVerbosein interfaceIndependenceTest
-