Learn R Programming

bnlearn (version 2.9)

cpdag: Equivalence classes, moral graphs and consistent extenions

Description

Find the equivalence class and the v-structures of a Bayesian network, construct its moral graph, or create a consistent extension of an equivalent class.

Usage

cpdag(x, debug = FALSE)
cextend(x, debug = FALSE)
vstructs(x, arcs = FALSE, debug = FALSE)
moral(x, debug = FALSE)

Arguments

x
an object of class bn.
arcs
a boolean value. If TRUE the arcs that are part of at least one v-structure are returned instead of the v-structures themselves.
debug
a boolean value. If TRUE a lot of debugging output is printed; otherwise the function is completely silent.

Value

  • cpdag returns an object of class bn, representing the equivalence class. moral on the other hand returns the moral graph. See bn-class for details.

    cextend returns an object of class bn, representing a DAG that is the consistent extension of x.

    vstructs returns a matrix with either 2 or 3 columns, according to the value of the arcs parameter.

References

Pearl J (2000). Causality: Models, Reasoning and Inference. Cambridge University Press.

Dor D (1992). A Simple Algorithm to Construct a Consistent Extension of a Partially Oriented Graph. UCLA, Cognitive Systems Laboratory. Available as Technical Report R-185.

Examples

Run this code
data(learning.test)
res = gs(learning.test)
cpdag(res)
#
#   Bayesian network learned via Constraint-based methods
#
#   model:
#     [partially directed graph]
#   nodes:                                 6
#   arcs:                                  5
#     undirected arcs:                     1
#     directed arcs:                       4
#   average markov blanket size:           2.33
#   average neighbourhood size:            1.67
#   average branching factor:              0.67
#
#   learning algorithm:                    Grow-Shrink
#   conditional independence test:         Mutual Information (discrete)
#   alpha threshold:                       0.05
#   tests used in the learning procedure:  43
#   optimized:                             TRUE
#
vstructs(res)
#      X   Z   Y
# [1,] "A" "D" "C"
# [2,] "B" "E" "F"

Run the code above in your browser using DataLab