Description Usage Arguments Value References Examples
Tests the null hypothesis that Y and E are independent given X.
1 2 | CondIndTest(Y, E, X, method = "KCI", alpha = 0.05,
parsMethod = list(), verbose = FALSE)
|
Y |
An n-dimensional vector or a matrix or dataframe with n rows and p columns. |
E |
An n-dimensional vector or a matrix or dataframe with n rows and p columns. |
X |
An n-dimensional 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 p-value of the test (pvalue
) and possibly additional
entries, depending on the output of the chosen conditional independence test in method
.
Please cite C. Heinze-Deml, J. Peters and N. Meinshausen: "Invariant Causal Prediction for Nonlinear Models", arXiv:1706.08576 and the corresponding reference for the conditional independence test.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | # 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 p-value 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 p-value of the test is: ", test2$pvalue))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.