varSYG  R Documentation 
varSYG
computes the SenYatesGrundy
variance estimator.
varSYG(y = NULL, pikl, precalc = NULL)
y 
A (sparse) numerical matrix of the variable(s) whose variance of their total is to be estimated. 
pikl 
A numerical matrix of secondorder inclusion probabilities. 
precalc 
A list of precalculated results (analogous to the one used by

varSYG
aims at being an efficient implementation of the
SenYatesGrundy 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 reuse of intermediary
results calculated once and for all in a precalculation step (see
varDT
for details).
if y
is not NULL
(calculation step) : a
numerical vector of size the number of columns of y.
if y
is
NULL
(precalculation step) : a list containing precalculated data
(analogous to the one used by varDT
).
varHT
from package sampling
varSYG
differs from sampling::varHT
in several ways:
The formula implemented in varSYG
is solely
the SenYatesGrundy 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
Matrix::TsparseMatrix capability yields significant performance gains.
Martin Chevalier
library(sampling) set.seed(1) # Simple random sampling case N < 1000 n < 100 y < rnorm(N)[as.logical(srswor(n, N))] pikl < matrix(rep((n*(n1))/(N*(N1)), n*n), nrow = n) diag(pikl) < rep(n/N, n) varSYG(y, pikl) sampling::varHT(y = y, pikl = pikl, method = 2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.