Compute confusion matrix for two PDAG caugi::caugi graphs.
confusion(truth, est, type = c("adj", "dir"))A list with entries tp (truth positives), tn (truth negatives),
fp (false positives), and fn (false negatives).
A caugi::caugi object representing the truth graph.
A caugi::caugi object representing the estimated graph.
Character string specifying the comparison type:
"adj": adjacency comparison.
"dir": orientation comparison conditional on shared adjacencies.
Adjacency comparison: The confusion matrix is a cross-tabulation of adjacencies. Hence, a truth positive means that the two inputs agree on the presence of an adjacency. A truth negative means that the two inputs agree on no adjacency. A false positive means that the estimated graph places an adjacency where there should be none. A false negative means that the estimated graph does not place an adjacency where there should have been one.
Orientation comparison: The orientation confusion matrix is conditional on agreement on adjacency. This means that only adjacencies that are shared in both input matrices are considered, and agreement wrt. orientation is then computed only among these edges that occur in both matrices. A truth positive is a correctly placed arrowhead (1), a false positive marks placement of arrowhead (1) where there should have been a tail (0), a false negative marks placement of tail (0) where there should have been an arrowhead (1), and a truth negative marks correct placement of a tail (0).
Only supports caugi::caugi objects with these edge types present -->, <-->, --- and no edge.
Other metrics:
evaluate(),
f1_score(),
false_omission_rate(),
fdr(),
g1_score(),
npv(),
precision(),
recall(),
reexports,
specificity()
cg1 <- caugi::caugi(A %-->% B + C)
cg2 <- caugi::caugi(B %-->% A + C)
confusion(cg1, cg2)
confusion(cg1, cg2, type = "dir")
Run the code above in your browser using DataLab