BW2stageSRS: Relvariance components for 2-stage sample

View source: R/BW2stageSRS.R

BW2stageSRSR Documentation

Relvariance components for 2-stage sample


Compute components of relvariance for a sample design where primary sampling units (PSUs) and elements are selected via srs. The input is an entire sampling frame.


BW2stageSRS(X, psuID, lonely.SSU)



data vector; length is the number of elements in the population.


vector of PSU identification numbers. This vector must be as long as X. Each element in a given PSU should have the same value in psuID. PSUs must be in the same order as in X.


indicator for how singleton SSUs should be handled when computing the within PSU unit relvariance. Allowable values are "mean" and "zero".


BW2stageSRS computes the between and within population relvariance components appropriate for a two-stage sample in which PSUs are selected via srs (either with or without replacement). Elements within PSUs are assumed to be selected by srswor. The same number of elements is assumed to be selected within each sample PSU. The function requires that an entire frame of PSUs and elements be input.

If a PSU contains multiple SSUs, some of which have missing data, or contains only one SSU, a value is imputed. If lonely.SSU = "mean", the mean of the non-missing PSU contributions is imputed. If lonely.SSU = "zero", a 0 is imputed. The former would be appropriate if a PSU contains multiple SSUs but one or more of them has missing data in which case R will normally calculate an NA. The latter would be appropriate if the PSU contains only one SSU which would be selected with certainty in any sample.

(Use BW2stagePPSe if only a sample of PSUs and elements are available.)


List with values:


between PSU unit relvariance


within PSU unit relvariance

unit relvar

unit relvariance for population


B^2 + W^2


ratio of B^2 + W^2 to unit relvariance

delta full

intraclass correlation estimated as B^2/(B^2 + W^2)


Richard Valliant, Jill A. Dever, Frauke Kreuter


Cochran, W.G. (1977, chap. 11). Sampling Techniques. New York: John Wiley & Sons.

Valliant, R., Dever, J., Kreuter, F. (2018, sect. 9.2.1). Practical Tools for Designing and Weighting Survey Samples, 2nd edition. New York: Springer.

See Also

BW2stagePPS, BW2stagePPSe, BW3stagePPS, BW3stagePPSe


MDsub <- MDarea.pop[1:100000,]
    # psu's are defined by PSU variable
BW2stageSRS(abs(MDsub$Hispanic-2), psuID=MDsub$PSU, lonely.SSU="mean")
    # psu's are defined by SSU variable
BW2stageSRS(abs(MDsub$Hispanic-2), psuID=MDsub$SSU, lonely.SSU="mean")

PracTools documentation built on Nov. 9, 2023, 9:06 a.m.