The structure of an object of S3 class bn.fit
.
An object of class bn.fit
is a list whose elements correspond to the
nodes of the Bayesian network. If the latter is discrete (i.e. the nodes are
multinomial random variables), the object also has class bn.fit.dnet
;
each node has class bn.fit.dnode
and contains the following elements:
node
: a character string, the label of the node.
parents
: a vector of character strings, the labels of the
parents of the node.
children
: a vector of character strings, the labels of the
children of the node.
prob
: a (multi)dimensional numeric table, the conditional
probability table of the node given its parents.
Nodes encoding ordinal variables (i.e. ordered factors) have class
bn.fit.onode
and contain the same elements as bn.fit.dnode
nodes. Networks containing only ordinal nodes also have class
bn.fit.onet
, while those contatining both ordinal and multinomial
nodes also have class bn.fit.donet
.
If on the other hand the network is continuous (i.e. the nodes are Gaussian
random variables), the object also has class bn.fit.gnet
; each node
has class bn.fit.gnode
and contains the following elements:
node
: a character string, the label of the node.
parents
: a vector of character strings, the labels of the
parents of the node.
children
: a vector of character strings, the labels of the
children of the node.
coefficients
: a numeric vector, the linear regression
coefficients of the parents against the node.
residuals
: a numeric vector, the residuals of the linear
regression.
fitted.values
: a numeric vector, the fitted mean values of
the linear regression.
sd
: a numeric value, the standard deviation of the residuals
(i.e. the standard error).
Hybrid (i.e. conditional linear Gaussian) networks also have class
bn.fit.gnet
. Gaussian nodes have class bn.fit.gnode
, discrete
nodes have class bn.fit.dnode
and conditional Gaussian nodes have
class bn.fit.cgnode
. Each node contains the following elements:
node
: a character string, the label of the node.
parents
: a vector of character strings, the labels of the
parents of the node.
children
: a vector of character strings, the labels of the
children of the node.
dparents
: an integer vector, the indexes of the discrete
parents in parents
.
gparents
: an integer vector, the indexes of the continuous
parents in parents
.
dlevels
: a list containing the levels of the discrete
parents in parents
.
coefficients
: a numeric matrix, the linear regression
coefficients of the continuous parents. Each column corresponds to
a configuration of the discrete parents.
residuals
: a numeric vector, the residuals of the linear
regression.
fitted.values
: a numeric vector, the fitted mean values of the
linear regression.
configs
: an integer vector, the indexes of the configurations
of the discrete parents.
sd
: a numeric vector, the standard deviation of the residuals
(i.e. the standard error) for each configuration of the discrete parents.
Furthermore, Bayesian network classifiers store the label of the training node
in an additional attribute named training
.