balancedtwostage          package:sampling          R Documentation

_B_a_l_a_n_c_e_d _t_w_o-_s_t_a_g_e _s_a_m_p_l_i_n_g

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

     Select a balanced two-stage sample. The function returns a matrix
     which contains as columns the following five vectors: the selected
     second-stage sampling units (0 - unselected, 1 - selected),  the
     final inclusion probabilities, the selected primary sampling
     units, the inclusion probabilities of the first stage, the
     inclusion probabilities of the second stage.

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

     balancedtwostage(X,selection,m,n,PU,comment=TRUE,method=1)

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

       X: matrix of auxiliary variables on which the sample must be
          balanced.

selection: 1, for simple random sampling without replacement at each
          stage,
           2, for self-weighting two-stage selection.

       m: number of primary sampling units to be selected.

       n: number of second-stage sampling units to be selected.

      PU: vector of integers that defines the primary sampling units.

 comment: a comment is written during the execution if 'comment' is
          equal to 'TRUE'.

  method: the used method in the function samplecube.

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

     'samplecube', 'fastflightcube', 'landingcube',
     'balancedstratification', 'balancedcluster'

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

     ############
     ## Example 1
     ############
     # definition of the primary units (3 primary units)
     PU=c(1,1,1,1,1,2,2,2,2,2,3,3,3,3,3)
     # matrix of balancing variables
     X=cbind(c(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15))
     # Selection of 2 primary sampling units and 4 second-stage sampling units
     s=balancedtwostage(X,1,2,4,PU,comment=TRUE)
     # The samples and the inclusion probabilities
     s
     ############
     ## Example 2
     ############
     data(MU284)
     X=cbind(MU284$P75,MU284$CS82,MU284$SS82,MU284$ME84)
     N=dim(X)[1]
     PU=MU284$CL
     m=20
     n=60
     res=balancedtwostage(X,1,m,n,PU,TRUE)
     # The samples and the inclusion probabilities
     res

