For each subset of nbrsA
and nbrsC
where a
and
c
are conditionally independent, it is checked if b
is in the
conditioning set.
checkTriple(a, b, c, nbrsA, nbrsC,
sepsetA, sepsetC,
suffStat, indepTest, alpha, version.unf = c(NA, NA),
maj.rule = FALSE, verbose = FALSE)
(integer) positions in adjacency matrix for nodes
(integer) position in adjacency matrix for
neighbors of
vector containing
vector containing
significance level of test.
(integer) vector of length two:
version.unf[1]
:1 - check for all separating subsets of
nbrsA
and nbrsC
if b
is in that set,
2 - it also checks if there at all exists any sepset which is a
subset of the neighbours (there might be none, although b
is in the sepset, which indicates an ambiguous situation);
version.unf[2]
:1 - do not consider the initial sepsets
sepsetA
and sepsetC
(same as Tetrad),
2 - consider if b
is in sepsetA
or
sepsetC
.
logical indicating that the following majority rule
is applied: if b
is in less than
50% of the checked sepsets, we say that b
is in no sepset. If
b
is in more than 50% of the checked sepsets, we say that
b
is in all sepsets. If b
is in exactly 50% of the
checked sepsets, the triple is considered ‘ambiguous’.
Logical asking for detailed output of intermediate steps.
Decision on possibly ambiguous triple, an integer code,
b
is in NO sepset (make v-structure);
b
is in ALL sepsets (make no v-structure);
b
is in SOME but not all sepsets (ambiguous triple)
Version (1 or 2) of the ambiguous triple
(1=normal ambiguous triple that is b
is in some sepsets;
2=triple coming from version.unf[1]==2
, that is, a
and
c
are indep given the initial sepset but there doesn't exist a
subset of the neighbours that d-separates them.)
Updated version of sepsetA
Updated version of sepsetC
This function is used in the conservative versions of structure learning algorithms.
D. Colombo and M.H. Maathuis (2014).Order-independent constraint-based causal structure learning. Journal of Machine Learning Research 15 3741-3782.
# NOT RUN {
##################################################
## Using Gaussian Data
##################################################
## Load predefined data
data(gmG)
n <- nrow (gmG8$x)
V <- colnames(gmG8$x)
## define independence test (partial correlations), and test level
indepTest <- gaussCItest
alpha <- 0.01
## define sufficient statistics
suffStat <- list(C = cor(gmG8$x), n = n)
## estimate CPDAG
pc.fit <- pc(suffStat, indepTest, alpha=alpha, labels = V, verbose = TRUE)
if (require(Rgraphviz)) {
## show estimated CPDAG
par(mfrow=c(1,2))
plot(pc.fit, main = "Estimated CPDAG")
plot(gmG8$g, main = "True DAG")
}
a <- 6
b <- 1
c <- 8
checkTriple(a, b, c,
nbrsA = c(1,5,7),
nbrsC = c(1,5),
sepsetA = pc.fit@sepset[[a]][[c]],
sepsetC = pc.fit@sepset[[c]][[a]],
suffStat=suffStat, indepTest=indepTest, alpha=alpha,
version.unf = c(2,2),
verbose = TRUE) -> ct
str(ct)
## List of 4
## $ decision: int 2
## $ version : int 1
## $ SepsetA : int [1:2] 1 5
## $ SepsetC : int 1
# }
# NOT RUN {
checkTriple(a, b, c,
nbrsA = c(1,5,7),
nbrsC = c(1,5),
sepsetA = pc.fit@sepset[[a]][[c]],
sepsetC = pc.fit@sepset[[c]][[a]],
version.unf = c(1,1),
suffStat=suffStat, indepTest=indepTest, alpha=alpha) -> c2
stopifnot(identical(ct, c2)) ## in this case, 'version.unf' had no effect
# }
Run the code above in your browser using DataLab