compareDAGs {BiDAG} | R Documentation |
This function compares one (estimated) graph to another graph (true graph), returning a vector of 8 values:
the number of true positive edges ('TP') is the number of edges in the skeleton of 'egraph' which are also present in the skeleton of 'truegraph'
the number of false positive edges ('FP') is the number of edges in the skeleton of 'egraph' which are absent in the skeleton of 'truegraph'
the number of fralse negative edges ('FN') is the number of edges in the skeleton of 'truegraph' which are absent in the skeleton of 'egraph'
structural Hamming distance ('SHD') between 2 graphs is computed as TP+FP+the number of edges with an error in direction
TPR equals TP/(TP+FN)
FPR equals FP/(TN+FP) (TN stands for true negative edges)
FPRn equals FP/(TP+FN)
FDR equals FP/(TP+FP)
compareDAGs(egraph, truegraph, cpdag = FALSE, rnd = 2)
egraph |
an object of class |
truegraph |
an object of class |
cpdag |
logical, if TRUE (FALSE by default) both graphs are first converted to their respective equivalence class (CPDAG); this affects SHD calculation |
rnd |
integer, rounding integer indicating the number of decimal places (round) when computing TPR, FPR, FPRn and FDR |
a named numeric vector 8 elements: SHD, number of true positive edges (TP), number of false positive edges (FP), number of false negative edges (FN), true positive rate (TPR), false positive rate (FPR), false positive rate normalized to the true number of edges (FPRn) and false discovery rate (FDR)
Asiascore<-scoreparameters("bde", Asia) ## Not run: eDAG<-orderMCMC(Asiascore) compareDAGs(eDAG$DAG,Asiamat) ## End(Not run)