Learn R Programming

survey (version 1.0)

svyCprod: Computations for survey variances

Description

Computes the sum of products needed for the variance of survey sample estimators.

Usage

svyCprod(x, strata, psu, fpc, lonely.psu=getOption("survey.lonely.psu"))

Arguments

x
A vector or matrix
strata
A vector of stratum indicators, or NULL
psu
A vector of cluster indicators or NULL
fpc
A vector of population stratum sizes or NULL
lonely.psu
One of "remove", "adjust", "fail". See Details below

Value

  • A covariance matrix

Details

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.

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" 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" option is included because it might be needed for compatibility.

See Also

svydesign, svy.varcoef