fbs | R Documentation |
This function implements the method proposed by Hasler and Tillé (2014). It should be used for selecting a sample from highly stratified population.
fbs(X, strata, pik, rand = TRUE, landing = TRUE)
X |
A matrix of size ( |
strata |
A vector of integers that specifies the stratification. |
pik |
A vector of inclusion probabilities. |
rand |
if TRUE, the data are randomly arranged. Default TRUE |
landing |
if TRUE, landing by linear programming otherwise supression of variables. Default TRUE |
Firstly a flight phase is performed on each strata. Secondly, several flight phases are applied by adding one by one the stratum. By doing this, some strata are managed on-the-fly. Finally, a landing phase is applied by suppression of the variables. If the number of element selected in each stratum is not equal to an integer, the function can be very time-consuming.
A vector with elements equal to 0 or 1. The value 1 indicates that the unit is selected while the value 0 is for rejected units.
Hasler, C. and Tillé Y. (2014). Fast balanced sampling for highly stratified population. Computational Statistics and Data Analysis, 74, 81-94
N <- 100
n <- 10
x1 <- rgamma(N,4,25)
x2 <- rgamma(N,4,25)
strata <- rep(1:n,each = N/n)
pik <- rep(n/N,N)
X <- as.matrix(cbind(matrix(c(x1,x2),ncol = 2)))
s <- fbs(X,strata,pik)
t(X/pik)%*%s
t(X/pik)%*%pik
Xcat <- disj(strata)
t(Xcat)%*%s
t(Xcat)%*%pik
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.