spsurvey (version 4.1.4)

cdfvar.test: Variance-Covariance Matrix Estimate for Estimated Population Proportions

Description

This function calculates estimates of the variance-covariance matrix of the population proportions in a set of intervals (classes). The set of values defining upper bounds for the classes is supplied to the function. Either the simple random sampling (SRS) variance estimator or the local mean variance estimator is calculated, which is subject to user control. The simple random sampling variance estimator uses the independent random sample approximation to calculate joint inclusion probabilities. The function can accomodate single-stage and two-stage samples. Finite population and continuous population correction factors can be utilized in variance estimation.

Usage

cdfvar.test(z, wgt, x, y, bounds, phat, stratum.ind, stratum.level,
  cluster.ind, cluster, wgt1, x1, y1, popsize, pcfactor.ind, pcfsize,
  N.cluster, stage1size, support, swgt.ind, swgt, swgt1, vartype, warn.ind,
  warn.df, warn.vec)

Arguments

z

Vector of the response value for each site.

wgt

Vector of the final adjusted weight (inverse of the sample inclusion probability) for each site, which is either the weight for a single-stage sample or the stage two weight for a two-stage sample.

x

Vector of x-coordinate for location for each site, which is either the x- coordinate for a single-stage sample or the stage two x-coordinate for a two-stage sample.

y

Vector of y-coordinate for location for each site, which is either the y- coordinate for a single-stage sample or the stage two y-coordinate for a two-stage sample.

bounds

Vector of upper bounds for calculating classes for the CDF.

phat

The class proportions estimate.

stratum.ind

Logical value that indicates whether the sample is stratified, where TRUE = a stratified sample and FALSE = not a stratified sample.

stratum.level

Vector of = the stratum level.

cluster.ind

Logical value that indicates whether the sample is a two- stage sample, where TRUE = a two-stage sample and FALSE = not a two-stage sample.

cluster

Vector of the stage one sampling unit (primary sampling unit or cluster) code for each site.

wgt1

Vector of the final adjusted stage one weight for each site.

x1

Vector of the stage one x-coordinate for location for each site.

y1

Vector of the stage one y-coordinate for location for each site.

popsize

Known size of the resource, which is used to perform ratio adjustment to estimators expressed using measurement units for the resource. For a finite resource, this argument is either the total number of sampling units or the known sum of size-weights. For an extensive resource, this argument is the measure of the resource, i.e., either known total length for a linear resource or known total area for an areal resource. For a stratified sample this variable must be a vector containing a value for each stratum and must have the names attribute set to identify the stratum codes.

pcfactor.ind

Logical value that indicates whether the population correction factor is used during variance estimation, where TRUE = use the population correction factor and FALSE = do not use the factor. To employ the correction factor for a single-stage sample, values must be supplied for arguments pcfsize and support. To employ the correction factor for a two-stage sample, values must be supplied for arguments N.cluster, stage1size, and support.

pcfsize

Size of the resource, which is required for calculation of finite and continuous population correction factors for a single-stage sample. For a stratified sample this argument must be a vector containing a value for each stratum and must have the names attribute set to identify the stratum codes.

N.cluster

The number of stage one sampling units in the resource, which is required for calculation of finite and continuous population correction factors for a two-stage sample. For a stratified sample this variable must be a vector containing a value for each stratum and must have the names attribute set to identify the stratum codes.

stage1size

Size of the stage one sampling units of a two-stage sample, which is required for calculation of finite and continuous population correction factors for a two-stage sample and must have the names attribute set to identify the stage one sampling unit codes. For a stratified sample, the names attribute must be set to identify both stratum codes and stage one sampling unit codes using a convention where the two codes are separated by the & symbol, e.g., "Stratum 1&Cluster 1".

support

Vector of the support value for each site - the value one (1) for a site from a finite resource or the measure of the sampling unit associated with a site from a continuous resource, which is required for calculation of finite and continuous population correction factors.

swgt.ind

Logical value that indicates whether the sample includes size-weights, where TRUE = the sample includes size-weights and FALSE = the sample does not include size-weights.

swgt

Vector of the size-weight for each site, which is the stage two size-weight for a two-stage sample.

swgt1

Vector of the stage one size-weight for each site.

vartype

The choice of variance estimator, where "Local" = local mean estimator and "SRS" = SRS estimator.

warn.ind

Logical value that indicates whether warning messages were generated, where TRUE = warning messages were generated and FALSE = warning messages were not generated.

warn.df

dat A frame for storing warning messages.

warn.vec

Vector that contains names of the population type, the subpopulation, and an indicator.

Value

Object in list format composed of a vector named nbin, which contains the number of response values in each class, a vector named varest, which contains variance estimates, a numeric value named df, which contain degrees of freedom of the variance estimates, a logical variable named warn,ind, which is the indicator for warning messges, and a data frame named warn.df, which contains warning messages.

Other Functions Required

localmean.weight

calculate the weighting matrix for the local mean variance estimator

localmean.cov

calculate the variance/covariance matrix using the local mean estimator

localmean.var

calculate the local mean variance estimator