Biology Reference
In-Depth Information
+ "ALG" = 1), sd = 10)
> ALG.par = list(coef = c("(Intercept)" = 25,
+ "ANL" = 0.5, "STAT" = 0.25), sd = 6.5)
> ANL.par = list(coef = c("(Intercept)" = 25,
+ "STAT" = 0.5), sd = 12)
> STAT.par = list(coef = c("(Intercept)" = 43),
+ sd = 17)
> dist = list(MECH = MECH.par, VECT = VECT.par,
+ ALG = ALG.par, ANL = ANL.par,
+ STAT = STAT.par)
> fitted2 = custom.fit(bn.gs, dist = dist)
Note that the network structure stored in the object of class
bn
passed to
bn.fit
and
custom.fit
must be a DAG; any undirected arc must be either dropped (with
the
drop.arc
function) or replaced with a directed one (with the
set.arc
func-
tion). As an alternative, if the network structure is a completed partially acyclic
graph representing an equivalence class, we can also use the
cextend
function to
consistently extend it to a DAG (
Dor and Tarsi
,
1992
).
2.3.6 Discretization
We consider now how to discretize the
marks
data set while at the same time pre-
serving the dependence structure of the data and how this transformation changes
the results of Bayesian network learning. For instance, we can discretize each vari-
able in the
marks
data into a dichotomic one by a median split transform (so that
students with marks above the median are in one category and students below the
median are in the other one). If we learn the network structure of this new data set,
using the Grow-Shrink and hill-climbing algorithms as we did in Sect.
2.3.4
,weget
the networks shown in Fig.
2.6
.
> dmarks = discretize(marks, breaks = 2,
+
method = "interval")
> bn.dgs = gs(dmarks)
> bn.dhc = hc(dmarks)
> all.equal(cpdag(bn.dgs), cpdag(bn.dhc))
[1] TRUE
Both networks belong again to the same equivalence class, and we can see that
part of the dependence structure of the original network is still present:
ALG
still
d-separates
ANL
and
STAT
from
MECH
and
VECT
, but the arc between
ANL
and
STAT
and the one between
ALG
and
MECH
are missing.
Since all the variables are now discrete, the parameters of the Bayesian net-
work are the elements of the CPTs, as discussed in Sect.
2.2.4
. For example, for
the
bn.dhc
network, they can be learned and displayed as follows:
Search WWH ::
Custom Search