rperm                  package:sna                  R Documentation

_D_r_a_w _a _R_a_n_d_o_m _P_e_r_m_u_t_a_t_i_o_n _V_e_c_t_o_r _w_i_t_h _E_x_c_h_a_n_g_e_a_b_i_l_i_t_y _C_o_n_s_t_r_a_i_n_t_s

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

     Draws a random permutation on `1:length(exchange.list)' such that
     no two elements whose corresponding `exchange.list' values are
     different are interchanged.

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

     rperm(exchange.list)

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

exchange.list: A vector such that the permutation vector may exchange
          the ith and jth positions iff
          `exchange.list[i]==exchange.list[j]' 

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

     `rperm' draws random permutation vectors given the constraints of
     exchangeability described above.  Thus, `rperm(c(0,0,0,0))'
     returns a random permutation of four elements in which all
     exchanges are allowed, while `rperm(c(1,1,"a","a")' (or similar)
     returns a random permutation of four elements in which only the
     first/second and third/fourth elements may be exchanged.  This
     turns out to be quite useful for searching permutation spaces with
     exchangeability constraints (e.g., for structural distance
     estimation).

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

     A random permutation vector satisfying the given constraints

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

     Carter T. Butts ctb@andrew.cmu.edu

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

     `rmperm'

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

     rperm(c(0,0,0,0))  #All elements may be exchanged
     rperm(c(0,0,0,1))  #Fix the fourth element
     rperm(c(0,0,1,1))  #Allow {1,2} and {3,4} to be swapped
     rperm(c("a",4,"x",2))  #Fix all elements (the identity permutation)

