Description Usage Arguments Details Value Author(s) See Also Examples
Check both possible directed arcs for existence, and choose the one with the lowest p-value, the highest score or the highest bootstrap probability.
1 |
x |
an object of class |
arc |
a character string vector of length 2, the labels of two nodes of the graph. |
data |
a data frame containing the data the Bayesian network was learned from. |
criterion |
a character string, the label of a score
function, the label of an independence test or |
... |
additional tuning parameters for the network score.
See |
debug |
a boolean value. If |
If criterion
is bootstrap
, choose.directions
accepts
the same arguments as boot.strength
: R
(the number of
bootstrap replicates), m
(the bootstrap sample size), algorithm
(the structure learning algorithm), algorithm.args
(the arguments to
pass to the structure learning algorithm) and cpdag
(whether to
transform the network structure to the CPDAG representation of the equivalence
class it belongs to).
choose.direction
returns invisibly an updated copy of x
.
Marco Scutari
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | data(learning.test)
res = gs(learning.test)
## the arc A - B has no direction.
choose.direction(res, learning.test, arc = c("A", "B"), debug = TRUE)
## let's see score equivalence in action.
choose.direction(res, learning.test, criterion = "aic",
arc = c("A", "B"), debug = TRUE)
## arcs which introduce cycles are handled correctly.
res = set.arc(res, "A", "B")
# now A -> B -> E -> A is a cycle.
choose.direction(res, learning.test, arc = c("E", "A"), debug = TRUE)
## Not run:
choose.direction(res, learning.test, arc = c("D", "E"), criterion = "bootstrap",
R = 100, algorithm = "iamb", algorithm.args = list(test = "x2"), cpdag = TRUE,
debug = TRUE)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.