------------------------------------------------------------------------------- help forsurvwgt-------------------------------------------------------------------------------

Survey sampling weights: adjustment and replicate weight creation

survwgtcreateweight_type,strata(varname)psu(varname)weight(varname)stem(stem)[fay(#)dof(#)hadmat(matname)hadfile(matrix_file_name)nodots]

weight_typeis one of

brr- balanced repeated replication weightsjk1- unstratified delete-one jackknife weightsjk2- two per stratum delete-one jackknife weightsjkn- delete-n jackknife weights

survwgtpoststratifyvarspec,by(varlist)totvar(varname){generate(varlist)|stem(stem)|prefix(prefix)|replace}

survwgtrakevarspec,by(varlist)totvars(varlist){generate(varlist)|stem(stem)|prefix(prefix)|replace}

survwgtnonresponsevarspec,by(varlist)respvar(varname){generate(varlist)|stem(stem)|prefix(prefix)|replace}

varspecis one of

varlist- a Stata variable list[pw]- indicates the full sample weight[rw]- indicates the set of replicate weights[all]- indicates both[pw]and[rw]

Description

survwgtcreates sets of weights for replication-based variance estimation techniques for survey data. These include balanced repeated replication (BRR) and several version of the survey jackknife (JK*). These replication methods are alternates to the Taylor series linearization methods used by Stata's svy-based commands.In addition,

survwgtperforms poststratification, raking, and non-response adjustments to survey weights.

survwgt createcreates a set of replicate weights for a dataset.survwgtcan create four types of replicate weights, depending on the nature of the complex sample design and user preferences. In each method, multiple weight variables are created. Each set of replicate weights is calcuated by setting the sampling weights for observations in one or more PSUs to zero, and adjusting the sampling weights for the remaining observations to reproduce the full-sample totals. The svr set of commands use these weights to calculate (co)variances estimates of parameters by repeatedly estimating statistics of interest with each set of replicate weights. See Wolter (1985) for details.

brr(balanced repeated replication) is appropriate for designs with exactly two PSUs per stratum. Technically, (CHECK) PSUs must have been selected without replacement; any subsequent subsampling within PSUs is acceptable. In BRR,nweights are created, in whichnis the smallest multiple of four greater than or equal to the number of strata. In each set of weights, one PSU from each stratum is included and the other excluded, in a pattern defined by a Hadamard matrix. Specifications for Hadamard matrices up to dimension 512 are included withsurvwgt, which allows for designs with up to 512 strata. Larger Hadamard matrices may be provided by the user, up to the limits of matsize.

jk1(unstratified delete-one jackknife) is appropriate for non-stratified, clustered sampling designs. In JK1, one PSU is deleted from each set of replicate weights, so the number of replicate weights equals the number of PSUs.

jk2(two per stratum delete-one jackknife) is appropriate for the same designs as the balanced repeated replication method: two PSUs per stratum, selected with replacement, with any subsampling scheme within PSU. In thejk2method, one PSU is deleted from each replicate (as opposed to one PSUper stratumin thebrrmethod).

jkn(delete-n jackknife) is appropriate for sampling designs with two or more PSUs per stratum. [Insert description here!]

survwgt poststratifycomputes post-stratification adjustments to survey sampling weights. The sampling weights in each stratum are adjusted by a multiplicative factor such that the sum of the weights equals the control total for each stratum, as specified in thetotvar()option. When more than one sampling weight variable is specified, the command post-stratifies each in turn. This allows for the adjustment of the main sampling weight and a full set of replicate weights in one easy step.

survwgt rakecomputes raking adjustments to survey sampling weights. Raking is used when there are multiple stratification dimension, when control totals known for the marginal distribution of each dimension but not for the individual cell totals. (When population cell totals are known, post-stratification should be used.) In raking, the sampling weights for each stratum are iteratively adjusted by a multiplicative factor such that the sum of the weights equals the control total for marginal dimension, in turn, until convergence is achieved. As with post-stratification, multiple sets of analysis and replicate weights can be raked with one call tosurvwgt.

survwgt nonresponsecomputes non-response adjustments to survey sampling weights. Nonresponse adjustment requires a dataset that includes the full sample-- responders and non-responders. Separately within each response stratum, the base survey sampling weight for each responder in the sample is adjusted such that the total weight for responders alone equals the total weight for the sample. The weight for non-responders is set to zero. As with the other weight adjustment routines, multiple variables can be subjected to non-response adjustment in one easy call tosurvwgt.

Options forsurvwgt create

strata(varname)specifies the variable that identifies stratum membership. This must be a single variable; if the strata are defined by multiple variables, a single variable can be created with egen's group() option. Thestrata()option is required for all weight types except JK1, for which it is not allowed.

psu(varname)specifies the variable that identifies the primary sampling units within strata. It is required for all types of replicate weight creation.

weight(varname)specifies the base sampling weights. It is required.

stem)stem)specifies a stem to be used as the basis for the replicate weight variable names. The repliciate weight variables are named stem1, stem2, ... stemn. Ifstem()is not specified, a stem based on the type of weights is used (brr_, jk1_, jk2_, or jkn_)

fay(#)specifies the value of the constant to be used in generating weights according to Fay's variant of balanced repeated replication. In this method, observations in the selected PSUs are assigned weight of (2-fay), and those in the non-selected PSUs are assigned a weight of (fay), rather than 2 and 0, respectively. By default, the Fay constant is 0, which implies "regular" BRR. This option is valid only for the brr method.

dof(#)specifies the appropriate degrees of freedom for variance estimates. By default, degrees of freedom is set to the number of strata for the BRR and JK2 methods, to one less than the the number of PSUs for JK1, and to the total number of PSUs minus the total number of strata, for the JKn method.

hadmat(matname)specifies a Stata system matrix that contains the Hadamard matrix to create the replicates. The program comes with a binary file with Hadamard matrices up to dimension 512, so this option should be little-used. No checking is done that the matrix is in fact a Hadamard matrix -- be careful!

hadfile(matrix_file_name)specifies the system file that contains Hadamard matrices. This should only be necessary when the system file is located off the Stata search path, or named something other than the default.

nodotsspecifies that a dot should not be displayed for each set of weights that is created. With large datasets, the dots can reassure you that the program has not died.

Options forsurvwgt poststratify,rake, andnonresponse

varspecspecifies the base weight(s) to adjusted (i.e., post-stratified, raked, or adjusted for non-response). This can be specified as a Stata varlist. More usefully, this can be specified as[pw], which indicates the currently specified main analysis weight, and/or[rw]which indicates the set of replicate weights.[all]is a synonym for[pw] [rw]. If this automated variable specification is used, then the svr settings for the dataset are updated to specify the new weights, unless thenoupdateoption is specified. See svrset.

noupdatespecifies that the svr settings for the dataset should not be updated to reflect the adjusted weights. This only has an effect when the variables to be adjusted are specified with the "automatic" syntax discussed above.

by(varlist)specifies variable(s) identifying the strata. For post-stratification, the base weights are adjusted to sum to the control totals for thecellsdefined by the strata; for raking, the base weights are adjusted to sum to the control totals for themarginalsof the strata. For non-response adjustment, the base weights for respondents are adjusted to sum to the total of the full sample weights for the cells defined by the strata.

totvar[s](varname[s])specifies the variable[s] containing control totals for post-stratification or raking. For post-stratification,totvar()must be a single variable, constant within the cells defined by theby(varlist), of control totals. For raking,totvars()must contain variables (one per variable specifiedby()), which specify the marginal control total for each value of the corresponding stratum variable. This option is not valid for non-response adjustment.

respvar(varname)specifies the variable that contains response information for members of the sample. This variable must take on values of 0 (indicating non-response), 1 (indicating response), or missing (out of sample). The base weights are adjusted such that, within each response stratum, the adjusted weight for respondents sums to the total of the base weight for all sample members. Non-respondent cases are assigned an adjusted weight of zero, and out of sample cases are excluded from the calculations and assigned missing for the adjusted weight.If there are no respondents in a stratum, all weights for that stratum are set to zero and a warning is displayed. If there are no sample members in a stratum, all weights are set to missing and a warning is displayed. This option is only valid for non-response adjustment.

generate(varlist)specifies the explicitly the names for the adjusted weight variable(s) to be created. There must be one name per base sampling weight specified invarlist.

stemstem)specifies a stem to be used to create names for the adjusted weight variable(s). New variables are numbered from 1, unless the "pw" or "all" are indicated for thevarspec, in which case they are numbered from 0.

prefixprefix)specifies a prefix to be prepended to the existing variable names used to create the adjusted weight variable(s).

replacespecifies that the adjusted variables should replace the existing variables. This option should be used with caution.

Examples

Methods and formulae for weight calculation

survwgt createonly works for survey designs that exactly match the specificatons for the type of weights requested (two PSUs per stratum for BRR, etc.) Any collapsing of strata or PSUs, splitting of certainty PSUs, or other adjustments to approximate the appropriate design must be done outside of the program.The program creates k sets of replicate weights, where k is defined as discussed above for the replication method.

For the

BRRmethod, the the program selects one of the PSUs from each stratum, according to a Hadamard matrix of the relevant dimension. For replicatej, the weights for each observationiare calculated as follows:

W = W * (2-k) for observations in the PSU

ijiF selected into the replicate

= W * (k) for observations in the other PSU

iFwhere

W is the full-sample weight for observation

i, andiFk is the constant for Fay's method. For standard BRR, k=0.

The program comes with an auxiliary binary file, survwgt_hadamardmatrixfile.ado, which contains Hadamard matrices up to dimension 512. These matrices are stored in a compressed binary format to save disk space; the available matrix sizes can be obtained by typing

survwgt createbrr sizes. (Note: the binary file is named with an "ado" file extension in order that it be installed in the correct directory by Stata's net install and ssc install commands. The file is not, in fact, a Stata program, and will issue an appropriate error message if it is attempted to be run.)For the

JK1method, the program creates one replicate per PSU. In replicatej, the weights for each observationiare calculated as follows:

W = 0 for observations in PSU

ijj

= W * ( N/(N-1) ) for observations in other PSUs

iFwhere N is the number of PSUs, and W is defined as above.

For the

JK2method, the program creates one replicate per stratum. In each replicate, the weights in the selected stratum are doubled in the first PSU, and set to zero in the second PSU. Weights in other strata are not changed.For the

JKnmethod, the program creates one replicate for PSU. In each replicate, the weights for each observationiare calculated as follows:W = 0 for observations in PSU (from stratum

k)ijj

= W * (N /(N -1)) for observations from other PSUs

iFkkin stratumk

= W for observations in other strata

iFwhere

N is the number of PSUs in stratum

kk

Methods and formulae for variance estimationThe

svrset of commands make use of the replication weights produced bysurvwgtcreateto estimate (co)variances for parameters and other estimated quantities. See svr for a list of these commands. In general, the parameter estimates are calculated by standard statistical commands using aweights, which yields the same point estimates as Stata's linearization-based svy commands for survey data. The (co)variances are calculated by repeatedly re-estimating the same parameters with each of the set of replicate weights. From these replicated estimates, the (co)variances are calcuated as follows:

R V(b) = F * Sum( f *(b -b)(b -b)' ) r=1

rrrwhere

R is the number of replicates,

b is the vector of full sample point estimate(s),

b is the vector of estimates derived from replicate

r,rF is a constant factor depending on the replication method, and

f is a replicate-specific factor.

r

The values for F and f are:

methodFfBRR 1/R 1

Fay's variant 1/(R*(1-k)^2) 1 of BRR

JK1 (R-1)/R 1

JK2 1 1

JKn 1 (N -1)/N

kk

Saved ResultsThe command saves no results, but it does set data characteristics to identify the full sample and replicate weight variables, degrees of freedom, fay constant for BRR method, and replication method (BRR, JK1, JK2, or JKn). The svrset command can be used to set, clear, or display these characteristics.

ReferencesJudkins, D. 1990. Fay's Method for Variance Estimation. Journal of Official Statistics 16:25-45.

Wolter, K. M. 1985. Introduction to Variance Estimation. New York: Springer-Verlag.

AcknowledgementsI would like to thank Bobby Gutierrez at StataCorp for advice on implementation of BRR, and the technical group at StataCorp for feedback on an early version of the BRR programs. The code for raking is partly based upon Nick Cox's program mstdize.

AuthorNick Winter Cornell University nw53@cornell.edu