svyCprod {survey} | R Documentation |
Computes the sum of products needed for the variance of survey sample estimators.
svyCprod(x, strata, psu, fpc, nPSU, lonely.psu=getOption("survey.lonely.psu"))
x |
A vector or matrix |
strata |
A vector of stratum indicators, or NULL |
psu |
A vector of cluster indicators or NULL |
fpc |
A data frame of population stratum sizes or NULL |
nPSU |
Table of original sample stratum sizes (or NULL ) |
lonely.psu |
One of "remove" , "adjust" ,
"fail" , "certainty" . See Details below |
The observations for each cluster are added, then centred within each stratum and the outer product is taken of the row vector resulting for each cluster. This is added within strata, multiplied by a degrees-of-freedom correction and by a finite population correction (if supplied) and added across strata.
If there are fewer clusters (PSUs) in a stratum than in the original
design extra rows of zeroes are added to x
to allow the correct
subpopulation variance to be computed.
The variance formula gives 0/0 if a stratum contains only one sampling
unit. The options to handle this are "fail"
to give an error,
"remove"
or "certainty"
to give a variance contribution of
0 for the stratum, and "adjust"
to center the stratum at the
grand mean rather than the stratum mean. The choice is controlled by
setting options(survey.lonely.psu)
. If this is not done the
factory default is "fail"
. Using "adjust"
is conservative,
and it would often be better to combine strata in some intelligent
way.
The "remove"
and "certainty"
options give the same result,
but "certainty"
is intended for situations where there is only
one PSU in the population stratum, which is sampled with certainty (also
called `self-representing' PSUs or strata). With "certainty"
no
warning is generated for strata with only one PSU. The factory default
is "fail"
.
A covariance matrix
Thomas Lumley