rbmn-package {rbmn} | R Documentation |
Linear Gaussian Bayesian network manipulations
Description
General functions to generate, transform, display general and
particular linear Gaussian Bayesian networks [/nbn/] are provided.
Specific /nbn/ are chain and crossed /nbn/s. Focus is given in getting
joint and conditional probability distributions of the set of
nodes.
rbmn stands for R'eseau Bay'esien MultiNormal.
Details
Some basic concepts:
-
chain /nbn/s are /nbn/s where all nodes are connected with two other nodes, except the two ending nodes of the chain having only one connection. (This is not the usual terminology in graphical models but I didn't find a more appropriate word: suggestions are welcome.)
-
crossed /nbn/s are /nbn/s having the node set defined as a Cartesian product of two series of items, and a DAG based on this structure. See the
crossed4nbn1nbn
function and/or Tian (2014) for details. An adjacency matrix is a matrix equivalent to the DAG associated to a /nbn/. Its rows as well as its columns are associated to the set of nodes. The
(i,j)
cell is one when there is an arc going from nodei
toj
and zero otherwise.
Three equivalent ways can be used to represent the joint probability distribution of a set of nodes respectively associated to the structures /mn/, /nbn/ and /gema/:
/mn/ (for multivariate normal) is just the list of the expectation (
$mu
) and the variance matrix ($gamma
)./nbn/ (for normal Bayesian network) is a simple list, a component a node described with a list. The names are node names and each list associated to a node provides the conditional expectation and variance, the parent (if any) and the associated regression coefficients.
/gema/ (for generating matrices) is a list of a vector (
mu
) and a matrix (li
) such that the vector of the nodes can be defined byX = mu + li%*%E
whereE
is a normal random vector with expectation zero and variance matrix unity.It is planned to add a fourth one under the name of /gbn/.
To relieve the memory effort, most names of the functions have been given a two (or more) components structure separated with a figure. This idea will be explained and exploited in a package to come named documair. The approximate meaning of the figures are:
0 (similar to 'o')
rbmn0chain.01
to indicate an object example provided by rbmn.1 (similar to an ~ and) ??? to link different objects or actions
train1car
for train and car.2 (as usual but only one-to-one)
nbn2gema
means \"transforming a /nbn/ into a /gema/ objects\".3 (remind the 'belong to' sign)
form3repeat
could be interpreted as "repeat action from the series of 'form' functions".4 (associated to 'from')
adja4nbn
means "get the adjacency matrix from a /nbn/ object".7 (upper bar of '7' similar to the hyphen)
arc7nb4nbn
means "get the arc-numbers from a /nbn/".8 (similar to 'a')
generate8nbn
orprint8nbn
for \"generating or printing a /nbn/ object\".
A number of ancillary functions have not been exported to give a better
access to the main function of /rbmn/. Nevertheless they are available
in the ../rbmn/R/
directory, and with all their comments
(equivalent to Rd
files into ../rbmn/inst/original/
directory). Some of them are visible when defining the default
arguments of some functions.
Projected evolution of /mn/
Generalize the /mn/ object with a regression part like the output of function
condi4joint
when argumentpour
is not of length zero and argumentx2
is not null. With such a structure, every node of a /nbn/ could be described with a /mn/ comprising a unique variable... Also the two arguments of functionmn4joint1condi
would be just two /mn/ objects... This is also the generalized /mn/ proposed in functionsimulate8gmn
under the argument ofloi
... Of course almost all functions dealing with /nbn/ objects will be to rewrite!Introduce a new object
gbn
for Gaussian Bayesian network similar to the list provided by functionnbn2rr
.
TO DO list
Systemize the existence of
check8object
functionsIntroduce their systematic use conditionned with a
rbmn0check
variable.Follow the main checking of every functions
Give (and use) class attributes to the main objects.
Introduce the main objects in this short presentation.
Make a true small example in this short presentation.
Make the function
nbn4string7dag
.Add the computation made with /bnlearn/ in the example of
estimate8nbn
.Check the topological order within
nbn2nbn
depending onrbmn0check
value.Make a super transformation function from an object associated to a Bayesian network to any other type, including itself.
Correct the
ord
option inorder4chain
.Check the topological order in
rm8nd4adja
.Think about removing all
rmatrix
transformations to the benefit of the to-comegbn
object.Introduce a check of non-negativity of
ma
intocor4var
.Add examples to all functions without any.
Author(s)
Original author: Jean-Baptiste Denis
Maintainer: Marco Scutari
References
Scutari M (2010). "Learning Bayesian Networks with the bnlearn R Package". Journal of Statistical Software, 35(3), 1-22.
Tian S, Scutari M & Denis J-B (2014). "Predicting with Crossed Linear Gaussian Bayesian Networks". Journal de la Societe Francaise de Statistique, 155(3), 1-21.
Examples
library(rbmn)
## getting the data set
data(boco)
print(head(boco));