Here is the setup:

We want to estimate the proportion of people in a country who wear black socks versus not-black socks. We have 100 cities (primary sampling units) in the country. In each city there are a certain number of blocks (secondary sampling unit) and in each block there are a certain number of houses (tertiary sampling units). We do not know the number of blocks, houses, or people before sampling begins. Once we select a house we do a census of all occupants to determine their sock colors. The sock color for each occupant will be reported as bs=1 for black socks and bs=0 for not-black socks.

The sampling commences by randomly selecting a number of cities, 10 for example. In each selected city we enumerate the number of blocks in that city. In each of the selected cities a number of blocks (say 5) are chosen at random. In each of the selected blocks the number of houses on that block is enumerated. Finally, a number of houses (say 5) on each chosen block is selected at random and the sock-color census performed in each of these houses. Given this information we can assign a sampling probability p to each house selected. The datafile will consist of a row for each person, listing the city.ID, block.ID, house.ID, p, and bs.

And here are the questions:

(1) Is this a valid sampling design, i.e., given the information provided can we get reasonable estimates of the proportion of people in the country who wear black socks and the standard error of the estimate?

(2) Is this how one might specify the design in R and Stata and calculate the result?

design <- svydesign(~city.ID+block.ID+house.ID,probs=~p,data=sampfile)

gen wt = 1/p
svyset city.ID [pweight=wt], vce(linearized) singleunit(missing) || block.ID || house.ID
svy: mean bs
  • $\begingroup$ This doesn't appear to even be a multistage design. You're selecting a single unit then repeating selections from the PSU stage, with no apparent relationship to the unit/s already selected. $\endgroup$
    – RoryT
    Commented Mar 30, 2018 at 10:06
  • $\begingroup$ @RoryT, it was not. See if the revised question is any better. $\endgroup$
    – Thomas
    Commented Mar 30, 2018 at 16:53

1 Answer 1


It is a perfectly valid design, but at each stage, you would need to specify the number of units in the population at that stage:

  1. number of cities you sample from,
  2. number of block in a city you sample from, specific for each city,
  3. number of housing units in a block, specific to that block.

That would be

design <- svydesign(id=~city.ID+block.ID+house.ID,

in R (see section 3.2 of Thomas Lumley's book (https://www.amazon.com/Complex-Surveys-Guide-Analysis-Using/dp/0470284307), or

svyset city_ID [pweight=wt], fpc(num_cities) || ///
        block_ID, fpc(num_blocks) || house_ID, fpc(num_houses)

in Stata (the dots in the variable names will freak it out, I replaced them with undescores)

Without the finite population corrections (FPC), either software will assume sampling with replacement, and ignore the subsequent stages.

  • $\begingroup$ Note that you need to protect against the missing data on people who always go barefoot. If people in four houses out five don't wear socks, this would appear like a singleton PSU. Just a fair warning. $\endgroup$
    – StasK
    Commented Mar 30, 2018 at 17:00
  • $\begingroup$ I was more concerned about the individuals wearing one black sock and one non-black sock (based on personal experience). $\endgroup$
    – Thomas
    Commented Mar 30, 2018 at 17:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.