*! version 1.0 20dec2014

Title

rsz -- Draw a stratified simple random sample, a systematic sample, or a randomly split zones sample,
with probabilities proportional to size.

Syntax

rsz [if] [in], strsamsize(variable) replicates(number) ranseed(number) [alt(srs/sys/rsz) strata(varlist) sorting(varlist) consorting(varlist) serp(Y/N)
mos(variable) exprr(number) inflatedsamsize(Y/N) desiredinitial(number) extra(number) restore(Y/N)]

Required parameters

strsamsize(variable) takes a numeric variable indicating the sample size in each stratum, or a uniform number if there is no stratification.

replicates(number) takes a number indicating how many rounds of releases will be made in data collection under randomly split zones (rsz) design. Specify 1 if not under rsz design. If a number
greater than 1 is specified under simple random sampling (srs) or systematic sampling (sys), the sample size will be inflated in each stratum according to the specified number
and you will need to split the sample for your sequential releases. See technical notes at the end of the file for more information.

ranseed(number) takes a number between 0 and 2,147,483,647 as the random seed to draw the sample.

Options

alt(srs/sys/rsz) takes srs, sys, or rsz that indicates the sampling procedure. By default rsz is assumed.

strata(varlist) takes stratification variables. By default no stratification (one stratum) is assumed.

sorting(varlist) takes sorting variables in order. By default random ordering is assumed.

consorting(varlist) takes continuous sorting variables that are usually specified at the end of sorting variables to fix the position of each case in the list. By default
no further sorting is assumed.

serp(Y/N) takes Y or N to indicate that whether a hierarchical serpentine sorting is desired. The hierarchic serpentine sorting is an improvement over the simple sorting
which uniformly sorts a subsequent variable in one specified order (either ascending or descending); in contrast, the hierarchic serpentine sorting alternates the sorting order
of a subsequent variable when a boundary of the preceding variable is crossed so that the units
at the boundary are similar. By default hierarchical serpentine sorting is assumed.

mos(variable) takes a numeric variable indicating the measure of size (MOS) for calculating each case's selection probability, which is the case's MOS divided by
the total MOS in the sampling group to which the case belongs. By default, equal selection probabilities are assumed.

exprr(number) takes a percent from 0 to 1 which indicates the expected overall response rate. By default, a response rate of 1 is assumed. See technical notes
at the end of the file for more information.

inflatedsamsize(Y/N) takes Y or N to indicate that whether the sample size variable strsamsize contain the inflated sample size which takes the number of replicates
and expected response rate into account. This option is for the rsz sampling method only. By default, non-inflated sample size is assumed.
See technical notes at the end of the file for more information.

desiredinitial(number) takes a number which forces the total initial sample size to the desired sample size as specified rather than leaves it to whatever the rounded result
would be. This option is for the rsz sampling method only. By default, no desired total initial sample size is assumed.
See technical notes at the end of the file for more information.

extra(number) takes a number which indicates that how many more replicate samples should be drawn in addition to the number as specified in the option replicates, just in case
your assumption are not accurate. By default, no extra is assumed. See technical notes at the end of the file for more information.

restore(Y/N) takes Y or N to indicate that whether the input list order should be restored. By default, restore is assumed.

Description of the Program

This program was written primarily for drawing a sample by the randomly split zones (rsz) for samples of size one sampling method as proposed in Singh and Ye (2016). It also provides
the option to draw a sample by simple random (srs) sampling method or the systematic (sys) sampling method. Under the rsz sampling method, explicit strata will be further
stratified into deep strata (or zones) by an additional stratifying variable. Also, the program will split zones into random groups from each of
which one and only case will be seleted into the initial sample, although multiple cases from a random group can be selected as replicates if specified. By default hierarchical
serpentine sorting is assumed under sys or rsz sampling. If the measure of size (MOS) is provided, it draws the sample with probabilities proportional to size (PPS).

Examples

Draw a stratified srs, sys, and rsz sample from the auto data set (Note: You can click on each line below to run it in STATA.)

webuse auto,clear

gen samplesize=4 if foreign==1

replace samplesize=8 if foreign==0

rsz,strsamsize(samplesize) ranseed(5110652) replicates(1) alt(srs) strata(foreign)

rsz,strsamsize(samplesize) ranseed(5110652) replicates(1) alt(sys) strata(foreign) sorting(rep78 headroom make)

rsz,strsamsize(samplesize) ranseed(5110652) replicates(1) strata(foreign) sorting(rep78 headroom make)

Draw another rsz sample with two replicates.

rsz,strsamsize(samplesize) ranseed(5110652) replicates(2) strata(foreign) sorting(rep78 headroom make) exprr(0.5)

Technical Notes

The program will create deep strata _rszzone based on the sorted list. The number of deep strata (or zones) will be about half of the desired number of completes. Each deep stratum (or zone)
will be randomly split into groups.

Due to nonresponse, a certain stratum may not have at least two responding units for variance estimation purpose. Although it is not ideal, the common practice is to combine the neighboring strata at the estimation stage to ensure that
every stratum has at least responding units. When sampling with an assumed response rate of 1 under the rsz sampling method, generally the rsz sample only include two cases in each deep stratum _rszzone for release. This may
lead to an undesired consequence of combining many strata at the estimation stage if the response rate is low. There are two ways to reduce or avoid this problem:

1. Specify an expected response rate in the option exprr. For example, if you specify an expected response rate of 0.5, the rsz sample will include
four cases in each deep stratum _rszzone for release.

2. Specify the number of replicates that will be released in sequence for any random group _rszgroup without a respondent after exhausting a predetermined contact procedure. In practice the data collection window
may not allow many sequential releases due to time constraints. A combination of an expected response rate and the number of replicates can be specified to make sure you only specify the number of replicates the data collection window
allows while reducing the problem of combining many strata at the estimation stage. The program will calculate the number of random groups in each zone using this formula:

zonesize=2*(1-(1-exprr)^replicates)

where exprr is the expected response rate and replicates is the number of replicates the data collection window allows, zonesize is calculated from the formula as the sample size to be released in each of
your explicate strata. Due to rounding for integer sample sizes, the total calculated sample size may not be exactly as you desire, you can force it to be your desired total
by specifying the option desiredinitial. For example, if you would like to force the total calculated sample size to be 100, specify the option desiredinitial(100). Also, if you have done the calculation yourself
and the sample size in strsamsize already contains the calculated sample size to be released in each stratum, you can specify the option inflatedsamsize(Y) to inform the program. A final note: If you would like to
sample extra replicates in addition to what you already requested in the option replicates just in case your assumptions about expected response rate and number of sequential releases allowed are not accurate, you can
specify extra replicates in the option extra.

References

Singh, A.C. and Ye, C. (2016). Randomly Split Zones for Samples of Size One as Reserve Replicates and Random Replacements
for Nonrespondents, Proceedings of the American Statistical Association, Survey Research Methods Section.

Disclaimer

This software is provided 'as-is', without any express or implied warranty. In no event will the author be held liable
for any damages arising from the use of this software.

Suggested Citation

Ye, C. (2017). Stata module rsz: Draw a stratified simple random sample, a systematic sample, or a randomly split zones sample,
with probabilities proportional to size. Version 1.0.

Author

Cong Ye, Ph.D.

Center for Survey and Data Sciences

American Institutes for Research

cye@air.org