CondIndTest {CondIndTests}  R Documentation 
Tests the null hypothesis that Y and E are independent given X.
CondIndTest(Y, E, X, method = "KCI", alpha = 0.05, parsMethod = list(), verbose = FALSE)
Y 
An ndimensional vector or a matrix or dataframe with n rows and p columns. 
E 
An ndimensional vector or a matrix or dataframe with n rows and p columns. 
X 
An ndimensional vector or a matrix or dataframe with n rows and p columns. 
method 
The conditional indepdence test to use, can be one of

alpha 
Significance level. Defaults to 0.05. 
parsMethod 
Named list to pass options to 
verbose 
If 
A list with the pvalue of the test (pvalue
) and possibly additional
entries, depending on the output of the chosen conditional independence test in method
.
Please cite C. HeinzeDeml, J. Peters and N. Meinshausen: "Invariant Causal Prediction for Nonlinear Models", arXiv:1706.08576 and the corresponding reference for the conditional independence test.
# Example 1 set.seed(1) n < 100 Z < rnorm(n) X < 4 + 2 * Z + rnorm(n) Y < 3 * X^2 + Z + rnorm(n) test1 < CondIndTest(X,Y,Z, method = "KCI") cat("These data come from a distribution, for which X and Y are NOT cond. ind. given Z.") cat(paste("The pvalue of the test is: ", test1$pvalue)) # Example 2 set.seed(1) Z < rnorm(n) X < 4 + 2 * Z + rnorm(n) Y < 3 + Z + rnorm(n) test2 < CondIndTest(X,Y,Z, method = "KCI") cat("The data come from a distribution, for which X and Y are cond. ind. given Z.") cat(paste("The pvalue of the test is: ", test2$pvalue))