clusters <- gmb_clusters()
dhs_design <- gmb_design()
selected <- execute(dhs_design, clusters, stages = 1, seed = 2025)
set.seed(2026)
listing <- selected |>
as.data.frame() |>
mutate(listed = pmax(1L, as.integer(round(
households * exp(rnorm(n(), log(1.05), 0.2))
)))) |>
reframe(hh_id = seq_len(listed), .by = c(lga, urban_rural, cluster))
head(listing, 3)
#> lga urban_rural cluster hh_id
#> 1 Banjul Urban 1021003 1
#> 2 Banjul Urban 1021003 2
#> 3 Banjul Urban 1021003 3
listing |>
count(cluster, name = "listed") |>
summarise(clusters = n(), households = sum(listed),
fewer_than_25 = sum(listed < 25))
#> clusters households fewer_than_25
#> 1 307 20887 112 Listing and selecting households
Chapter 11 selected 307 clusters. The frame gives the number of households in each, but not the households themselves. Before the second stage, a listing team visits every selected cluster, walks its boundary and writes down every dwelling and household. The second stage selects 25 households from that list. This chapter takes the ninth decision of Figure 1.1. It lists, selects, and then draws the subsamples a DHS takes within the selected households.
12.1 Listing
The listing is a small census of the selected cluster, done a few weeks before the interviews. It differs from the frame in two ways. It is current, so it finds the households that arrived since the census and misses those that left. It is also a list of identified dwellings, so an interviewer can find each selected household.
Here a synthetic listing stands in for the fieldwork. In each selected cluster, the listing finds the frame count times a random factor around 1.05, for growth since 2024, with a spread of about 20%. The listing has one row per household, with its cluster and an identifier, as the first rows show.
The table gives the clusters listed, the households they hold, and how many listed fewer than the take. execute() continues the design from the selected clusters, with the listing as the frame of the second stage. A cluster that listed fewer than 25 households is taken whole, and execution warns that its pool was capped. Here that happens in 1 cluster.
issued <- execute(selected, listing, seed = 2027)
#> Warning: Stage 2: sample size exceeded the pool population in 1 of 307
#> pools.
#> ✖ Requested 7675 units, selected 7671.
#> ℹ Capped pools: "6012006".
#> ℹ Inspect with `frame_summary(sample, detail = "pool")` and the
#> capped column.
nrow(issued)
#> [1] 767112.2 What the listing does to the weights
When cluster \(i\) of stratum \(h\) was selected with probability \(n_h M_{hi} / M_h\) and lists \(L_{hi}\) households, of which \(m\) are taken, the household’s weight is \[ w_{hij} = \frac{M_h}{n_h M_{hi}} \times \frac{L_{hi}}{m} = \frac{M_h}{n_h \, m} \times \frac{L_{hi}}{M_{hi}} . \]
The first factor is the same for every household of the stratum, as in the self-weighting design of Chapter 11. The second, the ratio of listed to frame households, varies from cluster to cluster. It does not bias anything, since each factor is the inverse of the probability of the selection actually made. It spreads the weights, and spread weights lose precision.
issued |>
as.data.frame() |>
summarise(weight_cv = sd(.weight) / mean(.weight), .by = c(lga, urban_rural)) |>
summarise(lowest = min(weight_cv), median = median(weight_cv),
highest = max(weight_cv)) |>
round(3)
#> lowest median highest
#> 1 0.093 0.167 0.239
strata <- clusters |>
summarise(N = sum(households), .by = c(lga, urban_rural)) |>
left_join(gmb_allocation(), by = c("lga", "urban_rural"))
c(planned = as.numeric(design_effect(strata = data.frame(N = strata$N,
n = strata$n))),
issued = as.numeric(design_effect(issued)))
#> planned issued
#> 1.818609 1.920108Within a stratum, the weights have a coefficient of variation of about 17%, and the national weighting loss rises from the planned 1.82 to 1.92. A 20% spread in the listing is moderate for a frame two years old. An older frame spreads the weights more, and Chapter 15 measures how much with a stress test.
12.3 Large clusters and segments
A listing team can list a cluster of 150 households in a day or two. A cluster of 600 is another matter. When a selected cluster is too large to list, it is cut into segments of about the same size along roads and streams, the dwellings of each segment are counted roughly, and one segment is selected with probability proportional to its count. Only that segment is listed. In samplyr this is one more stage between the clusters and the households, with a register of segments as its frame, and its probability enters the weight like any other.
The Gambia needs no segments. The largest cluster of the frame holds 156 households. The 2013 round cut EAs above 200 households into segments, and the Zimbabwe MICS of Chapter 26 segments every selected cluster above 300.
12.4 When the number of stages differs
Segmenting gives a design whose depth varies. A cluster too large to list has three stages (cluster, segment and household), and a small one has two. The same happens when a city selects households from a register and the rest of the country goes through clusters. A design has one list of stages, so there are two ways to write such a survey.
12.4.1 A stage that passes through
Every cluster gets a segment. A cluster that is not cut has one segment, which is the whole cluster. The middle stage then draws one segment per cluster with probability proportional to its count, so the only segment of an uncut cluster has a probability of one and multiplies the weight by 1. Suppose a team can list about 100 households. The register of segments holds one row for each uncut cluster and several for the others.
segments <- clusters |>
mutate(cuts = pmax(1L, as.integer(ceiling(households / 100)))) |>
reframe(
segment = seq_len(cuts),
segment_hh = as.integer(diff(round(seq(0, households, length.out = cuts + 1L)))),
.by = c(lga, urban_rural, cluster)
)
segmented_design <- sampling_design("Segmented clusters") |>
add_stage("Clusters") |>
stratify_by(lga, urban_rural) |>
cluster_by(cluster) |>
draw(n = gmb_allocation(), method = "pps_systematic", mos = households,
control = c(district, ward)) |>
add_stage("Segments") |>
cluster_by(segment) |>
draw(n = 1, method = "pps_brewer", mos = segment_hh) |>
add_stage("Households") |>
draw(n = 25, method = "systematic")
segment_sample <- execute(segmented_design, clusters, segments,
stages = 1:2, seed = 2029)
segment_sample |>
as.data.frame() |>
summarise(selected = n(), weight_2 = round(mean(.weight_2), 2),
.by = .certainty_2)
#> .certainty_2 selected weight_2
#> 1 TRUE 297 1
#> 2 FALSE 10 2Of the 307 selected clusters, 297 pass through with a second-stage weight of 1. The others carry the inverse of their segment’s probability, and the listing of the selected segments continues the design as in the sections above.
This route keeps one design and one tbl_sample. Its one cost is in the export. A cut cluster selects one segment, and one unit gives no variance estimate at its stage, so as_svydesign() warns and survey stops when a standard error is requested. Exporting ultimate clusters with as_svydesign(sample, stages = 1), as Chapter 13 does for the DHS, keeps the first-stage clusters and needs no second-stage term.
12.4.2 Separate designs
When the parts differ by more than a stage, each part has its own design and its own frame. Here Banjul selects households from a register and the other LGAs keep the DHS design.
banjul_frame <- clusters |>
filter(lga == "Banjul") |>
reframe(hh_id = seq_len(households), .by = c(lga, urban_rural, cluster))
banjul_sample <- sampling_design("Banjul households") |>
draw(n = 300) |>
execute(banjul_frame, seed = 2031)
other_clusters <- filter(clusters, lga != "Banjul")
other_households <- other_clusters |>
reframe(hh_id = seq_len(households), .by = c(lga, urban_rural, cluster))
other_sample <- gmb_design(filter(gmb_allocation(), lga != "Banjul")) |>
execute(other_clusters, other_households, seed = 2032)The two samples are not one tbl_sample, and binding their rows does not make them one. The result no longer matches the design it carries, and the export refuses it.
as_svydesign(bind_rows(banjul_sample, other_sample))
#> Error in `as_svydesign()`:
#> ! `as_svydesign()` requires a sample that still matches
#> its executed design.
#> ✖ Rows were removed, added, or duplicated after `execute()`.
#> ℹ For domain (subpopulation) analysis, convert the full sample
#> first, then subset the design:
#> `subset(as_svydesign(full_sample), condition)`, or with srvyr:
#> `as_survey_design(full_sample) |> filter(condition)`.
#> ℹ To subsample an executed sample, run a second phase:
#> `sampling_design() |> draw(...) |> execute(full_sample)`.The parts were selected independently, so each is estimated on its own and the estimates are combined. Totals add, and so do their variances. The outcome below is synthetic.
set.seed(2033)
banjul_sample$improved <- rbinom(nrow(banjul_sample), 1, 0.6)
other_sample$improved <- rbinom(nrow(other_sample), 1, 0.4)
totals <- list(banjul_sample, other_sample) |>
lapply(function(part) {
survey::svytotal(~improved, as_svydesign(
part, stages = 1, systematic_variance = "approximate"
))
})
c(total = sum(sapply(totals, coef)),
se = sqrt(sum(sapply(totals, vcov)))) |>
round()
#> total se
#> 126312 2336A mean is a ratio of two totals, so its variance also needs their covariance within each part. Prefer the pass-through stage when a part differs only by a stage that some units skip, because everything then stays in one design. Separate designs suit parts with different frames or methods, at the price of combining the estimates by hand.
12.5 Subsamples within the household
A DHS does not ask every question of every household. The men’s questionnaire, the biomarker tests and the measurement of height and weight are done in every second selected household (Gambia Bureau of Statistics and ICF 2021). This is a second phase within each cluster, drawn from the households already issued.
mens_half <- sampling_design("Men's subsample") |>
stratify_by(cluster) |>
draw(frac = 0.5, method = "systematic") |>
execute(issued, seed = 2028)
nrow(mens_half)
#> [1] 3989
round(nrow(mens_half) / nrow(issued), 3)
#> [1] 0.52Stratifying by cluster keeps the subsample within each cluster. method = "systematic" has a fixed size, so frac = 0.5 takes 13 of 25 households, rounding up, and the subsample’s weights are the household weights times 25/13.
The domestic violence module goes one step further. In each household of the men’s half, one woman is selected at random and interviewed alone, and her weight is multiplied by the number of eligible women in her household. A person stage in samplyr does this from the household roster, with draw(n = 1) within each household.
12.6 Virtual survey
Each subsample costs precision. An indicator measured in the men’s half has about half the interviews of one measured in every household, and an indicator of the domestic violence module has one woman per household of that half. The virtual survey measures mCPR in the three ways on the synthetic Gambia, as if it were an indicator of each kind.
gmb_synthetic <- readRDS("data/gmb_synthetic.rds")
inputs <- gmb_inputs()
response <- mutate(inputs, lga, household = completed, person = women_rr,
.keep = "none")
every_household <- virtual_survey(dhs_design, gmb_synthetic, response,
reps = 1000, seed = 10)
half <- virtual_survey(dhs_design, gmb_synthetic, response, reps = 1000,
seed = 10, take = 13)
one_woman <- virtual_survey(dhs_design, gmb_synthetic, response, reps = 1000,
seed = 10, take = 13, one_person = TRUE)
tibble(lga = every_household$lga,
rse_all = every_household$true_rse,
rse_half = half$true_rse,
rse_one = one_woman$true_rse,
women_one = round(one_woman$respondents)) |>
mutate(x_half = rse_half / rse_all, x_one = rse_one / rse_all) |>
mutate(across(c(starts_with("rse"), starts_with("x_")),
\(x) round(x, 3))) |>
as.data.frame()
#> lga rse_all rse_half rse_one women_one x_half x_one
#> 1 Banjul 0.100 0.134 0.160 167 1.342 1.602
#> 2 Kanifing 0.094 0.133 0.170 232 1.411 1.813
#> 3 Brikama 0.064 0.085 0.113 474 1.320 1.759
#> 4 Mansakonko 0.110 0.133 0.162 326 1.211 1.466
#> 5 Kerewan 0.112 0.132 0.168 225 1.173 1.494
#> 6 Kuntaur 0.101 0.118 0.168 359 1.172 1.668
#> 7 Janjanbureh 0.097 0.120 0.157 258 1.233 1.619
#> 8 Basse 0.105 0.126 0.176 589 1.207 1.679
#> 9 National 0.042 0.053 0.071 2629 1.256 1.687The columns x_half and x_one divide each RSE by that of the full take. Taking 13 households instead of 25 multiplies the RSE by 1.2 to 1.4. The interviews alone would give \(\sqrt{25/13} = 1.39\). Fewer women per cluster also means a smaller design effect, \(1 + (b - 1)\rho\) with a smaller \(b\), which recovers part of the loss. It recovers least in Banjul and Kanifing, whose clusters hold so few married women that their design effect was small already. One woman per household multiplies the RSE by 1.5 to 1.8. An indicator of the men’s half, such as stunting, misses a target set for the full sample by a third, and one of the domestic violence module by more. A plan that needs such an indicator by LGA must size on it, with the yield of the subsample, as Chapter 8 sized on mCPR.
12.7 Replacement and reserve households
The 2019-20 interviewers were “asked to interview only the pre-selected households”, and “replacements and changes of the pre-selected households were not allowed” (Gambia Bureau of Statistics and ICF 2021). A household that refuses or cannot be found is a nonrespondent, and the weights of the respondents of its stratum are adjusted for it.
Other surveys replace. The Malawi IHS of Chapter 28 selects 16 households to interview in each EA and five more as replacements, taken in a fixed order when a selected household cannot be interviewed. Its response rate after replacement is close to 100%, and says little. A replacement stands in for a household that refused or was absent, and the estimates assume that the two are alike. Chapter 17 measures, with a stress test, what that assumption costs when it fails.
A design can also hold its reserve inside the probability sample. It can select more households than it needs, split them at random into a main sample and a reserve, and release the whole reserve, in every cluster, if response falls short. Chapter 20 shows that release schedule in samplyr. Or each cluster can list its take plus a few reserve households in a random order and release them one at a time as households fail. Section 17.4 computes the weights for that scheme from the field’s dispositions. In both cases the weights follow from the design.
12.8 Backtest
Appendix A gives the second-stage probability as \(P_{2hi} = g_{hi} / L_{hi}\), with \(g_{hi} = 25\) and \(L_{hi}\) the listed households (Gambia Bureau of Statistics and ICF 2021). The weight samplyr gives each household for the second stage should be the inverse of that probability.
listed <- count(listing, cluster, name = "L")
issued |>
as.data.frame() |>
left_join(listed, by = "cluster") |>
mutate(p2 = pmin(25, L) / L) |>
summarise(largest_difference = max(abs(.weight_2 - 1 / p2)))
#> largest_difference
#> 1 0The weights match. Table A.6 of the report gives the men’s half as 3,491 of the 6,985 households selected, a share of 0.500. The subsample above takes 0.520, since a systematic draw of a fixed size rounds 12.5 up to 13. A DHS takes every second household from a random start, which gives 12 or 13 households in a cluster of 25 and half on average. round = "down" would give 12, and the choice changes the weights by a factor of 25/13 or 25/12.
12.9 How the other surveys select households
The Zimbabwe MICS of Chapter 26 lists the selected segment of its large clusters, takes 26 households by systematic sampling, and tests the drinking water of 5 of them, a subsample like the men’s half. The Malawi IHS lists each EA in the month before its interviews and sets its replacements then. The Rwanda LFS lists the PSUs of its master sample once and follows the same households over several quarters (Chapter 20).
12.10 What to record
All households of each selected cluster are listed before the interviews. Twenty-five households are selected from the listing by systematic sampling with a random start, or all of them when fewer than 25 are listed. Interviewers interview only the selected households, and no replacement is allowed. The second-stage probability is \(25 / L_{hi}\). Men aged 15 to 59 are interviewed in every second selected household, where the biomarker tests and the anthropometric measurements are also done, and one woman per household of that half is selected for the domestic violence module.
12.11 Exercises
- Raise the spread of the synthetic listing from 0.2 to 0.4 and recompute the national weighting loss of the issued sample.
- Full vaccination is measured in every household. Suppose it were measured in the men’s half only. Using the yields of
gmb_inputs(), how many households would Basse need for an RSE of 10%, and how many EAs? - Draw the men’s half with
round = "down". What fraction of the households does it take, and how do the weights change? - Why does halving the take not multiply the RSE by \(\sqrt{2}\)? Compute the design effect at 25 and at 13 households for Basse with the rural intraclass correlation of Chapter 9.
- Replace
0.2by0.4in the listing and rerun. The median CV of the weights within a stratum doubles, from 17% to 33%, and the national weighting loss rises from 1.92 to 2.23. n_prop(vacc, cv = 0.10, deff = vacc_deft^2, eligibility_rate = in_scope, resp_rate = resp_in_scope, eligible_per_unit = children_hh)gives 102 households for Basse when every household counts. In the men’s half, every second household counts, so the survey must select twice as many, 203 households or 9 EAs. Basse receives far more for mCPR, so vaccination would still not bind.- 12 of 25, a fraction of 0.48, and the subsample’s weights are the household weights times 25/12.
- With \(\rho = 0.04\) and 2.3 married women per household at a response of 88%, \(b\) is about 51 at 25 households and 26 at 13, so the design effect falls from 3.0 to 2.0. The RSE rises by \(\sqrt{25/13 \times 2.0 / 3.0} = 1.14\) rather than \(\sqrt{25/13} = 1.39\), close to what the virtual survey finds in Basse.