Learn R Programming

bnlearn (version 1.6)

rbn: Generate random data from a given Bayesian network

Description

Generate random data from a given Bayesian network.

Usage

rbn(x, n, data, debug = FALSE)

Arguments

x
an object of class bn.
n
non-negative integer giving the number of observations to generate.
data
a data frame, containing the data the Bayesian network was learned from.
debug
a boolean value. If TRUE a lot of debugging output is printed; otherwise the function is completely silent.

Value

  • A data frame with the same structure (column names and data types) of the data parameter.

References

Korb K, Nicholson AE (2003). Bayesian Artificial Intelligence. Chapman & Hall/CRC.

Examples

Run this code
data(learning.test)
res = gs(learning.test)
res = set.arc(res, "A", "B")
par(mfrow = c(1,2))
plot(res)
sim = rbn(res, 500, learning.test)
plot(gs(sim))

Run the code above in your browser using DataLab