Plotting arc strengths with Rgraphviz and lattice

Measuring the strength of the relationship represented by each arc in a network is a fundamental tool to learn and investigate the structure of Bayesian network. Arc strengths are mostly used programmatically for both purposes; nevertheless it is sometimes useful to explore them visually.

We will consider all the different measures of arc strengths implemented in bnlearn:

  1. p-values from the conditional independence tests that would remove individual arcs present in a network;
  2. > dag = model2network("[A][C][F|C:A][B|A][D|A:C][E|B:F]")
    > pvalues = arc.strength(dag, data = learning.test, criterion = "x2")
    
  3. differences in network score from removing individual arcs present in a network;
  4. > score.deltas = arc.strength(dag, data = learning.test, criterion = "bic")
    
  5. probabilities of inclusion of all possible arcs, and their directions;
  6. > bagging = boot.strength(learning.test, algorithm = "tabu", R = 200)
    
  7. probabilities of inclusion of individual arcs present in a network, and their directions.
  8. > bayes.factors = bf.strength(dag, data = learning.test)
    
    Loading required namespace: Rmpfr
    

Plotting the distribution of arc strengths

> plot(bagging)
plot of chunk unnamed-chunk-6

Plotting the network structure together with the arc strengths

> strength.plot(dag, strength = pvalues)
plot of chunk unnamed-chunk-7
Last updated on Sun Jun 21 22:32:02 2020 with bnlearn 4.6-20200410 and R version 4.0.1 (2020-06-06).