Index  Topics 
ci.test {bnlearn}  R Documentation 
Independence and conditional independence tests
Description
Perform an independence or a conditional independence test.
Usage
ci.test(x, y, z, data, test, ..., debug = FALSE)
Arguments
x 
a character string (the name of a variable), a data frame, a numeric vector or a factor object. 
y 
a character string (the name of another variable), a numeric vector or a factor object. 
z 
a vector of character strings (the names of the conditioning variables), a numeric vector, a
factor object or a data frame. If 
data 
a data frame containing the variables to be tested. 
test 
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 JonckheereTerpstra test for ordered factors and the linear correlation for
continuous variables. See 
... 
optional arguments to be passed to the test specified by 
debug 
a boolean value. If 
Details
Additional arguments of the ci.test()
function:

B
: a positive integer, the number of permutations used to compute the pvalue of permutation tests. The default value is5000
for nonparametric permutation tests and100
for semiparametric permutation tests. 
fun
: the function that computes the conditional independence test in thecustomtest
test.fun
must have argumentsx
,y
,z
,data
andargs
, in this order; in other words, it must have signaturefunction(x, y, z, data, args)
.x
andy
will be the labels of the nodes to test for independence (one character string each);z
will be the labels of the nodes in the conditioning set (a vector of character strings, possibilyNULL
for empty sets);data
will contain the complete data set, with all the variables (a data frame); andargs
will be a list containing any additional arguments to the test. 
args
: a list containing the optional arguments tofun
, for tuningcustomtest
test functions.
Value
An object of class htest
containing the following components:
statistic 
the value the test statistic. 
parameter 
the degrees of freedom of the approximate chisquared or t distribution of the test statistic; the number of permutations computed by Monte Carlo tests. Semiparametric tests have both. 
p.value 
the pvalue for the test. 
method 
a character string indicating the type of test performed, and whether Monte Carlo simulation or continuity correction was used. 
data.name 
a character string giving the name(s) of the data. 
null.value 
the value of the test statistic under the null hypothesis, always 0. 
alternative 
a character string describing the alternative hypothesis. 
Author(s)
Marco Scutari
See Also
independence tests
, arc.strength
.
Examples
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))
Index  Topics 