Learn R Programming

bnlearn (version 3.1)

bn.var: Structure variability of Bayesian networks

Description

Measure the variability of the structure of a Bayesian network.

Usage

# first and second moments' estimation
bn.moments(data, R = 200, m = nrow(data), algorithm,
  algorithm.args = list(), reduce = NULL, debug = FALSE)
# descriptive statistics
bn.var(x, method)

Arguments

data
a data frame containing the variables in the model.
R
a positive integer, the number of bootstrap replicates (in bn.moments) or the number of Monte Carlo samples (in bn.var.test).
m
a positive integer, the bootstrap sample size.
algorithm
a character string, the learning algorithm to be applied to the bootstrap replicates. Possible values are gs, iamb, fast.iamb, inter.iamb, mmpc, hc, tabu
algorithm.args
a list of extra arguments to be passed to the learning algorithm.
x
a covariance matrix or an object of class mvber.moments (the return value of the bn.moments function).
method
a character string, the label of the statistic. Possible values are tvar (total variance), gvar (generalized variance), nvar (Frobenius matrix norm, which is equivalent to
reduce
a character string, either first or second. If first all the arcs with first moment equal to zero are dropped; if if second all the arcs with zero variance are dropped.
debug
a boolean value. If TRUE a lot of debugging output is printed; otherwise the function is completely silent.

Value

  • bn.moments returns an object of class mvber.moments.

    bn.var returns a vector of two elements, the observed value of the statistic (named statistic) and its normalized equivalent (named normalized).

References

Scutari M (2009). "Structure Variability in Bayesian Networks". ArXiv Statistics - Methodology e-prints. http://arxiv.org/abs/0909.1685.

Examples

Run this code
z =  bn.moments(learning.test, algorithm = "gs", R = 100)
bn.var(z, method = "tvar")
#  statistic normalized
#    1.29060    0.34416

Run the code above in your browser using DataLab