rgraph                  package:sna                  R Documentation

_G_e_n_e_r_a_t_e _B_e_r_n_o_u_l_l_i _R_a_n_d_o_m _G_r_a_p_h_s

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

     `rgraph' generates random draws from a Bernoulli graph
     distribution, with various parameters for controlling the nature
     of the data so generated.

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

     rgraph(n, m=1, tprob=0.5, mode="digraph", diag=FALSE, replace=FALSE,
         tielist=NULL)

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

       n: The size of the vertex set (|V(G)|) for the random graphs 

       m: The number of graphs to generate 

   tprob: Information regarding tie (edge) probabilities; see below 

    mode: ``digraph'' for directed data, ``graph'' for undirected data 

    diag: Should the diagonal entries (loops) be set to zero? 

 replace: Sample with or without replacement from a tie list (ignored
          if `tielist==NULL' 

 tielist: A vector of edge values, from which the new graphs should be
          bootstrapped 

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

     `rgraph' is a reasonably versatile routine for generating random
     network data.  The graphs so generated are either Bernoulli graphs
     (graphs in which each edge is a Bernoulli trial, independent
     conditional on the Bernoulli parameters), or are bootstrapped from
     a user-provided edge distribution (very handy for CUG tests).  In
     the latter case, edge data should be provided using the `tielist'
     argument; the exact form taken by the data is irrelevant, so long
     as it can be coerced to a vector.  In the former case, Bernoulli
     graph probabilities are set by the `tprob' argument as follows:

        1.  If `tprob' contains a single number, this number is used as
           the probability of all edges.

        2.  If `tprob' contains a vector, each entry is assumed to
           correspond to a separate graph (in order).  Thus, each entry
           is used as the probability of all edges within its
           corresponding graph.

        3.  If `tprob' contains a matrix, then each entry is assumed to
           correspond to a separate edge.  Thus, each entry is used as
           the probability of its associated edge in each graph which
           is generated.

        4.  Finally, if `tprob' contains a three-dimensional array,
           then each entry is assumed to correspond to a particular
           edge in a particular graph, and is used as the associated
           probability parameter.

     Finally, note that `rgraph' will symmetrize all generated networks
     if `mode' is set to ``graph'' by copying down the upper triangle. 
     The lower half of `tprob', where applicable, must still be
     specified, however.

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

     A graph stack

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

     Carter T. Butts ctb@andrew.cmu.edu

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

     Wasserman, S., and Faust, K.  Social Network Analysis: Methods and
     Applications.  Cambridge: Cambridge University Press.

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

     `rmperm'

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

     #Generate three graphs with different densities
     g<-rgraph(10,3,tprob=c(0.1,0.9,0.5))

     #Generate from a matrix of Bernoulli parameters
     g.p<-matrix(runif(25,0,1),nrow=5)
     g<-rgraph(5,2,tprob=g.p)

