balancedstratification       package:sampling       R Documentation

_B_a_l_a_n_c_e_d _s_t_r_a_t_i_f_i_c_a_t_i_o_n

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

     Select a stratified balanced sample (a vector of 0 and 1).
     Firstly, the flight phase is applied in each stratum. Secondly,
     the strata are aggregated and the flight phase is applied on the
     whole population. Finally, the landing phase is applied on the
     whole population.

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

     balancedstratification(X,strat,pik,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.

   strat: vector of integers that specifies the stratification.

     pik: vector of inclusion probabilities.

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

  method: the used method in the function samplecube.

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

     Till, Y. (2006), _Sampling Algorithms_, Springer. Chauvet, G. and
     Till, Y. (2006). A fast algorithm of balanced sampling. _to
     appear in Computational Statistics_. 
      Chauvet, G. and Till, Y. (2005). New SAS macros for balanced
     sampling. In INSEE, editor, _Journes de Mthodologie
     Statistique_, Paris.
      Deville, J.-C. and Till, Y. (2004). Efficient balanced sampling:
     the cube method. _Biometrika_, 91, 893-912.
      Deville, J.-C. and Till, Y. (2005). Variance approximation under
     balanced sampling. _Journal of Statistical Planning and
     Inference_, 128/2:411-425.

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

     'samplecube', 'fastflightcube', 'landingcube'

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

     ############
     ## Example 1
     ############
     # variable of stratification (3 strata)
     strat=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))
     # Vector of inclusion probabilities.
     # The sample has its size equal to 9.
     pik=rep(3/5,times=15)
     # Selection of a stratified sample
     s=balancedstratification(X,strat,pik,comment=TRUE)
     # The sample is
     (1:length(pik))[s==1]
     ############
     ## Example 2
     ############
     data(MU284)
     X=cbind(MU284$P75,MU284$CS82,MU284$SS82,MU284$S82,MU284$ME84)
     strat=MU284$REG
     pik=inclusionprobabilities(MU284$P75,80)
     s=balancedstratification(X,strat,pik,TRUE)
     ############
     ## Example 3
     ############
     data(swissmunicipalities)
     swiss=swissmunicipalities
     X=cbind(swiss$HApoly,
             swiss$Surfacesbois,
             swiss$P00BMTOT,
             swiss$P00BWTOT,
             swiss$POPTOT,
             swiss$Pop020,
             swiss$Pop2040,
             swiss$Pop4065,
             swiss$Pop65P,
             swiss$H00PTOT )
     pik=inclusionprobabilities(swiss$POPTOT,400)
     sample=balancedstratification(X,swiss$REG,pik,comment=TRUE)
     #the sample is
     as.character(swiss$Nom[sample==1])

