varSYG computes the Sen-Yates-Grundy variance estimator.
varSYG(y =NULL, pikl, precalc =NULL)
Arguments
y: A (sparse) numerical matrix of the variable(s) whose variance of their total is to be estimated.
pikl: A numerical matrix of second-order inclusion probabilities.
precalc: A list of pre-calculated results (analogous to the one used by varDT).
Returns
if y is not NULL (calculation step) : a numerical vector of size the number of columns of y.
if y is NULL (pre-calculation step) : a list containing pre-calculated data (analogous to the one used by varDT).
Details
varSYG aims at being an efficient implementation of the Sen-Yates-Grundy variance estimator for sampling designs with fixed sample size. It should be especially useful when several variance estimations are to be conducted, as it relies on (sparse) matrix linear algebra.
Moreover, in order to be consistent with varDT, varSYG
has a precalc argument allowing for the re-use of intermediary results calculated once and for all in a pre-calculation step (see varDT for details).
Difference with varHT from package sampling
varSYG differs from sampling::varHT in several ways:
The formula implemented in varSYG is solely the Sen-Yates-Grundy estimator, which is the one calculated by varHT when method = 2.
varSYG introduces several optimizations:
matrixwise operations allow to estimate variance on several interest variables at once