Description Usage Arguments Details Value Note Author(s) References See Also Examples
View source: R/frontendstrength.R
Measure the strength of the probabilistic relationships expressed by the arcs of a Bayesian network, and use model averaging to build a network containing only the significant arcs.
1 2 3 4 5 6 7 8 9 10 11 12 13  # strength of the arcs present in x.
arc.strength(x, data, criterion = NULL, ..., debug = FALSE)
# strength of all possible arcs, as learned from bootstrapped data.
boot.strength(data, cluster = NULL, R = 200, m = nrow(data),
algorithm, algorithm.args = list(), cpdag = TRUE, debug = FALSE)
# strength of all possible arcs, from a list of custom networks.
custom.strength(networks, nodes, weights = NULL, cpdag = TRUE, debug = FALSE)
# average arc strengths.
## S3 method for class 'bn.strength'
mean(x, ..., weights = NULL)
# averaged network structure.
averaged.network(strength, nodes, threshold)

x 
an object of class 
networks 
a list, containing either object of class 
data 
a data frame containing the data the Bayesian network was learned from. 
cluster 
an optional cluster object from package parallel. 
strength 
an object of class 
threshold 
a numeric value, the minimum strength required for an
arc to be included in the averaged network. The default value is the

nodes 
a vector of character strings, the labels of the nodes in the
network. In 
criterion 
a character string, the label of a score function or an
independence test. See 
R 
a positive integer, the number of bootstrap replicates. 
m 
a positive integer, the size of each bootstrap replicate. 
weights 
a vector of nonnegative numbers, to be used as weights
when averaging arc strengths (in 
cpdag 
a boolean value. If 
algorithm 
a character string, the learning algorithm to be applied
to the bootstrap replicates. Possible values are 
algorithm.args 
a list of extra arguments to be passed to the learning algorithm. 
... 
in 
debug 
a boolean value. If 
arc.strength
computes a measure of confidence or strength for each
arc, while keeping fixed the rest of the network structure.
If criterion
is a conditional independence test, the strength is a
pvalue (so the lower the value, the stronger the relationship). The
conditional independence test would be that to drop the arc from the
network. The only possible additional argument is B
, the number
of permutations to be generated for each permutation test.
If criterion
is the label of a score function, the strength is
measured by the score gain/loss which would be caused by the arc's removal.
In other words, it is the difference between the score of the network
including the arc and the score of the network in which the arc is not
present. Negative values correspond to decreases in the network score and
positive values correspond to increases in the network score (the stronger
the relationship, the more negative the difference). There may be additional
aguments depending on the choice of the score, see score
for
details.
boot.strength
estimates the strength of each arc as its empirical
frequency over a set of networks learned from bootstrap samples. It computes
the probability of each arc (modulo its direction) and the probabilities of
each arc's directions conditional on the arc being present in the graph (in
either direction).
custom.strength
takes a list of networks and estimates arc strength
in the same way as boot.strength
.
Model averaging is supported for objects of class bn.strength
returned
by boot.strength
or by custom.strength
. The
returned network contains the arcs whose strength is greater than the
threshold
attribute of the bn.strength
object passed to
averaged.network
.
arc.strength
, boot.strength
, custom.strength
and
mean
return an object of class bn.strength
; boot.strength
and custom.strength
also include information about the relative
probabilities of arc directions.
averaged.network
returns an object of class bn
.
See bn.strength class
and bnclass
for details.
averaged.network
typically returns a completely directed graph; an arc
can be undirected if and only if the probability of each of its directions is
exactly 0.5. This may happen, for example, if the arc is undirected in all
the networks being averaged.
Marco Scutari
for model averaging and boostrap strength (confidence):
Friedman N, Goldszmidt M, Wyner A (1999). "Data Analysis with Bayesian Networks: A Bootstrap Approach". In "UAI '99: Proceedings of the 15th Annual Conference on Uncertainty in Artificial Intelligence", pp. 196201. Morgan Kaufmann.
for the computation of the strength (confidence) significance threshold:
Scutari M, Nagarajan R (2011). "On Identifying Significant Edges in Graphical Models". In "Proceedings of the Workshop 'Probabilistic Problem Solving in Biomedicine' of the 13th Artificial Intelligence in Medicine (AIME) Conference", pp. 1527.
strength.plot
, choose.direction
,
score
, ci.test
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19  data(learning.test)
res = gs(learning.test)
res = set.arc(res, "A", "B")
arc.strength(res, learning.test)
## Not run:
arcs = boot.strength(learning.test, algorithm = "hc")
arcs[(arcs$strength > 0.85) & (arcs$direction >= 0.5), ]
averaged.network(arcs)
start = random.graph(nodes = names(learning.test), num = 50)
netlist = lapply(start, function(net) {
hc(learning.test, score = "bde", iss = 10, start = net) })
arcs = custom.strength(netlist, nodes = names(learning.test),
cpdag = FALSE)
arcs[(arcs$strength > 0.85) & (arcs$direction >= 0.5), ]
modelstring(averaged.network(arcs))
## End(Not run)

Attaching package: 'bnlearn'
The following object is masked from 'package:stats':
sigma
from to strength
1 A B 0.000000e+00
2 A D 0.000000e+00
3 B E 1.024198e320
4 C D 0.000000e+00
5 F E 3.935648e245
from to strength direction
1 A B 1 0.5000
3 A D 1 1.0000
6 B A 1 0.5000
9 B E 1 0.9975
13 C D 1 1.0000
30 F E 1 0.9975
Random/Generated Bayesian network
model:
[partially directed graph]
nodes: 6
arcs: 5
undirected arcs: 1
directed arcs: 4
average markov blanket size: 2.33
average neighbourhood size: 1.67
average branching factor: 0.67
generation algorithm: Model Averaging
significance threshold: 1
from to strength direction
1 A B 1 1.00
3 A D 1 1.00
9 B E 1 1.00
13 C D 1 0.96
30 F E 1 0.70
[1] "[A][C][F][BA][DA:C][EB:F]"
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.