if (FALSE) {
# Example 1
# Select sample
set.seed(12345);
N = 100; # population size
n = 10; # sample size
p = rep(n/N,N); # inclusion probabilities
X = cbind(runif(N),runif(N)); # matrix of auxiliary variables
pflight = lcubeflightphase(p,X,cbind(p,X));
# check balance
colSums(X)
colSums(X/p*pflight)
}
Run the code above in your browser using DataLab