rnetwork                package:deal                R Documentation

_S_i_m_u_l_a_t_i_o_n _o_f _d_a_t_a _s_e_t_s _w_i_t_h _a _g_i_v_e_n _d_e_p_e_n_d_e_n_c_y _s_t_r_u_c_t_u_r_e

_D_e_s_c_r_i_p_t_i_o_n:

     Given a network with nodes having the 'simprob' property,
     'rnetwork' simulates a data set.

_U_s_a_g_e:

     rnetwork(nw, n=24, file="") 

_A_r_g_u_m_e_n_t_s:

      nw: an object of class 'network', where each node has the
          property 'simprob' (see 'makesimprob').

       n: an integer, which gives the number of cases to simulate.

    file: a string. If non-empty, the data set is stored there.

_D_e_t_a_i_l_s:

     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.

_V_a_l_u_e:

     A data frame with one row per case. If a file name is given, a
     file is created with the data set.

_A_u_t_h_o_r(_s):

     Susanne Gammelgaard Bttcher alma@math.aau.dk, 
      Claus Dethlefsen cld@rn.dk.

_R_e_f_e_r_e_n_c_e_s:

     Further information about *deal* can be found at:
      <URL: http://www.math.aau.dk/~dethlef/novo/deal>.

_E_x_a_m_p_l_e_s:

     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

