Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

rbn

Random values simulation from a Bayesian network


Description

Random values simulation from a Bayesian network.

Usage

rbn(n, dagobj, x)

Arguments

n

The number of observations to generate.

dagobj

A "bn" object. See the examples for more information.

x

The data used to fit the Bayesian network in a data.frame format.

Details

This information is taken directly from the R package "bnlearn". This function implements forward/logic sampling: values for the root nodes are sampled from their (un-conditional) distribution, then those of their children conditional on the respective parent sets. Thisis done iteratively until values have been sampled for all nodes.If "dagobj" contains NA parameter estimates (because of unobserved discrete parents configurations in the data the parameters were learned from), rbn will produce observations that contain NAs when thoseparents configurations appear in the simulated samples.

Value

A data frame with the same structure (column names and data types) of the argument "data".

Author(s)

Michail Tsagris

R implementation and documentation: Michail Tsagris mtsagris@uoc.gr.

References

Korb K. and Nicholson A.E. (2010).Bayesian Artificial Intelligence. Chapman & Hall/CRC, 2nd edition.

See Also

Examples

# simulate a dataset with continuous data
x <- matrix( rnorm(200 * 20, 1, 10), nrow = 200 )
a <- pchc(x)
sim <- rbn( 100, dagobj = a$dag, x = x )

pchc

Bayesian Network Learning with the PCHC and Related Algorithms

v0.5
GPL (>= 2)
Authors
Michail Tsagris [aut, cre]
Initial release
2021-03-21

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.