Biology Reference
In-Depth Information
> all.equal(bn.gs, iamb(marks))
[1] TRUE
> all.equal(bn.gs, inter.iamb(marks))
[1] TRUE
> all.equal(bn.gs, iamb(marks, test = "mc-cor"))
[1] TRUE
The implementation of the PC algorithm provided by the pcalg package, which
is invoked through the pc function, produces the following output:
> suff.stat = list(C = cor(marks), n = nrow(marks))
> pc.fit = pc(suff.stat, indepTest = gaussCItest,
+
p = ncol(marks), alpha = 0.05)
> pc.fit
Object of class 'pcAlgo', from Call:
skeleton(suffStat = suffStat, indepTest = indepTest,
p = p, alpha = alpha, verbose = verbose,
fixedGaps = fixedGaps, fixedEdges = fixedEdges,
NAdelete = NAdelete, m.max = m.max)
A graphNEL graph with directed edges
Number of Nodes = 5
Number of Edges = 7
The default options are very similar to the ones used above with bnlearn ;the
gaussCItest function (which is provided by pcalg ) implements Fisher's Z test,
and again
05. We can also supply a function implementing a custom condi-
tional independence test via the indepTest argument. Such a function must take
the labels of two nodes, the set of d-separating nodes, and the suff.stat object
as arguments, and return the p-value of the test.
Theeasiestwaytocompare pc.fit with bn.graph is to use the classes
provided by the graph package, which pcalg uses in the pcAlgo class, and the
compareGraphs function provided by pcalg itself.
α =
0
.
> gs.graph = as.graphAM(bn.gs)
> compareGraphs(pc.fit@graph, gs.graph)
tpr fpr tdr
101
As we can see, the true positive rate (TPR) and the true discovery rate (TDR)ofthe
arcs in pc.fit are both equal to one. In other words, the proportion of arcs that
are correctly identified in pc.fit with respect to gs.graph is 1, which implies
that the two network structures are identical.
Considering again the algorithms implemented in bnlearn , we can see that
hill-climbing and MMHC learn a different network structure from constraint-based
algorithms. The network learned with the hill-climbing algorithm is shown below,
and the steps performed by the algorithm are shown in Fig. 2.5 .
> bn.hc = hc(marks)
Search WWH ::




Custom Search