Biology Reference
In-Depth Information
(c) > C = c(rnorm(50, mean = 2, sd = 2),
+ rnorm(50, mean = 4, sd = 1))
and the data frame can then be created with
> data = data.frame(A = A, B = B, C = C)
Then, the standard deviations can be computes as
> by(data[, "C"], INDICES = data[, c("A", "B")],
+
FUN = sd)
Exercises of Chap. 2
2.1 Consider the asia synthetic data set from Lauritzen and Spiegelhalter
( 1988 ), which describes the diagnosis of a patient at a chest clinic who has just
come back from a trip to Asia and is showing dyspnea.
(a) Load the data set from the bnlearn package and investigate its character-
istics using the exploratory analysis techniques covered in Chap. 1 .
(b) Create a bn object with the network structure described in the manual
page of asia .
(c) Derive the skeleton, the moral graph, and the CPDAG representing the
equivalence class of the network. Plot them using graphviz.plot .
(d) Identify the parents, the children, the neighbors, and the Markov blanket
of each node.
(a) > summary(asia)
> dim(asia)
(b) > spec = "[A][S][T|A][L|S][B|S][D|B:E][E|T:L][X|E]"
> bn = model2network(spec)
(c) > bn.skel = skeleton(bn)
> graphviz.plot(bn.skel)
> bn.moral = moral(bn)
> graphviz.plot(bn.moral)
> bn.eq = cpdag(bn)
> graphviz.plot(bn.eq)
(d) > sapply(nodes(bn), parents, x = bn)
> sapply(nodes(bn), children, x = bn)
> sapply(nodes(bn), nbr, x = bn)
> sapply(nodes(bn), mb, x = bn)
2.2 Using the network structures created in Exercise 2.1 for the asia data set,
produce the following plots with graphviz.plot :
(a) A plot of the CPDAG of the equivalence class in which the arcs belonging
to a v-structure are highlighted (either with a different color or using a
thicker line width).
Search WWH ::




Custom Search