[R] bnlearn: how to compute boot strength with mmhc and a blacklist

Marco Scutari marco.scutari at gmail.com
Fri Apr 12 11:08:34 CEST 2013

Dear Leonore,

On Wed, Apr 10, 2013 at 5:51 PM, Leonore Wigger <leonore.wigger at unil.ch> wrote:
> Question: I have specified a blacklist. I would have expected this to
> completely disallow the arcs on the blacklist. But the result shows that
> some of the blacklisted arcs have a strength > 0 (rows 7,8,10,11). It
> seems that only the arc that was blacklisted in both directions was
> actually banned (x1-x2, in rows 9 and 12). What is the reason for this?
> Is there a way to completely disallow all blacklisted arcs, such that
> their strength is 0.0? Or is there a compelling reason why that should
> not be done?

Because by default boot.strength() runs with "cpdag = TRUE". This
means that reversible arcs can have positive strength in both
directions. You should set "cpdag = FALSE" to get the result you are
expecting. In that case the probabilities of the arc directions should
be taken with a grain of salt, as they can be influenced by many
things (optimized = TRUE/FALSE, order of the variables in the data
set) unless you are doing causal modelling.

> This code makes 50 different networks from the same data, then uses them
> as input for custom.strength. The networks are constructed using the
> algorithm "hc". A different network is produced every time "hc" is
> invoked because a random starting network is supplied to the parameter
> "start". I would like to do the same thing, but use "mmhc" instead of
> "hc". However, in my hands, the networks that are constructed by "mmhc"
> are all identical, and I am not sure how to introduce a random element
> into the construction. Question: Which parameters do I need to give to
> "mmhc" in order to obtain a different network every time it is run on
> the same data set?

This is not surprising, because mmhc() does not have a "start"
argument, so it's starting from the same network over and over. There
is no way to provide a random seed to mmhc(), so the only way to
perturb it is through bootstrap.


Marco Scutari, Ph.D.
Research Associate, Genetics Institute (UGI)
University College London (UCL), United Kingdom

More information about the R-help mailing list