Package edu.cmu.tetrad.search.test
Class ConditionalCorrelationIndependence
java.lang.Object
edu.cmu.tetrad.search.test.ConditionalCorrelationIndependence
Checks conditional independence of variable in a continuous data set using Daudin's method. See
Ramsey, J. D. (2014). A scalable conditional independence test for nonlinear, non-Gaussian data. arXiv preprint arXiv:1401.5031.
This is corrected using Lemma 2, condition 4 of
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.
This all follows the original Daudin paper, which is this:
Daudin, J. J. (1980). Partial association measures and ann application to qualitative regression. Biometrika, 67(3), 581-590.
We use Nadaraya-Watson kernel regression, though we further restrict the sample size to nearby points.
- Author:
- josephramsey
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
Gives a choice of basis functions to use for judgments of independence for conditional correlation independence.static enum
Gives a choice of kernels to use for the independence judgments for conditional correlation independence. -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new Independence test which checks independence facts based on the correlation data implied by the given data set (must be continuous). -
Method Summary
Modifier and TypeMethodDescriptiondouble
getPValue
(double score) Returns the p-value of the score.double
getScore()
Returns the minimal scores value calculated by the method for the most recent independence check, less the cutoff so that negative scores correspond to independence.double
getWidth()
Returns the kernel width.double
isIndependent
(Node x, Node y, Set<Node> _z) Returns the p-value of the test, x _||_ y | z.double[]
Calculates the residuals of x regressed nonparametrically onto z.void
setAlpha
(double alpha) Sets the alpha cutoff.void
Sets the basis.void
setKernelMultiplier
(ConditionalCorrelationIndependence.Kernel kernelMultiplier) Sets the kernel multiplier.void
setKernelRegressionSampleSize
(int kernelRegressionSapleSize) Sets the kernel regression sample size.void
setNumFunctions
(int numFunctions) Sets the number of functions to use in (truncated) basisvoid
setWidth
(double width) Sets the kernel width.
-
Constructor Details
-
ConditionalCorrelationIndependence
Constructs a new Independence test which checks independence facts based on the correlation data implied by the given data set (must be continuous). The given significance level is used.- Parameters:
dataSet
- A data set containing only continuous columns.
-
-
Method Details
-
isIndependent
Returns the p-value of the test, x _||_ y | z. Can be compared to alpha.- Returns:
- This p-value.
-
residuals
Calculates the residuals of x regressed nonparametrically onto z. Left public so it can be accessed separately.- Returns:
- a double[2][] array. The first double[] array contains the residuals for x, and the second double[] array contains the residuals for y.
-
setNumFunctions
public void setNumFunctions(int numFunctions) Sets the number of functions to use in (truncated) basis- Parameters:
numFunctions
- This number.
-
setKernelMultiplier
Sets the kernel multiplier.- Parameters:
kernelMultiplier
- This multiplier.
-
setBasis
Sets the basis.- Parameters:
basis
- This basis.- See Also:
-
getWidth
public double getWidth()Returns the kernel width.- Returns:
- This width.
-
setWidth
public void setWidth(double width) Sets the kernel width.- Parameters:
width
- This width.
-
getPValue
public double getPValue(double score) Returns the p-value of the score.- Parameters:
score
- The score.- Returns:
- This p-value.
-
getScore
public double getScore()Returns the minimal scores value calculated by the method for the most recent independence check, less the cutoff so that negative scores correspond to independence.- Returns:
- This minimal score.
-
setAlpha
public void setAlpha(double alpha) Sets the alpha cutoff.- Parameters:
alpha
- This cutoff.
-
setKernelRegressionSampleSize
public void setKernelRegressionSampleSize(int kernelRegressionSapleSize) Sets the kernel regression sample size.- Parameters:
kernelRegressionSapleSize
- This sample size
-