samprop              package:sampfling              R Documentation

_R_a_n_d_o_m _S_a_m_p_l_i_n_g: _t_h_e _S_a_m_p_f_o_r_d _A_l_g_o_r_i_t_h_m

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

     'samprop' implements a modified version of the Sampford algorithm
     to obtain a sample without replacement and with unequal
     probabilities. The probability of the sample is proportional to
     the product of the probabilities of units contained in the sample.

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

      samprop(x, size, prob = NULL)

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

       x: Either a (numeric, complex, character or logical) vector of
          more than one element from which to choose, or a positive
          integer.

    size: A positive integer giving the number of items to choose.

    prob: A vector of weights for obtaining the elements of the vector
          being sampled.

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

     If 'x' has length 1, sampling takes place from '1:x'.

     The 'prob' argument gives a vector of weights for obtaining the
     elements of the vector being sampled.  They need not sum to one,
     but they should be nonnegative.  The number of nonzero weights
     must be at least 'size'.  Each weight cannot exceed a certain
     quantity, in order to satisfy Sampford algorithm requirements (see
     'sampfle').

     This procedure draws a sample without replacement, which
     probability is proportional to the product of weights of units
     contained in the sample.

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

     A vector of size 'size', which contains the sampled units from
     'x', or indices if 'x' is an integer.

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

     Carlos Enrique Carleos Artime carleos@vodafone.es.

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

     Cochran, W.G. (1977) _Sampling techniques_, John Wiley and Sons.

     Sampford, M.R. (1967) On sampling without replacement with unequal
     probabilities of selection, _Biometrika_ 54:499-513.

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

     'sampfle'

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

     library(sampfling)
     samprop(10, 3, 1:10)
     samprop(c("a","b","c"), 2, c(0.3,0.3,0.4))

