Perform either an independence test or a conditional independence test.
ci.test(x, y, z, data, test, B, debug = FALSE)
a character string (the name of a variable), a data frame, a numeric vector or a factor object.
a character string (the name of another variable), a numeric vector or a factor object.
a vector of character strings (the names of the conditioning
variables), a numeric vector, a factor object or a data frame. If
NULL
an independence test will be executed.
a data frame containing the variables to be tested.
a character string, the label of the conditional independence
test to be used in the algorithm. If none is specified, the default test
statistic is the mutual information for categorical variables, the
Jonckheere-Terpstra test for ordered factors and the linear
correlation for continuous variables. See bnlearn-package
for details.
a positive integer, the number of permutations considered for each
permutation test. It will be ignored with a warning if the conditional
independence test specified by the test
argument is not a
permutation test.
a boolean value. If TRUE
a lot of debugging output is
printed; otherwise the function is completely silent.
An object of class htest
containing the following components:
the value the test statistic.
the degrees of freedom of the approximate chi-squared or t distribution of the test statistic; the number of permutations computed by Monte Carlo tests. Semiparametric tests have both.
the p-value for the test.
a character string indicating the type of test performed, and whether Monte Carlo simulation or continuity correction was used.
a character string giving the name(s) of the data.
the value of the test statistic under the null hypothesis, always 0.
a character string describing the alternative hypothesis.
for parametric and discrete permutation tests:
Edwards DI (2000). Introduction to Graphical Modelling. Springer, 2nd edition.
for shrinkage tests:
Hausser J, Strimmer K (2009). "Entropy inference and the James-Stein estimator, with application to nonlinear gene association networks". Statistical Applications in Genetics and Molecular Biology, 10, 1469-1484.
Ledoit O, Wolf M (2003). "Improved Estimation of the Covariance Matrix of Stock Returns with an Application to Portfolio Selection". Journal of Empirical Finance, 10, 603-621.
for continuous permutation tests:
Legendre P (2000). "Comparison of Permutation Methods for the Partial Correlation and Partial Mantel Tests". Journal of Statistical Computation and Simulation, 67, 37-73.
for semiparametric discrete tests:
Tsamardinos I, Borboudakis G (2010). "Permutation Testing Improves Bayesian Network Learning". In "Machine Learning and Knowledge Discovery in Databases", pp. 322-337. Springer.
data(gaussian.test)
data(learning.test)
# using a data frame and column labels.
ci.test(x = "F" , y = "B", z = c("C", "D"), data = gaussian.test)
# using a data frame.
ci.test(gaussian.test)
# using factor objects.
attach(learning.test)
ci.test(x = F , y = B, z = data.frame(C, D))
Run the code above in your browser using DataLab