1  From a question to a sample

Every few years, the Gambia Bureau of Statistics (GBoS) runs a Demographic and Health Survey (DHS). The survey interviews about 12,000 women in some 7,000 households and publishes hundreds of indicators, for the country and for each of its eight local government areas (LGAs). Before any interviewer leaves the office, a statistician has decided how many households to interview in each LGA, which areas to visit, and which households in those areas. This book is about those decisions.

It follows the decisions as national statistical offices (NSOs) take them. The starting point is the report of the last round, the tables at the back of it that say how the sample was drawn and how precise its estimates were. The end point is a list of households to interview, with the weight each one carries and a report that documents the design. Between the two, every choice is made in R, on a realistic frame, and tested in three ways before fieldwork.

This chapter lays out the decisions, the four surveys the book follows, the tables a planner reads first, the three tests, and the software. It ends with the whole design of a DHS for The Gambia on one page, the design that Parts II and III build one decision at a time.

1.1 Ten decisions

A sample design for a household survey comes down to ten decisions, taken roughly in the order of Figure 1.1.

Plan the sample1 Domains→2 Inputs→3 Targets→4 Design effect→5 Sample size→6 Allocation
Draw the sample7 Frame→8 PSUs→9 Households→10 Weights
Figure 1.1: The ten decisions of a sample design. Decisions 1 to 6 plan the sample, and decisions 7 to 10 draw it.
Decision The question it answers Chapter
1 Domains and strata For which parts of the population must the survey publish estimates, and how is the frame divided? 7
2 Inputs from the last round What levels, design effects, response rates and eligible persons did the last round find? 7
3 Precision targets How precise must each estimate be, and in which measure? 8
4 Design effect and take How many households per cluster, and how much precision does the clustering cost? 9
5 Sample size How many households does each domain need? 8
6 Allocation How is the total shared among domains and strata? 10
7 Frame preparation Which units does the first stage select, and with what measure of size? 11
8 PSU selection How are the clusters drawn? 11
9 Household selection How are households listed and drawn in each cluster? 12
10 Weights and documentation What weight does each household carry, and what does the report record? 13, 14

The order follows the dependencies. A sample size needs a target and a design effect, and an allocation needs a total. The decisions also loop back. A budget smaller than the sum of the requirements sends the planner back to the targets, and a frame with many small areas changes the take. Each chapter of Parts II and III opens with the diagram and marks the decisions it takes.

1.2 Four surveys

Most household surveys in low- and middle-income countries belong to four families. The book follows one survey of each, in the country where its latest round is documented in enough detail to plan the next one.

DHS MICS Labor force survey Integrated household survey
Country The Gambia Zimbabwe Rwanda Malawi
Round planned from 2019-20 2019 2024 IHS4 and IHS6
Main subject Health of women and children Children and women Employment Consumption and poverty
Domains 8 LGAs 10 provinces 30 districts 28 districts, 4 cities
Clusters and take 281 EAs of 25 households 462 EAs of 26 12 households per PSU and quarter 768 EAs of 16
Precision measure RSE RME at \(z = 2\) CV Margin of error
Feature of its own Men interviewed in half the households Large EAs cut into segments Rotating panel Fieldwork spread over twelve months

The Demographic and Health Surveys (DHS) and the Multiple Indicator Cluster Surveys (MICS) are run by NSOs with the support of an international program, ICF for the DHS and UNICEF for the MICS. Both are cross-sections repeated every three to six years, and both size their samples on indicators of women and children. Many labor force surveys (LFS) run continuously. Their design must then give quarterly figures, and it usually follows the same households for several quarters. An integrated household survey (IHS) measures consumption, which varies with the seasons, so its fieldwork usually covers a full year.

The four differ in their targets, their domains and their constraints. They share the ten decisions. The Gambia DHS is the running example of Parts II and III, and each chapter ends by showing how the other three take the same decision. Part VI gives each survey’s complete design.

1.3 Reading a sampling appendix

A DHS final report ends with two appendices that every planner reads first. Appendix A describes the sample design and Appendix B gives the sampling errors. The 2019-20 Gambia report (Gambia Bureau of Statistics and ICF 2021) is typical.

Appendix A opens with the frame, the 2013 census list of 4,098 enumeration areas (EAs) with their household counts, in Tables A.1 and A.2. It then describes the design in a few paragraphs. The sample has 14 strata, each LGA split into urban and rural parts. It selects 281 EAs with probability proportional to size and 25 households in each EA. Table A.3 gives the allocation of EAs to strata, Table A.4 the interviews the design expected, and Tables A.5 and A.6 what the fieldwork achieved (households selected and completed, eligible women and men found, and response rates).

Appendix B gives one table of sampling errors for the country, one for urban and rural areas, and one for each LGA. Each row is an indicator. The row for mCPR, the share of currently married women who use a modern contraceptive method, reads as follows in Table B.2.

R SE N WN DEFT SE/R R-2SE R+2SE
0.171 0.007 8,083 7,526 1.576 0.039 0.158 0.184

R is the estimate and SE its standard error. N is the number of married women interviewed, and WN the same number weighted. DEFT is the design factor, the ratio of the standard error to the one a simple random sample of 8,083 women would have given. At 1.576, the clustering and the unequal weights of the design made the standard error 58% larger. SE/R is the relative standard error (RSE), and the last two columns are a confidence interval. Chapter 4 defines these quantities, and Chapter 8 uses them to size a sample.

The two appendices are the planner’s inputs. The levels, DEFTs and response rates of round \(t\) are the best guesses available for round \(t + 1\). They are also the reference against which a new plan is checked. But reports leave gaps. The 2019-20 appendix describes its allocation as “a power allocation with a small adjustment” without giving the adjustment, and it does not say how EAs smaller than the take were handled. Part of the work is to fill such gaps with a stated assumption.

1.4 Three tests before fieldwork

A sample design is a prediction. It predicts that the selected households, once interviewed, will give estimates with the promised precision. The book tests each decision against that prediction in three ways, with names borrowed from fields that face the same problem.

The backtest asks whether the method reproduces what the survey program did. Finance backtests a strategy by running it on past data. Here the past is the last round. Fed with the 2019-20 sample, the sizing formula should return the RSEs of Appendix B, and the allocation method should come close to Table A.3. When it does, the reader can trust the method on the next round.

The virtual survey asks whether the plan delivers what it promises. It builds a synthetic Gambia, a population of households and people placed on the real frame and calibrated so that its sampling errors match those of the 2019-20 report. The design is then fielded on it a thousand times. Since the true values of the synthetic population are known, the virtual survey measures the realized precision of every estimate, and the accuracy of the standard errors the survey would report. Ecologists test monitoring designs on virtual species in the same way (Zurell et al. 2010), meteorologists test a planned network of weather stations on a simulated atmosphere, and statisticians who build Bayesian models fit them first to fake data (Gelman et al. 2020). Chapter 6 builds the synthetic Gambia and explains how to read a virtual survey.

The stress test asks what happens when an assumption of the plan fails: the frame is older than it looks, some areas cannot be reached, or nonresponse depends on the outcome. Part IV breaks each assumption on purpose in a virtual survey and measures the damage, as banks are stress-tested against adverse scenarios.

1.5 The software

Four R packages carry the work, one for each layer of the design.

  • decoupage builds area frames. It turns settlement points, building footprints and boundaries into enumeration areas with household counts, and it builds the synthetic populations of the virtual surveys.
  • svyplan plans the sample. It computes sample sizes from precision targets, design effects from variance components, and allocations across strata.
  • samplyr declares the design and selects the sample. A design is written as a sequence of stages built with stratify_by(), cluster_by() and draw(), and execute() applies it to a frame. The selection algorithms come from the sondage package.
  • survey estimates from the collected data (Lumley 2010). samplyr hands a selected sample to it with as_svydesign().

The frames, the tables transcribed from the reports and the synthetic populations come with the book. Every number in Parts II and III comes from a published report or a realistic frame.

Chapter 2 introduces the part of R the book uses, for a reader new to it, and Chapter 3 follows one short design through svyplan and samplyr. A reader who knows R can skip the first, and one who knows both packages the second.

1.6 The whole design on one page

The code below is the complete design of the next Gambia DHS. It sizes each LGA, allocates the EAs, prepares the frame, selects the sample and runs a virtual survey of it. Each block carries the number of its decision. The reader is not expected to follow every line yet. Parts II and III explain each block in turn, and Chapter 25 gives the design in full.

library(svyplan)
library(samplyr)
library(dplyr)
source("R/gambia.R")
source("R/virtual-survey.R")

gmb24_eas <- readRDS("data/gmb24_eas.rds")

## 1, 2 and 4. Inputs of the 2019-20 report, design effects from an urban
## and a rural intraclass correlation
inputs <- gmb_inputs()
icc <- gmb_icc()

## 7. EAs smaller than the take merged with a neighbor
clusters <- gmb24_eas |>
  arrange(lga, urban_rural, district, ward, ea_id) |>
  mutate(cluster = merge_psus(ea_id, min_size = 25, size = households),
         .by = c(lga, urban_rural)) |>
  summarise(district = first(district), ward = first(ward),
            households = sum(households), .by = c(lga, urban_rural, cluster))

## 3, 5 and 6. An RSE of 10% on mCPR in every LGA and 4% nationally, at
## the lowest cost, with 800 interviews with women in Banjul
floor_banjul <- with(filter(inputs, lga == "Banjul"),
                     25 * ceiling(800 / (25 * women_hh * resp)))
strata <- clusters |>
  summarise(N = sum(households), N_1 = n(), .by = c(lga, urban_rural)) |>
  mutate(stratum = paste(lga, urban_rural), take_2 = 25,
         cost_1 = 40, cost_2 = 1,
         min_n_stratum = if_else(lga == "Banjul", floor_banjul, 50)) |>
  left_join(select(inputs, lga, eligibility_rate = in_scope), by = "lga")
measures <- strata |>
  left_join(select(inputs, lga, p = mcpr, eligible_per_unit = married_hh,
                   resp_rate = resp_in_scope), by = "lga") |>
  mutate(stratum, name = "mcpr", p, eligible_per_unit, resp_rate,
         icc_1 = icc[urban_rural], var_ratio_1 = 1, .keep = "none")
targets <- bind_rows(
  tibble(name = "mcpr", domain = ".overall", level = NA, cv = 0.04),
  tibble(name = "mcpr", domain = "lga", level = inputs$lga, cv = 0.10)
)
allocation <- n_alloc_joint(as.data.frame(strata), measures = measures,
                            targets = targets,
                            min_n_stratum = strata$min_n_stratum)

## 8 and 9. Clusters by systematic PPS, then 25 households
design <- sampling_design("A DHS for The Gambia") |>
  add_stage("Clusters") |>
    stratify_by(lga, urban_rural) |>
    cluster_by(cluster) |>
    draw(n = select(allocation$detail, lga, urban_rural, n = n_1_int),
         method = "pps_systematic", mos = households,
         control = c(district, ward)) |>
  add_stage("Households") |>
    draw(n = 25, method = "systematic")
selected <- execute(design, clusters, stages = 1, seed = 2025)

## The virtual survey, 1,000 draws on the synthetic Gambia
virtual <- virtual_survey(design, readRDS("data/gmb_synthetic.rds"),
                      mutate(inputs, lga, household = completed,
                             person = women_rr, .keep = "none"),
                      reps = 1000, seed = 1)

The plan gives 307 EAs, against 281 in 2019-20. The virtual survey reports the true RSE of mCPR in each LGA, beside the EAs the LGA receives now and received in 2019-20.

virtual |>
  left_join(lga_eas, by = "lga") |>
  left_join(mutate(inputs, lga, eas_2019 = eas_urban + eas_rural,
                   .keep = "none"),
            by = "lga") |>
  select(lga, eas, eas_2019, true_rse) |>
  mutate(true_rse = round(true_rse, 3))
#> # A tibble: 9 × 4
#>   lga           eas eas_2019 true_rse
#>   <chr>       <dbl>    <int>    <dbl>
#> 1 Banjul         34       40    0.099
#> 2 Kanifing       36       46    0.097
#> 3 Brikama        56       50    0.068
#> 4 Mansakonko     38       27    0.106
#> 5 Kerewan        25       32    0.116
#> 6 Kuntaur        35       26    0.1  
#> 7 Janjanbureh    27       28    0.094
#> 8 Basse          56       32    0.103
#> 9 National       NA       NA    0.043

The plan moves EAs from Banjul, Kanifing and Kerewan, whose 2019-20 RSE was already near or below 10%, to Mansakonko, Kuntaur and Basse, which were far above it, and adds EAs in Brikama for the national estimate. The true RSE ranges from 6.8% to 11.6% across the LGAs, and is 4.3% nationally. Kerewan comes out above its target, because its DEFT on the synthetic Gambia is larger than the model predicts, as Chapter 10 finds. The map shows where the selected clusters fall.

selected |>
  as.data.frame() |>
  mutate(ea_id = cluster) |>
  map_eas(country = "gmb", outline = "districts", top = "lgas",
          polygons = "gmb24_ea_polygons", size = 0.9)

Map of The Gambia along the river, divided into eight LGAs and their districts. Points mark the selected clusters, densest around Banjul and Kanifing on the Atlantic coast and spread along the river elsewhere.

The clusters selected for the next Gambia DHS over the LGAs (thick lines) and districts (thin lines).

Parts II and III take this page apart. Chapter 7 reads the inputs, Chapter 8 sets the target and sizes each LGA, Chapter 9 models the design effect and examines the take of 25, and Chapter 10 finds the allocation that meets the LGA and the national targets together. Chapters 11 to 14 draw the sample, compute the weights and write the report.