compareDAGs {BiDAG} R Documentation

## Comparing two graphs

### Description

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)

### Usage

```compareDAGs(egraph, truegraph, cpdag = FALSE, rnd = 2)
```

### Arguments

 `egraph` an object of class `graphNEL` (package ‘graph’), representing the graph which should be compared to a ground truth graph or an ajacency matrix corresponding to the graph `truegraph` an object of class `graphNEL` (package ‘graph’), representing the ground truth graph or an ajacency matrix corresponding to this graph `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

### Value

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)

### Examples

```Asiascore<-scoreparameters("bde", Asia)
## Not run:
eDAG<-orderMCMC(Asiascore)
compareDAGs(eDAG\$DAG,Asiamat)

## End(Not run)
```

[Package BiDAG version 2.0.4 Index]