addrandomarrow             package:deal             R Documentation

_A_d_d_i_n_g/_T_u_r_n_i_n_g/_R_e_m_o_v_i_n_g _r_a_n_d_o_m _a_r_r_o_w_s

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

     Create network with exactly one arrow added/turned/removed
     randomly chosen.

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

     addrandomarrow(nw,data,prior,trylist=vector("list",nw$n),nocalc=FALSE,
                    timetrace=FALSE)
     turnrandomarrow(nw,data,prior,trylist=vector("list",nw$n),nocalc=FALSE,
                    timetrace=FALSE)
     deleterandomarrow(nw,data,prior,trylist=vector("list"),nw$n),nocalc=FALSE,
                    timetrace=timetrace)  

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

      nw: an object of class `network', from which arrows are
          added/removed/turned.

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

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

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

  nocalc: a logical. if `TRUE', the learning procedure is not called.
          Used if only a random graph is wanted.

timetrace: a logical. If `TRUE', prints some timing information on the
          screen.

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

     Given the starting network, a network is created with exactly one
     arrow added/turned/removed. The arrow is chosen randomly amongst
     all possibilities. If there are no possibilities, the original
     network is returned.  All networks are learned with the data in
     `df' using the prior information in `prior'. Used by `perturb'.

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

     A list with two elements 

      nw: an object of class `networkfamily' with all created networks.
          All networks have been learned.

 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.auc.dk, 
     Claus Dethlefsen dethlef@math.auc.dk.

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

     Further information about deal can be found at:
     <URL: http://www.math.auc.dk/novo/deal>.

_S_e_e _A_l_s_o:

     `perturb'

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

     data(rats)
     fit       <- network(rats,specifygraph=FALSE,inspect=FALSE)
     fit.prior <- jointprior(fit,12)
     fit       <- learn(fit,rats,fit.prior)$nw
     set.seed(10)
     rats.extra <- addrandomarrow(fit,rats,fit.prior)$nw
     rats.extra <- addrandomarrow(rats.extra,rats,fit.prior)$nw
     rats.extra <- turnrandomarrow(rats.extra,rats,fit.prior)$nw
     rats.extra <- deleterandomarrow(rats.extra,rats,fit.prior)$nw
     plot(rats.extra)

