Learn R Programming

SpotSampling (version 0.1.0)

ReducedSamplecube: Cube method with reduction of the auxiliary variables matrix

Description

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.

Usage

ReducedSamplecube(X, pik, redux = TRUE, t)

Arguments

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 X is reduced during the cube method. Default value is TRUE.

t

the maximum number of constraints that can potentially be removed during the landing phase.

Value

the updated vector of pik that contains only 0s and 1s that indicates if a unit is selected or not at each wave.

Details

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.

References

Chauvet, G. and Tille, Y. (2006). A fast algorithm of balanced sampling. Computational Statistics, 21/1:53-62

See Also

samplecube, landingcube, ReducedMatrix.

Examples

Run this code
# NOT RUN {
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

# }

Run the code above in your browser using DataLab