sim_data_from_bn {jti} | R Documentation |
Simulate data from a Bayesian network
Description
Simulate data from a Bayesian network
Usage
sim_data_from_bn(
net,
lvls,
nsims = 1000,
increasing_prob = FALSE,
p1 = 0.8,
p2 = 1
)
Arguments
net |
A Bayesian network as an igraph object |
lvls |
Named integer vector where each element is the size of the statespace of the corresponding variable |
nsims |
Number of simulations distributions from which the simulatios are drawn. |
increasing_prob |
Logical. If true, probabilities in the underlying CPTs increases with as the number of levels increses. |
p1 |
Probability |
p2 |
Probability |
Examples
net <- igraph::graph(as.character(c(1,2,1,3,3,4,3,5,5,4,2,6,6,7,5,7)), directed = TRUE)
nodes_net <- igraph::V(net)$name
lvls_net <- structure(sample(3:9, length(nodes_net)), names = nodes_net)
lvls_net <- structure(rep(3, length(nodes_net)), names = nodes_net)
sim_data_from_bn(net, lvls_net, 10)
[Package jti version 0.8.4 Index]