Simulation of data sets with a given dependency structure
Given a network with nodes having the simprob
property,
rnetwork
simulates
a data set.
rnetwork(nw, n=24, file="")
nw |
an object of class |
n |
an integer, which gives the number of cases to simulate. |
file |
a string. If non-empty, the data set is stored there. |
The variables are simulated one at a time in an order that ensures
that the parents of the node have already been simulated. For discrete
variables a multinomial distribution is used and for continuous
variables, a Gaussian distribution is used, according to the
simprob
property in each node.
A data frame with one row per case. If a file name is given, a file is created with the data set.
Susanne Gammelgaard Bottcher,
Claus Dethlefsen rpackage.deal@gmail.com.
A <- factor(NA,levels=paste("A",1:2,sep="")) B <- factor(NA,levels=paste("B",1:3,sep="")) c1 <- NA c2 <- NA df <- data.frame(A,B,c1,c2) nw <- network(df,doprob=FALSE) # doprob must be FALSE nw <- makesimprob(nw) # create simprob properties set.seed(944) sim <- rnetwork(nw,n=100) # create simulated data frame
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.