Description Usage Arguments Details Value Author(s) References Examples
Assign or extract various quantities of interest from an object of
class bn
of bn.fit
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | ## nodes
mb(x, node)
nbr(x, node)
parents(x, node)
parents(x, node, debug = FALSE) <- value
children(x, node)
children(x, node, debug = FALSE) <- value
in.degree(x, node)
out.degree(x, node)
# degree(x, node)
root.nodes(x)
leaf.nodes(x)
## arcs
arcs(x)
arcs(x, ignore.cycles = FALSE, debug = FALSE) <- value
directed.arcs(x)
undirected.arcs(x)
incoming.arcs(x, node)
outgoing.arcs(x, node)
incident.arcs(x, node)
compelled.arcs(x)
reversible.arcs(x)
narcs(x)
## adjacency matrix
amat(x)
amat(x, ignore.cycles = FALSE, debug = FALSE) <- value
## graphs
nparams(x, data, debug = FALSE)
ntests(x)
whitelist(x)
blacklist(x)
# shared with the graph package.
# these used to be a simple nodes(x) function.
## S4 method for signature 'bn'
nodes(object)
## S4 method for signature 'bn.fit'
nodes(object)
# these used to be a simple degree(x, node) function.
## S4 method for signature 'bn'
degree(object, Nodes)
## S4 method for signature 'bn.fit'
degree(object, Nodes)
|
x,object |
an object of class |
node,Nodes |
a character string, the label of a node. |
value |
either a vector of character strings (for |
data |
a data frame containing the data the Bayesian network
was learned from. It's only needed if |
ignore.cycles |
a boolean value. If |
debug |
a boolean value. If |
The number of parameters of a discrete Bayesian network is defined as the sum of the number of logically independent parameters of each node given its parents (Chickering, 1995). For Gaussian Bayesian networks the distribution of each node can be viewed as a linear regression, so it has a number of parameters equal to the number of the parents of the node plus one (the intercept) as per Neapolitan (2003).
mb
, nbr
, nodes
, parents
, children
,
root.nodes
and leaf.nodes
return a vector of character
strings.
arcs
, directed.arcs
, undirected.arcs
,
incoming.arcs
, outgoing.arcs
, incident.arcs
,
compelled.arcs
, reversible.arcs
, whitelist
and
blacklist
return a matrix of two columns of character strings.
narcs
returns the number of arcs in the graph.
amat
returns a matrix of 0/1 integer values.
degree
, in.degree
, out.degree
, nparams
and
ntests
return an integer.
Marco Scutari
Chickering DM (1995). "A Transformational Characterization of Equivalent Bayesian Network Structures". In "UAI '95: Proceedings of the Eleventh Annual Conference on Uncertainty in Artificial Intelligence", pp. 87-98. Morgan Kaufmann.
Neapolitan RE (2003). Learning Bayesian Networks. Prentice Hall.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | data(learning.test)
res = gs(learning.test)
## the Markov blanket of A.
mb(res, "A")
## the neighbourhood of F.
nbr(res, "F")
## the arcs in the graph.
arcs(res)
## the nodes of the graph.
nodes(res)
## the adjacency matrix for the nodes of the graph.
amat(res)
## the parents of D.
parents(res, "D")
## the children of A.
children(res, "A")
## the root nodes of the graph.
root.nodes(res)
## the leaf nodes of the graph.
leaf.nodes(res)
## number of parameters of the Bayesian network.
res = set.arc(res, "A", "B")
nparams(res, learning.test)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.