This is the base class in the catnet
package for representing Bayesian networks with categorical values.
It stores both the graph and probability structure of categorical Bayesian networks.
Technically, catNetwork
is a S4 type of R-class implemented in object-oriented style, with slots representing object components and members for accessing and manipulating class objects. Below we list the slots of catNetwork
and some of its main members along with the functions for creating catNetwork
objects.
Objects can be created by calls of
cnNew(nodes, cats, pars, probs)
cnRandomCatnet(numnodes, maxpars, numCategories)
cnCatnetFromEdges(nodes, edges, numCategories)
cnCatnetFromSif(file)
cnCatnetFromBif(file)
cnCatnetFromXdsl(file)
objectName
an optional object name of class character
.
numnodes
:an integer, the number of nodes in the object.
nodes
:a vector
specifying the node names.
pars
:a list
specifying the node pars.
The list pars
must be the same length as nodes
.
Parents are kept as indices in the nodes
vector.
cats
:a list
of characters specifying a set of categorical values for each node.
probs
:a numerical list
that for each node specifies a discrete probability distribution -
the distribution of the node conditional on its parent set.
The elements of probs
are lists themselves. See cnProb
function for more details.
maxpars
:an integer, the maximum number of node pars.
maxcats
:an integer, the maximum number of node cats.
meta
:an object of class character
storing some meta-data information.
nodecomplx
:a numerical vector
, the node complexities.
nodelik
:a numerical vector
, the node likelihoods of the sample being used for estimation.
complx
:an integer
, the network complx
loglik
:a numerical
, the total loglik of the sample being used for estimation
nodeSampleSizes
:a numerical vector
, if the object is an estimate, the node sample sizes.
signature
(nodes="vector
",
cats="list
", pars="list
", probs="list
"):
Creating a new class object.
signature
(numnodes="integer
",
maxpars="integer
", numCategories="integer
"):
Creating a random class object.
signature
(nodes="vector
", edges="list
", numCategories="integer
"):
Deriving a class object from a list of edges.
signature
(file="character
"):
Creating a class object from a file.
signature
(object="catNetwork
"):
signature
(object="catNetwork
", which="vector
"):...
signature
(object="catNetwork
", nodeIndices="vector
",
indirectEdges="logical
"):...
signature
(object="catNetwork
", nodeIndices="vector
"):...
signature
(object="catNetwork
", which="vector
"):...
signature
(object="catNetwork
", nodeorder="vector
"):...
signature
(object="catNetwork
", which="vector
"):...
signature
(object="catNetwork
"):...
signature
(object="catNetwork
"):...
signature
(object="catNetwork
", psamples="matrix
"):...
signature
(object="catNetwork
"):...
signature
(object="catNetwork
", file="character
"):...
signature
(object="catNetwork
", nsamples="integer
"):...
signature
(object="catNetwork
", nsamples="integer
",
perturbations="matrix
"):...
signature
(object="catNetwork
"):...
signature
(object="catNetwork
", psamples="matrix
"):...
signature
(object="catNetwork
"):...
signature
(object="catNetwork
", psamples="matrix
",
perturbations="matrix
", maxComplexity="integer
"):...
signature
(object="catNetwork
", psamples="matrix
"):...
signature
(object1="catNetwork
", object2="catNetwork
"):...
The catNetwork
class provides a comprehensive general structure for representing
discrete Bayesian networks by describing both the graph and probability structures.
Although available for direct access, the class components, its slots, should not be manipulated directly but using the class members instead. A catNetwork
object integrity can always be checked by calling is(object, "catNetwork")
.
cnRandomCatnet
, cnCatnetFromEdges
, cnNew
,
cnNodes
, cnEdges
, cnComplexity
, cnPlot
# NOT RUN {
set.seed(123)
cnet <- cnRandomCatnet(numnodes=10, maxpars=2, numcats=2)
cnet
# }
Run the code above in your browser using DataLab