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.boolean
determines
(List<Node> z, Node y) Returns true if y is determined the variable in z.double
getAlpha()
Returns the significance level of the independence test.getCov()
getData()
int
double
getScore()
A score that is higher with more likely models.double
getVariable
(String name) Returns the variable by the given name.Returns the list of names for the variables in getNodesInEvidence.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.boolean
boolean
void
setAlpha
(double alpha) Sets the significance level.void
setApproximate
(boolean approximate) void
setEpsilon
(double epsilon) void
setNumBootstraps
(int numBootstraps) void
setThreshold
(double threshold) void
setVerbose
(boolean verbose) void
setWidthMultiplier
(double widthMultiplier) toString()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface edu.cmu.tetrad.search.IndependenceTest
checkIndependence
-
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:
indTestSubset
in 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:
checkIndependence
in interfaceIndependenceTest
- 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
Returns the list of variables over which this independence checker is capable of determinining independence relations.- Specified by:
getVariables
in 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:
getVariable
in interfaceIndependenceTest
- Returns:
- the variable by the given name.
-
getVariableNames
Returns the list of names for the variables in getNodesInEvidence.- Specified by:
getVariableNames
in interfaceIndependenceTest
- Returns:
- the list of names for the variables in getNodesInEvidence.
-
determines
Returns true if y is determined the variable in z.- Specified by:
determines
in 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:
getAlpha
in 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:
setAlpha
in interfaceIndependenceTest
-
toString
- Specified by:
toString
in interfaceIndependenceTest
- Overrides:
toString
in classObject
- Returns:
- a string representation of this test.
-
getData
- Specified by:
getData
in interfaceIndependenceTest
- Returns:
- The data model for the independence test.
-
getCov
- Specified by:
getCov
in interfaceIndependenceTest
-
getDataSets
- Specified by:
getDataSets
in interfaceIndependenceTest
-
getSampleSize
public int getSampleSize()- Specified by:
getSampleSize
in interfaceIndependenceTest
-
getCovMatrices
- Specified by:
getCovMatrices
in interfaceIndependenceTest
-
getScore
public double getScore()Description copied from interface:IndependenceTest
A score that is higher with more likely models.- Specified by:
getScore
in 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:
isVerbose
in interfaceIndependenceTest
-
setVerbose
public void setVerbose(boolean verbose) - Specified by:
setVerbose
in interfaceIndependenceTest
-