Class ConditionalCorrelationIndependence

java.lang.Object
edu.cmu.tetrad.search.test.ConditionalCorrelationIndependence

public final class ConditionalCorrelationIndependence extends Object
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
  • Constructor Details

    • ConditionalCorrelationIndependence

      public ConditionalCorrelationIndependence(DataSet dataSet)
      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

      public double isIndependent(Node x, Node y, Set<Node> _z)
      Returns the p-value of the test, x _||_ y | z. Can be compared to alpha.
      Returns:
      This p-value.
    • residuals

      public double[] residuals(Node x, List<Node> z, List<Integer> rows)
      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

      public void setKernelMultiplier(ConditionalCorrelationIndependence.Kernel kernelMultiplier)
      Sets the kernel multiplier.
      Parameters:
      kernelMultiplier - This multiplier.
    • setBasis

      public void setBasis(ConditionalCorrelationIndependence.Basis basis)
      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