ResperByrow              package:resper              R Documentation

_S_a_m_p_l_e _f_r_o_m _a _s_e_t _o_f _r_e_s_t_r_i_c_t_e_d _p_e_r_m_u_t_a_t_i_o_n_s

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

     Sample from a set of permutations restricted by a Boolean  or 0-1
     matrix A, where the rows correspond to the original elements and
     the columns to the positions in the permutation. A_{i,j}=1 means
     that the ith element may occur at the jth position in the permuted
     sequence.

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

     ResperByrow(mat)

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

     mat: A Boolean or 0-1 matrix. A permutation can only be gemerated
          if at least one element in each row and each column is equal
          to 1.  

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

     This function uses an accept-reject algorithm. It selects the
     first row, samples an appropriate  cell from the 1s in the row
     (denoting the position to  which the element corresponding to the
     row will be shifted), eliminates the cell row and column from the
     matrix and  reiterates the algorithm on the minor. The sampling 
     weights are constructed by an envelope probability  discovered by
     huber2003, which guarantees that the  sum of weights over all
     minors is less than or equal to the weight of the matrix itself.
     If the algorithm samples the ``less than'' part, it will reject
     and restart the current attempt.

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

     A sequence of values corresponding to the row indices  of
     \verb+t+.

_N_o_t_e:

     The function does not check if the input is a proper 0-1 matrix.

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

     Johannes Hüsing

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

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

     'link{WithinDeltaMat}', 'link{ResperClot}'

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

     ##  No element may be shifted by more than two 
     ##  positions

     mat <- toeplitz(c(rep(1,3), rep(0,3)))
     perm <- ResperByrow(mat)
     perm

       

