Add background knowledge x -> y to an adjacency matrix and complete the orientation rules from Meek (1995).
addBgKnowledge(gInput, x = c(), y = c(), verbose =FALSE, checkInput =TRUE)
Arguments
gInput: graphNEL object or adjacency matrix of type amat.cpdag (see amatType)
x,y: node labels of x or y in the adjacency matrix. x and y can be vectors representing several nodes (see details below).
verbose: If TRUE, detailed output is provided.
checkInput: If TRUE, the input adjacency matrix is carefully checked to see if it is a valid graph using function isValidGraph
Details
If the input is a graphNEL object, it will be converted into an adjacency matrix of type amat.cpdag. If x and y are given and if amat[y,x] != 0, this function adds orientation x -> y to the adjacency matrix amat and completes the orientation rules from Meek (1995). If x and y are not specified (or empty vectors) this function simply completes the orientation rules from Meek (1995). If x and y are vectors of length k, k>1, this function tries to add x[i] -> y[i] to the adjacency matrix amat and complete the orientation rules from Meek (1995) for every iin1,...,k (see Algorithm 1 in Perkovic et. al, 2017).
Returns
An adjacency matrix of type amat.cpdag of the maximally oriented pdag with added background knowledge x -> y or NULL, if the backgound knowledge is not consistent with any DAG represented by the PDAG with the adjacency matrix amat.
References
C. Meek (1995). Causal inference and causal explanation with background knowledge, In Proceedings of UAI 1995, 403-410.
E. Perkovic, M. Kalisch and M.H. Maathuis (2017). Interpreting and using CPDAGs with background knowledge. In Proceedings of UAI 2017.
Author(s)
Emilija Perkovic and Markus Kalisch
Examples
## a -- b -- camat <- matrix(c(0,1,0,1,0,1,0,1,0),3,3)colnames(amat)<- rownames(amat)<- letters[1:3]## plot(as(t(amat), "graphNEL")) addBgKnowledge(gInput = amat)## amat is a valid CPDAG## b -> c is directed; a -- b is not directed by applying## Meek's orientation rulesbg1 <- addBgKnowledge(gInput = amat, x ="b", y ="c")## plot(as(t(bg1), "graphNEL"))## b -> c and b -> a are directedbg2 <- addBgKnowledge(gInput = amat, x = c("b","b"), y = c("c","a"))## plot(as(t(bg2), "graphNEL")) ## c -> b is directed; as a consequence of Meek's orientation rules,## b -> a is directed as wellbg3 <- addBgKnowledge(gInput = amat, x ="c", y ="b")## plot(as(t(bg3), "graphNEL")) amat2 <- matrix(c(0,1,0,1,0,1,0,1,0),3,3)colnames(amat2)<- rownames(amat2)<- letters[1:3]## new collider is inconsistent with original CPDAG; thus, NULL is returnedaddBgKnowledge(gInput = amat2, x = c("c","a"), y = c("b","b"))