cubestratified {BalancedSampling} | R Documentation |
This is a fast implementation of stratified balanced sampling. To have a fixed sample size, include the inclusion probabilities as a balancing variable in Xbal
and make sure the inclusion probabilities sum to a positive integer (within each stratum).
cubestratified(prob,Xbal,integerStrata)
prob |
vector of length N with inclusion probabilities |
Xbal |
matrix of balancing auxiliary variables of N rows and r columns |
integerStrata |
vector of length N with stratum number |
Returns a vector of length N with sampling indicators.
Chauvet, G. (2009). Stratified balanced sampling. Survey Methodology, 35, 115-119.
## Not run:
# Example 1
N = 10;
n = 5;
p = rep(n/N,N);
strata = c(1,1,2,2,3,3,4,4,5,5);
indicators = cubestratified(p,cbind(p),strata);
s = (1:N)[indicators==1];
## End(Not run)