Description Usage Arguments Details Value Author(s) References See Also Examples
View source: R/ReducedSamplecube.R
Modified cube method.
This function reduces considerably the execution time when the matrix of auxiliary variables X
contains lot of 0s.
It is based on the function samplecube
from the package sampling
.
1 | ReducedSamplecube(X, pik, redux = TRUE, t)
|
X |
a matrix of size (N x p) of auxiliary variables on which the sample must be balanced. |
pik |
a vector of size N of inclusion probabilities. |
redux |
a boolean value that specify if matrix |
t |
the maximum number of constraints that can potentially be removed during the landing phase. |
In case where the number of auxiliary variables is great (i.e. p very large), even if we use the fast implementation proposed by
(Chauvet and Tille 2005), the problem is time consuming.
This function reduces considerably the execution time when the matrix of auxiliary variables X
contains lot of 0s.
It considers a reduced matrix X
by removing columns and rows that sum to 0 (see ReducedMatrix
).
Moreover, the landing by variable suppression is used.
t
specifies the maximum number of constraints that can potentially be removed during the landing phase. This means that the first (N-T) constraints in X
can be exactly satisfied.
the updated vector of pik
that contains only 0s and 1s that indicates if a unit is selected or not at each wave.
Esther Eustache esther.eustache@unine.ch, Raphael Jauslin raphael.jauslin@unine.ch
Chauvet, G. and Tille, Y. (2006). A fast algorithm of balanced sampling. Computational Statistics, 21/1:53-62
samplecube
, landingcube
, ReducedMatrix
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | set.seed(1)
## Matrix of 8 auxilary variables and 10 units with lot of 0s ##
X <- matrix(c(0.6,0.0,0.0,0.0,
0.1,0.0,0.1,0.0,
0.3,0.0,0.0,0.3,
0.0,0.3,0.0,0.3,
0.0,0.6,0.0,0.0,
0.0,0.1,0.1,0.0), ncol = 4, byrow = TRUE)
## Inclusion probabilities with 10 units ##
pik <- c(0.60,0.10,0.30,0.30,0.60,0.10)
## parameter t ##
t <- 2
## Cube method ##
s <- ReducedSamplecube(X, pik, redux = TRUE, t)
s
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.