insert                 package:deal                 R Documentation

_I_n_s_e_r_t/_r_e_m_o_v_e _a_n _a_r_r_o_w _i_n _n_e_t_w_o_r_k

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

     Inserts/removes one arrow in a network (if legal)

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

     insert (nw,j,i,df,prior,nocalc=FALSE,trylist=vector("list",size(nw))) 
     remover(nw,j,i,df,prior,nocalc=FALSE,trylist=vector("list",size(nw))) 

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

      nw: an object of class 'network'.

       j: integer, giving the index of the 'from' node.

       i: integer, giving the index of the 'to' node.

      df: a data frame used for learning the network, see 'network'.

   prior: a list describing parameter priors, generated by
          'jointprior'.

  nocalc: a logical. If 'TRUE', learning is not called.

 trylist: a list, used internally for reusing learning of nodes, see
          'maketrylist'.

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

     Examines if the arrow from 'j' to 'i' is legal according to the
     following criteria

_1. Arrows from/to the same node are not legal.

_2. Arrows from continous nodes to discrete nodes are not legal.

_3. Arrows banned in ban list are not legal, see 'drawnetwork'.

_4. Arrows already existing in the network are not legal.

     If the arrow is not legal, a 'NULL' network is returned.
     Otherwise, the arrow is inserted/removed, the network is
     re-learned (if 'nocalc' is 'FALSE'). The trylist is updated.

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

     A list with two elements 

      nw: an object of class 'network' with the arrow added/removed if
          this is possible. If not, 'NULL' is returned.

 trylist: an updated list, used internally for reusing learning of
          nodes, see 'maketrylist'.

_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:

     data(rats)
     rats.nw    <- network(rats)
     rats.nw    <- getnetwork(insert(rats.nw,2,1,nocalc=TRUE))
     rats.prior <- jointprior(rats.nw,12)

     rats.nw2   <- network(rats)
     rats.nw2   <- getnetwork(learn(rats.nw2,rats,rats.prior))
     rats.nw2   <- getnetwork(insert(rats.nw2,1,2,rats,rats.prior))

     rats.nw3   <- getnetwork(remover(rats.nw2,1,2,rats,rats.prior))

